Mushr00m
Mushr00m

Reputation: 2356

Paypal IPN custom variables

My Paypal IPN payement is working (buy now button) but now I have to add some variables, like the discount name, the user ID, etc... in my database for each transaction. In the past I used the custom hidden field as I just need the user ID. But now I don't know how to pass this new custom variables and have them POST back form Paypal if the payement succeed ?

Thanks for your help !

Upvotes: 3

Views: 8558

Answers (1)

Nick
Nick

Reputation: 6025

You've got three main options:

  1. Use the standard custom hidden field to store all the data you need in one string. You could use JSON format or some equivalent. The variable size is limited to 256 characters, which sounds like it might be enough.

  2. Store a unique id in the custom field, and use this id to look up the other data that you've stored in your database.

  3. There are also additional option fields you can use as suggested here and explained by PayPal here:

You could possibly also use some of the standard PayPal fields for purposes other than that for which they were intended (i.e., to hide your data), but this is highly dubious and entirely unnecessary, I would imagine.

See this answer.

Upvotes: 13

Related Questions