6

我正在使用网站支付标准为订阅创建定期付款。

我需要找出下一个计费日期是什么时候,所以看起来我可以使用 GetRecurringPaymentsProfileDetails nvp api 和定期付款资料 ID。

但是,当我发送定期付款配置文件 ID 时,我收到了失败回复:

{'ack':'Failure',.... l_longmessage0: 'Subscription profiles not supported by Recurring Payment APIs.',
'l_shortmessage0': 'Subscription Profiles not supported.',....

这是否意味着无法通过 GetRecurringPaymentsProfilesDetails NVP api 检索订阅按钮的定期付款配置文件?

如果是这种情况,是否有其他 api 来获取订阅配置文件的详细信息?

4

3 回答 3

7

GetRecurringPaymentsProfileDetails 不支持通过支付标准创建的订阅配置文件,它仅支持通过 nvp api 创建的定期支付配置文件。

在撰写本文时,还没有获取订阅详细信息的 api。如果您想知道当前状态,您必须使用 IPN 侦听器自己捕获和跟踪所有状态更改。

于 2009-12-29T11:43:20.333 回答
2

您可以使用/v1/payments/billing-agreements/{billingid}/transactions?start_date=YYY-MM-DD$end_date=YYY-MM-DD... 劫持 API,然后您必须检查最后一笔交易是否适合您的时期。

于 2016-11-08T17:20:14.210 回答
0

我通过这种方式得到它:

let options = {
 method: 'post', headers: {'content-type':'application/json','Access-Control-Allow-Credentials':true},
 auth:{'username':process.env.PAYPALID,'password':process.env.PAYPALPASSWORD},
 url: 'https://api.paypal.com/v1/oauth2/token',
 data: 'grant_type=client_credentials',
}
axios(options).then((response)=>{let paypaltoken=response.data.access_token
axios.get('https://api.paypal.com/v1/payments/billing-agreements/'+agreementid+'/transactions?start_date=2018-01-01&end_date=2019-07-07', { headers: { 'Authorization':'Bearer '+paypaltoken, 'Content-Type':'application/json', } })
.then((transaction)=>{console.log(transaction.data)})
.catch(err => {console.error(err);console.log('err: '+JSON.stringify(err)); res.send (err) })
})
.catch(err => {console.error(err);console.log('err: '+JSON.stringify(err)); res.send (err) })

那么如果你只得到transaction.data,你会得到一系列的事务对象,只有当事务正常时才status== Completed,也就是说,它没有被取消,所以为了计划控制目的,只检查最后一个。什么时候status==Canceled您知道该协议不再有效。

如果您收到每月付款,另一种方法是将第一个日期设置为从“now()”开始的 2 个月,将第二个日期设置为“now()”。如果您没有交易,则状态可能不活跃,但请仔细检查:随机可能存在信用卡问题。在那种情况下,我想status可能是 == todelayed或其他东西,但我无法测试它,所以我不知道。这个想法来自这个问题和值得我感谢的相对第二个答案以及 Cyril ALFARO。

请注意,根据您的情况,您可能需要在请求中添加'Access-Control-Allow-Credentials':true标题而不是其他withCredentials: true或类似的。

于 2019-07-07T18:53:21.450 回答