我正在与paypal进行整合。我正在使用Java的REST API。目前,我有待付款问题。当我查找付款(https://api.paypal.com/v1/payments/payment/ {paymentId})到沙箱环境以检查付款状态时,回复是不同的。 当我批准支付作为卖方付款的状态为paypal REST API交易批准
批准
和销售是在状态
完成
例如响应: { "id": "PAY-5YK922393D847794YKER7MUI", "create_time": "2013-02-19T22:01:53Z", "update_time": "2013-02-19T22:01:55Z", "state": "approved", "intent": "sale", "payer": { "payment_method": "credit_card", "funding_instruments": [ { "credit_card": { "type": "mastercard", "number": "xxxxxxxxxxxx5559", "expire_month": "2", "expire_year": "2018", "first_name": "Betsy", "last_name": "Buyer" } } ] }, "transactions": [ { "amount": { "total": "7.47", "currency": "USD", "details": { "subtotal": "7.47" } }, "description": "This is the payment transaction description.", "related_resources": [ { "sale": { "id": "36C38912MN9658832", "create_time": "2013-02-19T22:01:53Z", "update_time": "2013-02-19T22:01:55Z", "state": "completed", "amount": { "total": "7.47", "currency": "USD" }, "parent_payment": "PAY-5YK922393D847794YKER7MUI", "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/sale/36C38912MN9658832", "rel": "self", "method": "GET" }, { "href": "https://api.sandbox.paypal.com/v1/payments/sale/36C38912MN9658832/refund", "rel": "refund", "method": "POST" }, { "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI", "rel": "parent_payment", "method": "GET" } ] } } ] } ], "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI", "rel": "self", "method": "GET" } ] }
一d有时付款
未决
和
的销售情况完成 例如respose:
{ "id": "PAY-5YK922393D847794YKER7MUI", "create_time": "2013-02-19T22:01:53Z", "update_time": "2013-02-19T22:01:55Z", "state": "pending", "intent": "sale", "payer": { "payment_method": "credit_card", "funding_instruments": [ { "credit_card": { "type": "mastercard", "number": "xxxxxxxxxxxx5559", "expire_month": "2", "expire_year": "2018", "first_name": "Betsy", "last_name": "Buyer" } } ] }, "transactions": [ { "amount": { "total": "7.47", "currency": "USD", "details": { "subtotal": "7.47" } }, "description": "This is the payment transaction description.", "related_resources": [ { "sale": { "id": "36C38912MN9658832", "create_time": "2013-02-19T22:01:53Z", "update_time": "2013-02-19T22:01:55Z", "state": "completed", "amount": { "total": "7.47", "currency": "USD" }, "parent_payment": "PAY-5YK922393D847794YKER7MUI", "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/sale/36C38912MN9658832", "rel": "self", "method": "GET" }, { "href": "https://api.sandbox.paypal.com/v1/payments/sale/36C38912MN9658832/refund", "rel": "refund", "method": "POST" }, { "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI", "rel": "parent_payment", "method": "GET" } ] } } ] } ], "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI", "rel": "self", "method": "GET" } ] }
同样的SANbox当我拒绝交易工作。一旦付款状态失败并且销售状态反转,并且另一个时间待定并保留。
我的问题是什么时候可以100%确定交易完成或失败? 我应该检查付款状态还是销售状态? 也许这个问题只与sandbox不相关而与生产有关。
PS。这个代码只是样本,不要分析它。