Paypal integration

troyid

I want to be able to collect the buyers info (website, contact details) before sending them to paypal to pay. Can anyone suggest what I would need to do or show me examples.

Thanks

webwest

6:45 am on Dec 2, 2009 (gmt 0)

You could set up a standard form and put the paypal button on the Thank you page but the buyer will have to input his name etc twice.

I'm new to this forum but not to Ecommerce. :)

MWpro

6:56 am on Dec 2, 2009 (gmt 0)

Yeah but the better way to go would be to grab all that data after the transaction is complete via Paypal's IPN (instant payment notification).

webwest

7:05 am on Dec 2, 2009 (gmt 0)

You're right MWpro.

troyid

8:09 am on Dec 2, 2009 (gmt 0)

Got any pointers on grabbing all the info via IPN?

rocknbil

7:02 pm on Dec 2, 2009 (gmt 0)

You could set up a standard form and put the paypal button on the Thank you page but the buyer will have to input his name etc twice.

Actually, if you look through the documentation, you can pass most of the data input on your site to payPal so it's pre-populated. I don't have specific code examples ATM, but if you dig through the payPal documentation, you will see what they are. All you need to do is map what you have in your forms to their variables or just use their variables - "first_name", "last_name", etc. You just add them as hidden form field values in your post/query to payPal. Then when they arrive on payPal all of that is pre-populated.

Got any pointers on grabbing all the info via IPN?

I was going to suggest IPN here, but don't think you'll need it. IPN is needed **only** if you want to update something on your site after the payment has cleared. I'll mention both methods in case you decide to rethink how you're automating the registration process. The way IPN works is . . .

Scenario: purchase a download. On your site is:

- order form, non secure as we won't be collecting CC info. - A "listener" script that listens for the IPN token.

- In payPal, you enable IPN and set the URL to the "listener" script which will receive input for Instant Payment Notification.

Customer places order. On submit, you perform two actions.

1. Enter data into the database, but there is a field, let's call it "completed", that is set to 0 (zero) at this time. All orders with "zero" are not available for download. You also generate some unique ID as a "handle" on the order, this is passed to payPal as "trans_id." This will be passed back to your site to the listener script.

2. You pass all of the available info to payPal for payment.

Normally, on completion you rely on the customer to click the "return to Merchant" link. This is where regular payments fall down; if the customer fails to do this, it fails to update your site. However, with IPN, payPal sends a token that includes "trans_id" to the listener script on completion of payment. The beauty of this is you can accept eChecks, which may not send the token for up to three days. With credit cards, it's relatively instant.

- When the payment is complete, payPal sends the token to your "listener" script. After some validation postbacks, your script locates the placed order via the "trans_id" value, updates the database setting "completed" to 1, sends email to the customer with the unique (and expiring) URL for the download.

You can probably see why you don't need IPN - it doesn't appear your site needs updating after the sale/registration.

I want to be able to collect the buyers info (website, contact details) before sending them to paypal to pay.

See my reply to the first quote above. All that needs to happen is

- Customer fills out form - Receiving script updates database, emails you the info, whatever. - The tail end of the script compiles a form of hidden fields using the submitted info and posts those to payPal. - Customer lands on payPal site with info pre-populated, all they need to do is enter CC info.

The return to merchant link is optional.

As for how to do it - log into your payPal account and hit the documentation, there are tons of examples in multiple server side languages.

MWpro

5:03 am on Dec 5, 2009 (gmt 0)

I still think IPN would be more efficient. As a customer, I would be confused to as why the site wanted me to fill out my personal information before going to Paypal. And many Paypal users already have accounts where they simply have to log in and their information is already there. If I had a paypal account but you still made me enter my information before I went to Paypal for no apparent reason, I would be pissed off that you wasted my time.

Getting the information after the sale and storing it in the database in the IPN script is way more streamlined in my opinion.

You can probably see why you don't need IPN - it doesn't appear your site needs updating after the sale/registration.

IPN is simply a script on your server that is called after the transaction is successful. It can do whatever you want, from merely send an email thanking the customer for their purchase, to from putting the customer's information into a database, or to updating the amount of your inventory.

rocknbil

8:22 pm on Dec 5, 2009 (gmt 0)

The scenario was collecting info before being passed to payPal. Second, the data requested by payPal may not be complete, for example, "how you found out about us" (or something else needed not requested in payment) If the O.P. only needed the info from payPal, no reason to bother with any forms at all, just collect the data from the payPal account. <shrug>