Detecting Paypal Subscription Cancellation(检测 Paypal 订阅取消)
问题描述
我编写了一个简单的 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.
谢谢!
推荐答案
如果是,您是否使用 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,
switch ($_POST['txn_type']) {
case 'cart':
//for products without subscription
break;
case 'subscr_payment':
//subscription payment recieved
break;
case 'subscr_signup':
//subscription bought payment pending
break;
case 'subscr_eot':
//subscription end of term
break;
case 'subscr_cancel':
//subscription canceled
break;
}
这篇关于检测 Paypal 订阅取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:检测 Paypal 订阅取消


- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01