Simulate IPN for recurring_payment_skipped from developer.sandbox.com
Asked Answered
G

1

6

I need to simulate IPN when a recurring payment fails. My application can then create create pending invoices and send it to the customers.

I searched and found that I would need to setup IPN that will handle below txn_type

  • recurring_payment_skipped
  • recurring_payment_failed

Will these two be sufficient?

Also, Recently has provided a new tool called IPN Simulator where you can send a sample IPN to a URL. It only supports below txn_types

  • web_accept (eCheck-pending, eCheck-declined, eCheck-complete)
  • cart (Express checkout, Cart checkout)
  • web_accept (Web Accept, Refund)

    and so on. But no recurring_payment_skipped or recurring_payment_failed

Where can I simulate those from?

Please help me out.

Godspeed answered 13/2, 2015 at 10:50 Comment(2)
Just found this post #18824027. I guess PayPal doesn't provide an IPN simulator for those transaction types.Godspeed
Could you run a script regularly with cron that checks for any recurring payments that haven't been paid when they should have, and simulate a failed payment from there?Lovellalovelock
T
0

You are correct, currently, the IPN Simulator does not support Transaction type for subscriptions. Yesterday, May 29, 2015, I put in a request for this at PayPal-PHP-SDK github

https://github.com/paypal/PayPal-PHP-SDK/issues/316

There is a workaround,

For IPN Simulator, I choose some transaction type like "Cart checkout". Then down in the "custom" field I put "sim".

In my IPN listener, I have a block of code that checks if the "custom" field is set to "sim", if it is, then I hard code in test values.

   // if data is coming from the IPN Simulator then
   // just hard code the data in here
   if ( $rawData[custom] == "sim") {
      $rawData[txn_type] = "recurring_payment";         
      $rawData[recurring_payment_id] = "I-ABCDEF123456";
   }

If "custom" is not set to "sim", then your IPN listener bypasses this code block and functions normally. Note: rawData is an array for holding the raw data. At the beginning of the IPN listener, I get all the raw data and put it into an array.

This will allow you to get your IPN script working, and at the same time, not interfere with any other real IPN data coming in.

Trifoliate answered 30/5, 2015 at 22:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.