Showing posts with label payment. Show all posts
Showing posts with label payment. Show all posts

Friday, January 16, 2009

Paypal IPN and mc_fee

I encountered an interesting problem today with accepting payments for an online registration solution I wrote for a non-profit organization. The application accepts payments using Paypal's Instant Payment Notification feature. IPN works as follows:
  1. You put a form (hidden or with bits visible) that POSTs data to Paypal
  2. This brings the user to Paypal where they can pay using either a credit card or their Paypal account
  3. As part of processing the user's payment, Paypal takes key information about the user's payment e.g. transaction id, amount, and other sundry details and POSTs them to a custom instant payment notification URL (as it happens to be called) on your site
  4. This URL is hopefully hosts a script or other form of code that can pick up all the POSTed IPN variables and POSTs back the information with one extra variable to validate the information
  5. Once this POST back to Paypal returns with a success status the application can record the user's payment and credit them appropriately.
The problem I'm facing is that I received an IPN POST to my application where the mc_fee variable is apparently null or undefined. This is a column that's specified as NOT NULL in my database schema as per many other examples from Paypal and others. I'm not sure what's going on. It's too late to mount a full investigation tonight but tomorrow is a new day.