views:

59

answers:

1

I've implemented a paypal transaction before but this one has a twist that I'm not quite sure what's the best way to handle it.

The basic idea is I want to create an account for the user when he provides some details and makes a payment via PayPal. Until BOTH the user details are filled out correctly AND the payment is made correctly, I shouldn't create an account for the user.

The setup I've done before was simply a paypal button that the user clicks, makes a payment, and gets forwarded back to just a generic page "your order will be processed and shipped" so there was no pre-order form involved.

This one is different though because

  • before PayPal, I need to collect initial user data
  • after PayPal, I need to create the new user account and use in it the user data collected from the pre-paypal form

I'm sure there's a logical way to implement this, but I'm not quite sure what's the flow I should follow to do it.

I use the Zend framework by the way, which shouldn't matter but just in case Zend has an easier way to help me with what I'm trying to do.

+3  A: 

I do the following (though I do this in ASP.NET):

  1. User fills out form
  2. Info is saved in Order table in db with a unique invoice number
  3. Invoice number is passed to PayPal, along with the IPN Notify URL, when you do the redirect
  4. User is sent to Paypal to pay and then comes back to a generic Success page
  5. Behind the scenes, Paypal makes a call to the IPN Notify url once processing is complete. This page receives your invoice number which PP returns with its call, and then does the account creation processing for that order after retrieving the details from the db. [This is a page with no UI, since only PP is hitting it.]
  6. An email is sent from that process which notifies the customer that their account has been created and gives them the details.

This is a simplified version of the process, but hits the highlights. You can check out PayPal's page about IPN, and do a search on google for IPN integration with PHP.

patmortech