Welcome Guest, Not a member yet? Register   Sign In
Designing app flow for saving info across a Paypal transaction
#1

[eluser]rideearthtom[/eluser]
I need to save certain text fields during a shopping-cart process I've built, and after a Paypal transaction, save this info to the database along with the transaction details.

Should be easy enough I thought, but Paypal's 'custom' var only accepts 256 characters, which isn't enough. There's no guarantee, either, that the user will return to the site after payment. The only thing I can rely on is that Paypal's IPN will come through asynchronously if the transactions is successful. Since it's async, I can't use the session to store the text fields.

I'm not really sure what to use. I could use a temporary db record, saved during the checkout but before the user leaves the site for Paypal, but since there's no transaction record in the database at that point, there's nothing to reference it to.

Would the best thing to do be to pass Paypal a custom token, e.g the PK of the saved record, which retrieves the data from the DB once the IPN passes it back and creates the relationship to the transaction when it's saved? Or is there a simpler way?

I think I just answered my own question... I just have a phobia now of Paypal and their impossible-to-debug-locally IPN system...
#2

[eluser]troy_mccormick[/eluser]
How you describe it is almost exactly how I do it in my apps.

I have a paypal_carts table where I store all of the cart information that I'm sending to PayPal. I then, in the custom field to PayPal, input the id of that database record. Then, when PayPal IPN comes back, I just lookup the cart info in the table and send emails/reports/whatever from that info.

Easy as pie Tongue

EDIT: As far as debugging locally, they do have a pretty good sandbox that I was able to test IPN pretty well with...what issues are you running into?




Theme © iAndrew 2016 - Forum software by © MyBB