QuickTip: PayPal IPN - Complex Pass Through Data

Send complex data in the custom field that you use to match a payment with a customer, order or whatever you need.

If you already rely on the PayPal IPN, or are in the process of implementing it I'm sure you're ready to use the available "Custom" field to match a payment to orders, customer or whatnot in your own system. At one point or another you'll come to the conclusion that it would be nice with a couple of more of those "Custom" fields.

But actually, you only need one. And I'm not talking about using some weird comma-separated list of values and stuff it in the field.


It's really simple though, and you'll think "Doh! Why didn't I think of that!!". Here are the steps required, and I already assume you know how to do these steps in your own preferred language.

  • Create a dummy class containing all fields that you would like to pass.
    Example (You should really not be needing exactly these fields, because if your db is set up correctly you would only need OrderId to be able to figure out the rest) :
        class PaymentData
          public int CustomerId {get; set; }
          public int OrderId {get; set;}
          public List Products {get; set;}: 
  • Create an Instance of PaymentData and assign all fields to the values you wish to persist during the payment process.
  • Encode the instance of PaymentData to Json, and stuff it in the custom field. Yaaay!
  • Whenever you get an IPN notification you can decode the Json and read the data through the class instance in a structured and easy to read manner.


Until next time.


A little about me, and what this page will be about from now on.

Page 2 / 2

 Know your limits: Web Design

You might have the best app ever created, or you might have the user friendliest web page in the world. You might even have the most useful piece of shareware ever made and still not making any money.

 Facebook PHP SDK login problem

Have you integrated a facebook login to your site, or are you planning to? There\'s a small bug involving the sign in process that can make your life miserable unless you know how to get around it. Here\'s one possible solution.

 Thumbs Up Immerse VR Headset

This Immerse headset from ThumbsUp offers both positive and negative sides.

 DroidXplorer big in China?

According to an email DroidXplorer will be preinstalled on devices, and be featured on a set of app stores. For free.

 Would this interest you?

Page 1 / 11