IT.COM

[resolved] PayPal IPN + serialize() question

Spaceship Spaceship
Watch
PayPal IPN + serialize() question

Guys I am totally having a brain fart here.

I have a form with about 7 fields that need to be inserted into the mysql database upon submission. The script then needs to direct the user to paypal where upon payment, paypal will notify my site and update the listing's `paid` column to 1. (There is also a 'free listing' form which does the same thing, so I have a column in the database called 'paid', which is enum 1 or 0).

My question is, should I be doing the INSERT AFTER the payment is verified through IPN? Am I creating more work for myself by inserting then updating after verification? How does serialize play into all of this? I am in need of a good beginner tutorial apparently.

NOTE: I also noticed PayPal provides a custom field marked 'custom' for you to pass data into. How can I serialize the data into a 'custom' variable before sending it off to paypal?

Your answers are appreciated, thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
I've not integrated with paypal before, but seeing as no-one else has replied yet, I'll say this:

I have integrated with several other payment gateways and we always insert the order into the DB first, and then update a field to show the transaction result.
One of the benefits of this is that it leaves a clear database history of abandoned orders, which is useful for us.

I've had a quick look at the paypal docs:
https://www.paypal.com/en_US/ebook/PP_WebsitePaymentsStandard_IntegrationGuide/toc.html

And based on this, my approach would be:
1. User clicks through to checkout page
2. Checkout page generates an order in the DB, and displays PP form
3. User submits form ( which goes to PP )
4. PP returns user to website, order is marked as complete, cart is emptied

Not sure where/why you'd need serialize.
Hope that helps ;)
 
1
•••
Perfect, I was leaving out the good ol' checkout (or buffer) page.

Thanks
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back