我在使用沙箱凭据进行PayPal付款时使用下面的回复做出回应。
{
"client": {
"environment": "sandbox",
"paypal_sdk_version": "2.14.6",
"platform": "Android",
"product_name": "PayPal-Android-SDK"
},
"response": {
"create_time": "2017-01-31T08:12:40Z",
"id": "PAY-*************",
"intent": "sale",
"state": "created"
},
"response_type": "payment"
}
然后我尝试通过支付ID使用rest API调用获取完整详细信息并获取" DEAD"说明付款响应。请查看以下回复
{
"id": "PAY-*************",
"create_time": "2017-01-31T08:12:40Z",
"update_time": "2017-01-31T08:13:22Z",
"state": "DEAD",
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"type": "visa",
"number": "xxxxxxxxxxxx1111",
"expire_month": "11",
"expire_year": "2025"
}
}
]
},
"transactions": [
{
"amount": {
"total": "2.00",
"currency": "USD",
"details": {
"subtotal": "2.00"
}
},
"description": "New Product",
"related_resources": []
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-*************",
"rel": "self",
"method": "GET"
}
]
}
任何人都可以帮助我理解为什么我会这样做?如何解决这个问题?
答案 0 :(得分:3)
最后我得到了解决方案。在这里回答有点迟,但这个答案可以为那些仍在努力的人节省时间。
创建付款后,Android SDK会返回以下JSON,但我们可以看到其状态尚未获得批准。如果我们使用付款查询API(https://api.sandbox.paypal.com/v1/payments/payment/PAY-*************
)来验证付款,我们将获得DEAD状态,并且不会有任何交易ID。
{
"client": {
"environment": "sandbox",
"paypal_sdk_version": "2.14.6",
"platform": "Android",
"product_name": "PayPal-Android-SDK"
},
"response": {
"create_time": "2017-01-31T08:12:40Z",
"id": "PAY-*************",
"intent": "sale",
"state": "created"
},
"response_type": "payment"
}
适用于我的解决方案
问题是我在沙盒中创建了一个商家帐户,但我必须在沙箱中创建一个 Business-Pro 帐户。完成此操作后,我获得了批准状态,当我使用付款查询API时,我会获得所需的所有详细信息。