我首先向客户收取即时付款,然后创建订阅个人资料。这是我接受的ipn。
我猜这是即时付款:
[2016-10-31 16:26:11] local.INFO: IPN RESPONSE:Array
(
[mc_gross] => 9.99
[invoice] => 49
[protection_eligibility] => Ineligible
[item_number1] =>
[payer_id] => FA5XLVU3CLN92
[tax] => 0.00
[payment_date] => 09:26:06 Oct 31, 2016 PDT
[payment_status] => Completed
[charset] => windows-1252
[mc_shipping] => 0.00
[mc_handling] => 0.00
[first_name] => omer
[mc_fee] => 0.59
[notify_version] => 3.8
[custom] =>
[payer_status] => verified
[business] => business@gmail.com
[num_cart_items] => 1
[mc_handling1] => 0.00
[verify_sign] => A8SKEyFJtpw0I2pUVRQ9wRhpVLh9AnPjeq8ltcpWBhIHlTZuf.ak4aa-
[payer_email] => customer@gmail.com
[mc_shipping1] => 0.00
[tax1] => 0.00
[txn_id] => 3J610862594926351
[payment_type] => instant
[last_name] => farooq
[item_name1] => Product 1
[receiver_email] => business@gmail.com
[payment_fee] => 0.59
[quantity1] => 1
[receiver_id] => RSDJM66ZP7LZ8
[txn_type] => cart
[mc_gross_1] => 9.99
[mc_currency] => USD
[residence_country] => US
[test_ipn] => 1
[transaction_subject] => 49
[payment_gross] => 9.99
[ipn_track_id] => af46df962d1bf
[cmd] => _notify-validate
)
这个应该是订阅资料:
[2016-10-31 16:27:09] local.INFO: IPN RESPONSE:Array
(
[payment_cycle] => every 12 Months
[txn_type] => recurring_payment_profile_created
[last_name] => farooq
[next_payment_date] => 03:00:00 Oct 31, 2016 PDT
[residence_country] => US
[initial_payment_amount] => 0.00
[currency_code] => USD
[time_created] => 09:26:08 Oct 31, 2016 PDT
[verify_sign] => AwD4sJJmdrzDKNGw7KMAMuZSx1AHAJkBGoIT8Zl86XtmqM9xpRo7woGm
[period_type] => Regular
[payer_status] => verified
[test_ipn] => 1
[tax] => 0.00
[payer_email] => customer@gmail.com
[first_name] => omer
[receiver_email] => business@gmail.com
[payer_id] => FA5XLVU3CLN92
[product_type] => 1
[shipping] => 0.00
[amount_per_cycle] => 9.99
[profile_status] => Active
[charset] => windows-1252
[notify_version] => 3.8
[amount] => 9.99
[outstanding_balance] => 0.00
[recurring_payment_id] => I-R159BJH8WJHF
[product_name] => 49
[ipn_track_id] => 45f60995a00
[cmd] => _notify-validate
)
现在我的问题是如果有人通过他的paypal帐户取消订阅?显然我认为我不会在下一个结算周期收到ipn响应。或者,paypal会向您发送一些消息,说订阅已被停用?
我是否一直在寻找是否在某个结算日期收到了ipn,如果我没有收到ipn,我只是假设他们可能已经从paypal中取消了订阅。
这是最好的方法吗?如果可能,您能解释一下您的系统如何工作吗?
答案 0 :(得分:3)
几年前我实际上已经写了一篇文章,解释了可以为订阅生成的所有不同类型的IPN。如果您想阅读完整的答案,我已将on my personal blog重新发布,但这里的答案很简短:您将获得txn_type=recurring_payment_profile_cancel
的IPN。这应该在买家取消订阅后立即发生。
现在......如果买家在订阅中间取消,您将在结算周期结束时获得第二个IPN txn_type=recurring_payment_expired
。例如,如果您的订阅每12个月发票一次,而购买者在6个月后取消订阅,那么您在取消时会获得txn_type=recurring_payment_profile_cancel
的IPN,而txn_type=recurring_payment_expired
会收到{{}在12个月结束时(例如,PayPal将在未来12个月内收费的时间)。这个想法是,买家已经支付了12个月,即使他们仅在6个月后取消了。 recurring_payment_expired
IPN本质上是一个通知,您可以说#嘿,这个人的订阅已经完成 - 现在您应该停用您提供给他们的任何产品/服务"