PaymentId 和 TRANSACTIONID 之间的区别 [英] Difference between paymentId and TRANSACTIONID

查看:36
本文介绍了PaymentId 和 TRANSACTIONID 之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从 REST 转向经典 API(而且我对两者都是新手).作为开发人员,我想记录付款的唯一标识符,以便将网站上的销售额与 Paypal 付款 ID 相关联,例如我想退款.

I am moving from REST to classic API (and I'm new to both). As a developer, I want to record unique identifier of the payment to relate sales in site to Paypal payment IDs, such as in case I want to do refunds.

REST API 用于给我付款 ID 在返回 URL 中,而经典 API 在响应中为我提供事务 ID.

The REST API used to give me payment IDs in the return URL while classic API gives me transaction IDs in the response.

有什么区别?或者它们是同一资源的别名?存储 PAYMENTINFO_0_TRANSACTIONID 是否足以查找付款?

What is the difference? Or are they aliases to same resource? Is storing the PAYMENTINFO_0_TRANSACTIONID sufficient to lookup the payment?

两者的例子:

paymentId PAY-0CN62912EY171514DKSECBXA
PAYMENTINFO_0_TRANSACTIONID 4KY08572SD6526629

商家的 Web 界面显示交易 ID,从不显示付款 ID:

Web interface for merchant shows transaction IDs, never payment IDs:

PayPal Express Checkout Payment Received (Unique Transaction ID 4KY08572SD6526629)

推荐答案

交易 ID 是 PayPal 交易完成后的标识符,无论它来自哪个 API(经典 API、REST API、自适应支付 API 等).当且仅当交易完成时才会发出.

Transaction ID is the identifier of PayPal transactions once it is completed, regardless of which API it comes from (Classic API, REST API, Adaptive Payment API etc). It will be issued if and only if the transaction has been completed.

相比之下,付款 ID 是 REST API 中的付款标识符,不一定表示付款已完成.例如,假设您使用 REST API 通过/v1/payments/payment 端点进行 PayPal 支付:

In contrast, Payment ID is identifier of payment in REST API which does not necessarily indicates a completed payment. For example, let say you use REST API for PayPal payment with /v1/payments/payment endpoint:

POST/v1/payments/payment

POST /v1/payments/payment

{
  "intent":"sale",
  "redirect_urls":{
    "return_url":"http://ashrafishak.com",
    "cancel_url":"http://google.com"
  },
  "payer":{
    "payment_method":"paypal"
  },
  "transactions":[
    {
      "amount":{
        "total":"7.47",
        "currency":"USD"
      },
      "description":"This is the payment transaction description."
    }
  ]
}

您将从上述请求中收到付款 ID,但由于尚未发布交易 ID,因此尚未完成.您需要使用/v1/payments/payment//execute 端点执行交易才能完成.

You will receive Payment ID from the above request, but it is not completed yet since transaction ID is not issued. You need to execute the transaction using /v1/payments/payment//execute endpoint for it to be completed.

在您的情况下,由于您想跟踪交易以备将来退款,我认为仅存储交易 ID 就足够了.

In your case, since you want to keep track of transaction for future refund, I think it is sufficient to just store Transaction ID.

这篇关于PaymentId 和 TRANSACTIONID 之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆