Php 在paypal内取消订阅时收到什么样的ipn响应?

Php 在paypal内取消订阅时收到什么样的ipn响应?,php,paypal,paypal-ipn,paypal-subscriptions,Php,Paypal,Paypal Ipn,Paypal Subscriptions,我首先向客户收取即时付款的费用,然后创建订阅配置文件。这是我收到的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] => FA5X

我首先向客户收取即时付款的费用,然后创建订阅配置文件。这是我收到的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
)
这一个应该用于订阅配置文件:

[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中停用订阅


这是最好的方法吗?如果可能的话,你能解释一下你是如何在你的系统上工作的吗?

几年前,我确实写了一篇关于这方面的文章,解释了可以为订阅生成的所有不同类型的IPN。如果您想阅读完整答案,我已经重新发布了它,但这里有一个简短的答案:您将获得一个带有
txn\u type=recurtive\u payment\u profile\u cancel
的IPN。这应该在买家取消订阅后立即发生


现在…如果购买者在订阅中取消,则在计费周期结束时,将得到第二个IPN,该代码为“代码> TxnyType=CurrrIngPayMeNeXuxOuts。例如,如果您的订阅每12个月计费一次,并且买家在6个月后取消,您将在他们取消订阅时获得一个带有

txn\u type=定期付款\u profile\u cancel
的IPN,另一个带有
txn\u type=定期付款\u的IPN将在12个月后过期
(例如,当PayPal在未来12个月内支付账单时)。这种想法是买方已经支付了12个月,即使他们仅在6个月后取消了付款。
定期付款到期
IPN本质上是通知您:“嘿,此人的订阅已满-现在你应该停用你向他们提供的任何产品/服务".

事实上,几年前我写了一篇文章,解释了可以为订阅生成的所有不同类型的IPN。如果你想阅读完整答案,我已经重新发布了它,但这里有一个简短的答案:你会得到一个带有
txn\u type=recurrency\u payment\u profile\u cancel
的IPNer取消了他们的订阅


现在如果购买者在订阅中取消,在计费周期结束时,你将得到第二个IPN,代码为“txnnyType=RealrgInPayMeNeXuxOut/<代码>。例如,如果你有一个订阅,每12个月一次,买家在6个月后取消,你将得到一个IPN。e_cancel在他们取消时,另一个具有
txn_type=recurtive_payment_的IPN在12个月结束时过期
(例如,PayPal在接下来的12个月内应该是该结账的时候)这个想法是,买家已经支付了12个月,即使他们在仅仅6个月后就取消了付款。
定期付款\u过期了
IPN本质上是一个通知,告诉你“嘿,此人的订阅已到期-现在你应该停用你向他们提供的任何产品/服务”.

谢谢@matt,这篇博文非常有帮助。我从没想过会有这么多回复。不过,我有一个简单的问题,反复付款失败是否意味着买家paypal帐户余额不足?不一定,因为买家可以使用其他资金来源(如银行账户)支付订阅费这只是意味着我们由于某种原因未能支付款项。(信用卡被拒绝是最有可能的原因,但不是唯一的原因。)这就是我的想法。谢谢@matt:)谢谢@matt,这篇博文非常有用。我从来没想过会有这么多的回应。不过,我有一个简单的问题,重复付款失败是否意味着买家paypal帐户中没有足够的余额?不一定,因为买家可以使用其他资金来源(如银行帐户或信用卡)支付订阅费。这只是意味着我们由于某种原因未能为付款提供资金。(信用卡被拒绝是最有可能的原因,但不是唯一的原因。)这就是我的想法。谢谢@matt:)