3

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 !

Mushr00m
  • 2,258
  • 1
  • 21
  • 30
  • you should only parse cone custom var, an id, and store the rest of the data locally. use that id to retrieve the data when paypal connects back via IPN –  May 27 '13 at 21:36
  • So it's impossible to pass other variables and have them back... With your option you mean to store it in the DB and use them after or in a Session ? – Mushr00m May 28 '13 at 09:49
  • there's a limit on the custom vars, so you cant use them as an alternative to local storage. –  May 28 '13 at 19:52

1 Answers1

14

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.

Community
  • 1
  • 1
Nick
  • 5,995
  • 12
  • 54
  • 78