Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between paymentId and TRANSACTIONID

Tags:

paypal

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.

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

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


Examples of both:

paymentId PAY-0CN62912EY171514DKSECBXA
PAYMENTINFO_0_TRANSACTIONID 4KY08572SD6526629

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

PayPal Express Checkout Payment Received (Unique Transaction ID 4KY08572SD6526629)
like image 823
Jesvin Jose Avatar asked Dec 20 '22 08:12

Jesvin Jose


2 Answers

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.

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

{
  "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."
    }
  ]
}

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.

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

like image 190
vandershraaf Avatar answered Feb 16 '23 16:02

vandershraaf


***Transaction ID is the identifier of PayPal transactions once it is completed,it will be issued if and only if the transaction has been completed. ***Payment ID is identifier of payment which doesn't necessarily indicates a completed payment.

like image 39
Mushthaq Ahamed Avatar answered Feb 16 '23 18:02

Mushthaq Ahamed