1

How can I capture paypal IPN and Authorize.net "Silent Post" messages?

I'm fine with how to make payments with Omnipay but I could not yet figure out how to listen to the callbacks from these APIs to detect changes for my payments.

For example Authorize.net processes it's credit card payments one time per day (late night for me) and then sends out it's messages via their so called "silent post" (its just a http POST) notifications. So the API call might be immediately "accepted" but I won't know for sure if everything is OK with the payment until I receive the callback.

So how do I set up Omnipay to listen to APIs that do these kind of delayed callbacks?

I'm aware that I'll need a callback URL like /payments/callback/ to load the right gateway to do something with the callback. But I could not yet figure out what method(s) from Omnipay I have to use for it.

floriank
  • 25,546
  • 9
  • 42
  • 66

1 Answers1

1

Omnipay doesn't support notifications for existing payments. It automatically handles the first notification which is made directly after a payment, but doesn't yet have methods to handle notifications if you change the status of a payment (for example by refunding it from PayPal's control panel, it will not update in your database automatically).

Note this isn't needed for the initial payment. Especially with PayPal Express the payment is not confirmed until the customer returns to your site, so there is no chance of them closing the browser window and the payment being lost.

If you want to set up a notification endpoint and listen for events which happen after the payment is processed, you will need to add a new request type to Omnipay.

Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70
  • Thanks for our answer Adrian, I know you're the author of the Omnipay lib. Your answer sounds like Omnipay doesn't provide an object that will deal with the callback notifications? So I would have to implement that for all gateways myself? What you say applies for Paypal but for credit cards you definitly want to know if the payment was processed OK, which usually happens the latest 24h after you've made the payment. So it is really important to listen to the API callbacks. This is something that should definitly improved IMHO. – floriank Dec 05 '13 at 00:44
  • As I said, the initial payment is different from out-of-band notifications sent later on. With on-site credit card payments the response is returned instantly. Omnipay handles the initial API callback for off-site payments with its `completePurchase()` method. So for example with Authorize.Net SIM, the callback URL is set to be the same as the returnUrl in the request, and verified in the response. – Adrian Macneil Dec 05 '13 at 03:47
  • Also, your statement above is incorrect. I don't know which Authorize.Net API you are referring to, but with credit card payments you will know immediately whether or not the payment was successful. The fact that it takes overnight for the payment to be cleared into your bank account is unrelated - at the point payment is made, the card has been authorized and the funds are held in your name. – Adrian Macneil Dec 05 '13 at 03:50
  • This is in fact huge architectural problem as internet-banking payment gateways are a) off-site by default, b) depend on application being able to parse their asynchronous responses and status notifications. These gateways always send redirect urls, where client is redirected to his online banking account to authorize internet money transfer. After payment gateway gets notification about transfer acceptance from bank it sends notification to application asynchronously and that's the only way to be notified about payment status change. In its current state Omnipay is unusable for such purposes. – Łukasz Biały Feb 22 '15 at 19:39