我正在尝试使用PayPal REST API和PayPal Sandbox上的Java的paypal-rest-api-sdk设置结算协议。所以,到目前为止,我已经能够创建一个结算方案并传递它的ID来创建一个结算协议。但是,我在创建结算协议后得到的回复没有approval_url和redirect_url。以下是我的要求
{
"name": "MYOP Recurring Contribution Agreement",
"description": "Agreement for MYOP Recurring Contributions",
"start_date": "2014-12-13T06:26:32Z",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"number": "XXXXXXXXXXXX",
"type": "visa",
"expire_month": 1,
"expire_year": 2015,
"cvv2": 874,
"first_name": "Joe",
"last_name": "Young",
"billing_address": {
"line1": "52 N Main ST",
"city": "Johnstown",
"country_code": "US",
"postal_code": "43210",
"state": "OH"
}
}
}
]
},
"plan": {
"id": "P-85A16162MC374104FU7KAYMQ"
}
}
作为对我的创建结算协议请求的回复,我只收到以下内容:
{
"id": "I-77GK9WNNV04U",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-77GK9WNNV04U",
"rel": "self",
"method": "GET"
}
]
}
当我使用协议ID上的GET请求获取创建的结算协议时,我会收到有关协议的信息,该协议具有不包含approval_url或redirect_url的“链接”数组。
我无法继续将付款人发送到批准网址,然后执行协议。请帮助。
答案 0 :(得分:2)
您正在使用(“payment_method”:“credit_card”)更改(“Payment_method”:“PAYPAL”)
'{
"name": "T-Shirt of the Month Club Plan",
"description": "Template creation.",
"start_date": "2016-03-31T00:37:04Z",
"plan": {
"id":"'.$plan_id.'"
},
"payer": {
"payment_method": "PAYPAL"
},
"shipping_address": {
"line1": "111 First Street",
"city": "Saratoga",
"state": "CA",
"postal_code": "95070",
"country_code": "US"
}
}';
Thanks
答案 1 :(得分:1)
批准和重定向网址仅适用于您进行PayPal付款,以便买方可以登录其PayPal帐户并批准该交易。
由于您在信用卡上签订了结算协议,因此将立即创建定期配置文件,无需通过任何重定向网址。