【发布时间】:2015-02-01 13:33:15
【问题描述】:
我正在使用 Paypal REST api (java) 执行定期订阅。
流程如下所示,并且正在运行:
- 我制定了计划(好的)
- 我激活了一个计划(好的)
- 我创建了一个协议(好的)
- 我使用批准链接将用户重定向到 Paypal (ok)
- Paypal 将用户重定向回我的网站(好的)
- 我可以执行协议(ok)
我发现作为买家,我可以随时登录 paypal 并手动取消协议。
问题:
作为卖家,我可以看到买家 x 在“个人资料 > 定期付款仪表板”中取消了他的协议,但我如何使用代码查询此信息?假设我有协议 ID。协议对象内部没有提供此类信息。
请指出正确的方向。 谢谢
更新:
我的协议对象如下所示:
{
"id": "I-HLK83FVHB5X2",
"description": "item name goes here",
"start_date": "2014-12-04T05:00:00Z",
"plan": {
"payment_definitions": [
{
"type": "TRIAL",
"frequency_interval": "3",
"frequency": "Month",
"cycles": "1",
"amount": {
"currency": "CAD",
"value": "900.00"
},
"charge_models": [
{
"type": "TAX",
"amount": {
"currency": "CAD",
"value": "11.11"
}
},
{
"type": "SHIPPING",
"amount": {
"currency": "CAD",
"value": "0.00"
}
}
]
},
{
"type": "REGULAR",
"frequency_interval": "1",
"frequency": "Month",
"cycles": "0",
"amount": {
"currency": "CAD",
"value": "300.00"
},
"charge_models": [
{
"type": "TAX",
"amount": {
"currency": "CAD",
"value": "22.22"
}
},
{
"type": "SHIPPING",
"amount": {
"currency": "CAD",
"value": "0.00"
}
}
]
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "CAD",
"value": "0.00"
},
"max_fail_attempts": "0",
"auto_bill_amount": "YES"
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/suspend",
"rel": "suspend",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/re-activate",
"rel": "re_activate",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/cancel",
"rel": "cancel",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/bill-balance",
"rel": "self",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/set-balance",
"rel": "self",
"method": "POST"
}
]
}
【问题讨论】: