Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am working on payment page of my website but cannot figure out at which process to store customer's details before sending them to PayPal payment page. Here's the process:

  1. Choose Product page
  2. Fill in customer details page
  3. Cart confirmation page
  4. PayPal official site payment page

    if success

  5. redirect back to my site
  6. Login to their account
  7. Fill in some form

    if not success (cancelled/denied/etc)

  8. redirect back to my site to meet cancellation page.

What is the best approach for this circumstance as I would want to store only the successful transaction, customer who actually did make a payment but that has to be after I received the IPN code from PayPal. Will I lost their customer data on the way if I decide the store their details in the database after they are redirected back to my website?

If I choose to store customer data at stage 3 in the temp table, I guess I would have had a long list of unsuccessful records in the temp table and I have to update back and forth in multiple tables for this approach. What would you recommend?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

There's no one correct way to do this - but I tend to be of the mind that storing the purchase record before payment is better. Its possible for someone to pay for an item and not redirect back to your site and you'll still need to know they bought something.

Additionally, if you use IPN, then you'll want to have a record of what the customer tried to buy and how much it was in order to verify you got the right amount against the right transaction.

Here's a longer answer I did earlier: http://stackoverflow.com/questions/4665982/paypal-integration/6044566#6044566

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.