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:

Choose Product page

Fill in customer details page

Cart confirmation page

PayPal official site payment page

if success

redirect back to my site

Login to their account

Fill in some form

if not success (cancelled/denied/etc)

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?

1 Answer
1

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.