Passing Custom Data
The custom variable is a pass-through variable that allows you to pass your own custom data to PayPal, and pass it back to your listener. For example, you may want to pass a user ID and/or part number with your payment call or PayPal button. This variable allows you to pass that data to PayPal with the payment API call or button click when your customer leaves your website and goes to PayPal to make a payment. Then when the payment is processed, the IPN sends that data back to the listener page, so that on a successful payment, the listener page has the payment status from the IPN values, along with the user ID for the customer that made the purchase, and the part number of the item that was paid for.
The custom variable is ignored by PayPal and is never presented to your customer, it's simply passed to PayPal and then back to your listener. There is only one custom variable accepted by the IPN, however, if you need to have multiple variables passed through, as in the case of a user ID and a part number, you can use a delimiter, such as a comma, to split the custom variable into multiple values. Then, on the listener page, you can parse the value of the custom variable based on the delimiter, to retrieve each of the separate individual values that you need.
Note The length of the custom variable is limited to 256 characters.
For example, if you are using PayPal buttons, in the button form code, you just need to add an extra hidden input form variable to set a value for the custom variable.
<input type="hidden" name="custom" value="[UserID],[PartNumber]"/>