Forums

PayPal integration. My Solution

autodafe 03 Jul, 2008
Hi, I am building a website where we sell courses, I manage courses with Eventlist and registration to courses with Chronoforms.
I have set up a form in which variables like code, title, dates, price and city of the course are loaded thru php (basically I pass the code of the course to the chronoform and it reads all details form the database)

The user fills in a form with its details, which are sent by email.
After the email has been sent (using the "On Submit code - after sending email") I create the paypal button dinamically for the course to which the user has registered.

something like:


Your registration to Course <?php echo $_POST["CourseCode"];?> Has been received.
<br/>
<br/><br/>

You can complete your transaction with PayPal: <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="example@example.com">
<input type="hidden" name="item_name" value="Course: <?php echo $_POST["CourseCode"]; ?> - Dates: <?php echo $_POST["Dates"]; ?> - City: <?php echo $_POST["City"]; ?>">
<input type="hidden" name="amount" value="<?php echo $_POST["Price"]; ?>">
<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="lc" value="IT">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>


Is this the right approach? Could the PayPal form be hacked in some way to hijack funds???
GreyHead 03 Jul, 2008
Hi autodafe,

This is a very common way of creating PayPal forms - it does have some security risks. You could build the form in php and do a url redirect or a curl post from there which makes less information public. Or you could check out PayPal's notes on encryption.

Bob
obisi7 08 Sep, 2008
Bob, et al.--

For novice like me that would like to integrate payment (PayPal) solution into my forms and have comfort of relative security, can you please detail the method you're suggesting for doing this (building form in PHP and doing a redirect and/or curl) or you can direct me to an online tutorial to do this.

Thx for your excellent posts, I have learned quite a bit since joining.
Max_admin 08 Sep, 2008
Hi obisi,

it depends on the scenario you want to happen, how do you want things to work in your form ? there are many things you may care for or may care for some of them only (paypal, mail, storing data...etc)

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
obisi7 08 Sep, 2008
Max--

Thx for your quick response. All I want to do is for a user after filling the registration form (created using dreamweaver and chronoforms) to pay for the sponsorship selected.
Since this is a single amount, I thought I could use the standard code provided by Paypal and slightly modified in this posting. However, though I get the form results by email and I pasted the modified code into the Onsubmit after sending email, my form for the paypal portion did not display.

Please checkout my form at senatorybmiller.com and select the Golf register menu item of click the graphic announcement.

Thx
Max_admin 08 Sep, 2008
Hi Obisi,

please show me the code you got from PayPal and I will tell you where to put it and if it needs editing

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
obisi7 08 Sep, 2008
Max--

Below is the code from PayPal which is similar to the code provided in this thread. I have substituted my form variables where needed. This code is pasted into the Onubmit ... after email sending.
------------------
Your registration Yvonne Miller Golf Tournament has been received.
<br/>
<br/><br/>

Please complete your registration by making payment at PayPal: <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="senatorybmiller@verizon.net">
<input type="hidden" name="item_name" value="Lastname: <?php echo $_POST["lname"]; ?> - First Name: <?php echo $_POST["fname"]; ?> - Company: <?php echo $_POST["company"]; ?>">
<input type="hidden" name="amount" value="<?php echo $_POST["amount"]; ?>">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Max_admin 09 Sep, 2008
Great, thats how it should be, is it working fine now ?

I suggest you replace all
$_POST["somefield"]
with
JRequest::getVar("somefield")
if you have J1.5

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
obisi7 09 Sep, 2008
I am using J1.0.15. It is still not working in that no form is displayed for the payment. I do get the results of the form by email but nothing happens to do the paypal part.

Could you try and fill out the fgolf registration orm on my website: senatorybmiller.com to see what I am talking about. I appreciate it greatly as I am baffled that it is not working when the coding looks ok.

thx
Max_admin 09 Sep, 2008
it looks like you have enabled image verification but didn't add one, it will not let me pass!! do u have CF 2.3.9 ? try to add simple text in the onsubmit and see if it works well ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
obisi7 09 Sep, 2008
I am sorry on the image validation which I included to fight spam. I've disabled image validation. Please try again. My url is: senatorybmiller.com and the form to fill out is the golf registration.

thx Max for assisting.
Max_admin 09 Sep, 2008
do you have a redirect URL ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
obisi7 09 Sep, 2008
yes I do; it is back to my home page index.pp. should this be removed?
obisi7 09 Sep, 2008
that was the issue. Problem solved as soon as I removed the redirect. Is there a way to redirect user back to my homepage after completing the paypal payment? Will that have to be done in the paypal end?

thx
Max_admin 09 Sep, 2008
Hi obisi, I think there is some variable you pass to PayPal which will take users then back to some special URL at your website ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
fred14 23 Nov, 2008
Obisi,
I need to do exactly what you have been doing. We also sell courses and I am using Eventlist to build the courses and I need to develop a form to read the details of the course from the Eventlist into the form and then use the paypal for paying the fee. It will save me a lot of time if you could possibly share your form with me.
Fred
GreyHead 23 Nov, 2008
Hi Fred,

If you search the forums here for PayPal you will find a few postings that include the code you need (unless you need IPN in which case there are some hints but no full solution).

Bob
Anglesey 04 Jul, 2010
This is an interesting thread as I have been looking at ways of embedding a Paypal system into one of my sites so that it signals automatically when the cart is empty.
GreyHead 04 Jul, 2010
Hi Anglesey,

If you want to control a cart inside Joomla I suggets you take a look at Simple Caddy.

Bob
This topic is locked and no more replies can be posted.