413
seCure AjAx sHoPPIng CArt
Completing the PayPal Purchase
e main aspects of completing the purchase are:
• Checking for the Token, which should match the one stored in session
• Checking the PayerID
• Checking the PayPal return status code
• Checking if payment was made, or is pending
• Recording the transaction into two tables
Do not release goods to the buyer if payment is pending. Only release goods if
payment was actually made. Record the details of the purchase as they are at the
time of purchase. Details like shipping address and user name may change later
and will not be the same. So if, for example, you record the user ID in order to
look up an address later, that information may not match what was used for the
actual purchase. F