从developer.sandbox.com模拟IPR for recurring_payment_skipped

Hus*_*ain 6 paypal paypal-subscriptions paypal-ipn

我需要在定期付款失败时模拟IPN.然后,我的应用程序可以创建创建待定发票并将其发送给客户.

我搜索并发现我需要设置将在下面处理的IPN txn_type

  • recurring_payment_skipped
  • recurring_payment_failed

这两个是否足够?

最近 提供了一个名为IPN Simulator的新工具,您可以在其中将示例IPN发送到URL.它只支持txn_types 以下

  • web_accept (eCheck-pending,eCheck-rejected,eCheck-complete)
  • cart (快速结账,购物车结账)
  • web_accept (Web接受,退款)

    等等.但没有recurring_payment_skippedrecurring_payment_failed

我在哪里可以模拟出来的?

请帮帮我.

Ken*_*son 0

您是对的,目前,IPN 模拟器不支持订阅的事务类型。昨天,2015 年 5 月 29 日,我在 PayPal-PHP-SDK github 上提出了这个请求

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

有一个解决方法,

对于 IPN Simulator,我选择一些交易类型,例如“购物车结账”。然后在“自定义”字段中输入“sim”。

在我的 IPN 侦听器中,我有一个代码块,用于检查“自定义”字段是否设置为“sim”,如果是,则我在测试值中进行硬编码。

   // 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";
   }
Run Code Online (Sandbox Code Playgroud)

如果“custom”未设置为“sim”,则您的 IPN 侦听器将绕过此代码块并正常运行。注意:rawData是保存原始数据的数组。在 IPN 侦听器开始时,我获取所有原始数据并将其放入数组中。

这将使您的 IPN 脚本正常运行,同时不会干扰传入的任何其他真实 IPN 数据。