检测 Paypal 订阅取消
我编写了一个简单的贝宝订阅系统,用户可以在其中输入他们的信息,单击按钮,然后开始订阅。我想知道如何知道用户何时取消订阅?我已经看到 $txn_type subscr_cancel 但我不知道如何使用它,因为 paypal 不会再次调用我的处理程序。
谢谢!
I have written a simple paypal subscription system, where a user can enter their information, click the button, and start a subscription. Im wondering how I can find out when the user cancels the subscription though? I have seen $txn_type subscr_cancel but I have no idea how to use that, since paypal doesn't call my handler again.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否使用IPN(如果是)那么,当取消订阅时,PayPal 返回
$_POST['txn_type'] = subscr_cancel
以及 subscr_date = 订阅日期、subscr_id = 订阅 ID 等,现在您可以处理取消请求返回的订阅 ID。同样,订阅结束时您会得到
$_POST['txn_type'] = subscr_eot
。一旦您在 paypal 设置中设置了 IPN url,它将始终调用您的 IPN 处理程序。
使用 switch case 来处理不同的请求,如下所示,
Are you using IPN if yes then, when a subscription is cancelled paypal returns
$_POST['txn_type'] = subscr_cancel
along with subscr_date = subscription date, subscr_id = subscription ID, etc now you can process cancel request for the returned subscription id.similarly you get
$_POST['txn_type'] = subscr_eot
when subscription ends.Once you have setup IPN url in the paypal settings it will always call your ipn handler.
use switch case to handle different requests like so,
当用户实际取消订阅时,会发送类型为“subscr_cancel”的 IPN。这不应该用于取消订阅,因为这可能在订阅期间的任何时候发生。
应使用“subscr_eot”类型的 IPN 来取消订阅。当用户的订阅期到期时发送此消息。
The IPN with a type of 'subscr_cancel' is sent when the user actually cancels the subscription. This should not be used to cancel the subscription as this can happen anytime during the subscription period.
The IPN with the 'subscr_eot' type should be used to cancel the subscription. This is sent when the user's subscription period has expired.