Paypal within Chronoforms, my solution

hustad 17 Oct, 2007
Hi,
Just wanted to share what i did to for my paypal integration.

It works like this: User filles out form fields. Presses Submit button and a mail is sent to site admin. Then a page with a By now button and some text are shown.
To complete the payment the user presses the Buy now button and paypal with the correct values are launched.

My customer is selling digital reports, and the amount is always one and there is a different price for each report. I did not need a chart solution, only a Paypal buy now button.

I created the html form and included in chronoforms. At the "form code" tab on "On submit code - after sending emails" i just pasted in the following: (this is pasted on each report where it has different amount and item_name)


Press the "Buy Now" button below to complete the transaction: <br />
<br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
   <input type="hidden" name="cmd" value="_xclick">
   <input type="hidden" name="business" value="post@domain.com">
   <input type="hidden" name="item_name" value="Astro report">
   <input type="hidden" name="amount" value="12.95">
   <input type="hidden" name="no_shipping" value="1">
   <input type="hidden" name="no_note" value="1">
   <input type="hidden" name="currency_code" value="USD">
   <input type="hidden" name="return" value="http://www.domain.com">
   <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" name="submit" alt="Make payments with payPal - it's fast, free and secure!">
   <img alt="" 
   src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Max_admin 17 Oct, 2007
Thank you very much hustad for sharing your idea and code!🙂

Sincerely,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
CodeLab 23 Apr, 2009
Thank You @hustad
Worked Great For Me.
A Little Hinch Tough.
I Am Accepting Qty In A Textbox, So How Do I Pass The Qty ?
After Payment Is Processed, Need To Email The User Automatically (Actually Emailing Event Ticket).
Have To Make Sure That Ticket Is Emailed Only If Payment Is Made

(Sorry To Dig 2 Year Old Thread, I Thought Maybe Better Then Creating A New One)
CodeLab 23 Apr, 2009
Oops Sorry For Confusion.
By Passing Qty, I Mean

Price Is Fixed, But User Can Purchase Any Number Of Tickets..
So Total Price Is Different
I Meant To Ask How Do I Pass The Total Price
Thanks
Max_admin 24 Apr, 2009
Hi, I think that there is another hidden field to be added with the quantity, you better check paypal docs for the field name!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 24 Apr, 2009
Hi CodeLab,

You'll need to calculate the Totsl - either using JavaScript in the Form HTML or with a little PHP in the Onsubmit Before code:
<?php
$quantity = JRequest::getInt('quantity', '1', 'post');
$total = $quantity * $price;
?>
. . .
<input type="hidden" name="amount" value="<?php echo $total; ?>">
. . .

Bob
gmd8 27 Sep, 2009
I'm just confused though on where to put it? Does it all go on the some page the PayPal button goes or somewhere else?

Thank you.
GreyHead 28 Sep, 2009
Hi gmd8,

a little PHP in the Onsubmit Before code:

should be the OnSubmit Before Code box. You have to turn Emails on in the genreal Tab for thsi box to work.

Bob
rgfuller 15 Mar, 2010
Hello,
Is there an easy way to automatically create a database record indicating that payment was made and the amount of the payment?

thanks
GreyHead 15 Mar, 2010
Hi rgfuller,

It's easy to make a record with the transaction details saying what should have been paid and for what.

Harder to add the info that the payment has been made unless you code in the PayPal IPN or use the fuller PayPal API.

Bob
powellmethod 29 Mar, 2011
Thank you so much for your solution. I am a complete novice and this absolutely fixed my problem without having to bother my web designer for his help.
rbc303 10 Aug, 2011
Hustad, do you have a simple sample form code that looks like order form to purchase something?
I need a fairly complex form that will allow "buying" several types of donation amounts.
This topic is locked and no more replies can be posted.