gpt4 book ai didi

Paypal 快速结账 : how should I check if the transaction is done and money is transferred?

转载 作者:太空宇宙 更新时间:2023-11-03 16:05:02 24 4
gpt4 key购买 nike

我在客户端有 PayPal 快速结账,在使用支付 ID 触发回调后,我想在 NodeJS 端检查该 ID。我使用 JS SDK 调用 RESTfull API:

https://developer.paypal.com/docs/api/payments/v1/#payment_get

我在下面得到这样的对象。

state is approvedtransactions[0].related_resources[0].sale.state === pending

那么我应该如何检查交易是否完成并且钱是否转给卖家以激活他/她支付的服务?

从回调中,我有买家电子邮件、payerId、paymentID、paymentToken,所以也许我需要一些其他端点?

{
"id": "PAY-7SN4959762125513LLPOWTDA",
"intent": "sale",
"state": "approved",
"cart": "2A9434180T1061602",
"payer": {
"payment_method": "paypal",
"status": "VERIFIED",
"payer_info": {
"email": "pp-test@gmail.com",
"first_name": "Some",
"last_name": "Surname",
"payer_id": "E76V3DRUQZYZW",
"shipping_address": {
"recipient_name": "Some Surname"
},
"phone": "0455346902",
"country_code": "FR"
}
},
"transactions": [
{
"amount": {
"total": "27.96",
"currency": "EUR",
"details": {
"subtotal": "27.96"
}
},
"payee": {
"merchant_id": "FJ96CP2E7QWMY"
},
"description": "The payment for services.",
"custom": "ws-1XWCLNRbVdWavMVZgH2cSE",
"invoice_number": "in-1h7KSgdCh35Gdpi_Yk7PO_",
"item_list": {
"items": [],
"shipping_address": {
"recipient_name": "Some Surname"
}
},
"related_resources": [
{
"sale": {
"id": "7UB08136N5814360K",
"state": "pending",
"amount": {
"total": "27.96",
"currency": "EUR",
"details": {
"subtotal": "27.96"
}
},
"payment_mode": "INSTANT_TRANSFER",
"reason_code": "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION",
"protection_eligibility": "ELIGIBLE",
"protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE",
"parent_payment": "PAY-7SN4959762125513LLPOWTDA",
"create_time": "2018-11-03T09:25:53Z",
"update_time": "2018-11-03T09:25:53Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/sale/7UB08136N5814360K",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/sale/7UB08136N5814360K/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-7SN4959762125513LLPOWTDA",
"rel": "parent_payment",
"method": "GET"
}
]
}
}
]
}
],
"create_time": "2018-11-03T09:25:32Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-7SN4959762125513LLPOWTDA",
"rel": "self",
"method": "GET"
}
],
"httpStatusCode": 200
}

最佳答案

这就是我最终发现的:

The "approved" state just means the buyer logged into their account and approved the payment. You still need to execute the payment request, which once you do check the "state" shown in the "related_resources" section and it should say "completed", which indicates the transaction amount has been captured. The "id" shown below is the transaction identifier.

https://www.paypal-community.com/t5/REST-APIs/IPN-vs-actions-payment-execute-result/td-p/1564037

关于 Paypal 快速结账 : how should I check if the transaction is done and money is transferred?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53131959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com