本页内容:Handling Recurring Payments你如何通过api取消PayPal订阅?
它表示可以使用API取消PayPal订阅。知道SubscriptionId任何人都可以给我一些代码示例如何做到这一点?
目前我手动做这是一个痛苦(我登录到我的PayPal帐户,找到订阅并取消它)。
我想基本上自动化这个过程。
本页内容:Handling Recurring Payments你如何通过api取消PayPal订阅?
它表示可以使用API取消PayPal订阅。知道SubscriptionId任何人都可以给我一些代码示例如何做到这一点?
目前我手动做这是一个痛苦(我登录到我的PayPal帐户,找到订阅并取消它)。
我想基本上自动化这个过程。
这通常取决于订阅的类型。如果它以S-开头,则不能通过API进行修改。如果它以I开头,它可以。
看看这个ManageRecurringPaymentsProfileStatus API。
这允许您发送ACTION =取消,ACTION =挂起或ACTION =重新激活。
*使用PayPals ManageRecurringPaymentsProfileStatus API取消新的I- *订阅。 *通过使用PhantomJS +此脚本取消旧的S- *订阅: http://blog.degree.no/2015/10/cancelling-old-s-paypal-subscriptions-from-code/ –
在Perl中它可能是这样的:
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
# Set values for $paypal_api_user, $paypal_api_pwd and
# $paypal_api_signature from your paypal's profile
my $paypal_api_user = '....';
my $paypal_api_pwd = '.....';
my $paypal_api_signature = '.....';
# Set subscription id
my $subscr_id = '....';
my $params = {
'USER' => $paypal_api_user,
'PWD' => $paypal_api_pwd,
'SIGNATURE' => $paypal_api_signature,
'VERSION' => '84.0',
'METHOD' => 'ManageRecurringPaymentsProfileStatus',
'PROFILEID' => $subscr_id,
'ACTION' => 'Cancel',
};
my $ua = LWP::UserAgent->new();
my $res = $ua->post('https://api-3t.paypal.com/nvp', $params);
if ($res->is_error()) {
# HTTP error
} else {
# Success
}
你有写任何代码?如果是这样,你应该在这里发布,并且遇到了什么错误信息/问题。 –
我没有收到任何错误。我只是看不出有可能做到这一点。 – Anthony