PDA

View Full Version : How do I do P this??


eeijlar
08-01-2008, 01:19 PM
Hi,

I am building a website that allows users to register in order to access a particular service that the website provides. The user needs to register with the website but also has to pay via Pay Pal. So I have a registration page with a Pay Pal Buy Now button on the bottom. The problem is that when the user goes through Pay Pal, how do I then get their registration details to register with the web site? Will have to pass all their registration data to the Pay Pal request and then get it again when they are finished... I can't think of how to implement this. The registration page can only have one POST method. It can't redirect to Pay Pal and do the registration processing at the same time.

Any suggestions?

/john

bazz
08-01-2008, 01:41 PM
you can have them fil out the registration and carry on through to the payment gateway (paypal). then if you set up to correct type of payment process with paypal, wehen the payment has been processed, there will be w return page, which is the one of your site that paypal returns the user to. this will have had certain values passed from google, to confirm whether payment was in fact made.

As this whole process is done, the values entered by the user during the reg process should be stored in a session so that once paypal has sent them back to your site, the values necessary for updating your db are there, both from gogle and within your session.

I hope that gives some insight.

bazz

mlseim
08-01-2008, 01:41 PM
PayPal has methods to return the transaction details after the
successful payment (IPN). PayPal also has a complete development
website so you can test it out using a fake buyer/seller and
credit card. It's called the "PayPal Sandbox".

See the website (link below) for details, example PHP scripts, how the IPN works,
It's free, it has great information, and allows you to develop your
scripting in an actual PayPal environment (just like the real thing).

https://developer.paypal.com/

Once you get your script(s) tested and working, you simply change your
script's PayPal account names over to your REAL PayPal account. Then,
keep the "sandbox" for your next project.

eeijlar
08-01-2008, 02:31 PM
Ok, great, thanks for your replies. I am using the Sandbox. All I need is the pay pal button so, instead of a register button... I need to verify that data entered on the registration page is valid though... I can't do that if the page redirects to Pay Pal in the POST method. For example:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">

where as to verify the user I would be using this:

<form method="post" action="/account/register">

It wouldn't be ideal if the user went all the way through pay pal only to find out that they hadn't entered the right user name on the registration page. Will I have to use Javascript to get around that as opposed to PHP verification I am using at the moment. I can't have two POST methods...

mlseim
08-01-2008, 05:05 PM
There are two methods you can use ...

1) SIM - Simple Integration Method.
This is where they leave your site, go into PayPal and use
their secure server to enter all of their credit card info, name, etc.
They are then returned back to your server.

2) AIM - Advanced Integration Method.
This is where you have a secure server (HTTPS instead of HTTP) SSL.
They stay on your site and enter all of their name, credit card info, etc.
The packet is sent to PayPal, and returned back with a status/confirmation no.

I think you're planning on using AIM? This is different than using a form.
Your forms are internal to your own website and database ... you use a
PHP API to send the packet of information to PayPal.

Determine which method you are using.

If you're trying to use SIM, you won't be sending PayPal anything about the
customer, only the item number, shipping cost, and dollar amounts. The
customer uses PayPal's secure server to enter their personal information.

If you use SIM, you need a secure server yourself.