- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I'm using the V2 REST API (with the PayPalCheckoutSdk) to capture an authorization for an order created with the PayPal Smart Payment Buttons.
The problem I'm facing, is that after I capture the authorized Order, I need a way to get the TransactionID so that I can include it in our customer's receipt and record it in our DB. Currently /v2/checkout/orders/{order_id} does NOT return the same TransactionID that can be seen from a client's purchase history in the PayPal sandbox. I have looked through the entire data structure returned from an OrdersGetRequest and cannot find this TransactionId.
I found some relevant documentation that says I should be able to find this transactionId on the purchase_unit data structure for this order:
The documentation suggests I need to call /v2/checkout/orders/{order_id}/save to generate this id, but when I attempt this, I get an error stating that the order cannot be saved, and that I need to set the intent to authorize and set processing_instruction to ORDER_SAVED_EXPLICITLY.
Does anyone have any insights on how I can properly use the V2 REST API to create Orders and retrieve transaction ids that match the transaction ids that customers will see?
Solved! Go to Solution.
- Labels:
-
Payments REST APIs
-
Payouts Rest APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Kardmagic reply:
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
console.log(JSON.stringify(details.purchase_units[0].payments.captures[0].id));
var transid = JSON.stringify(details.purchase_units[0].payments.captures[0].id)
});
},
this is actually the correct answer!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a unique capture / sale id yes, but not the transaction-id the buyer sees when he logs into his paypal account.
As the thread starter said, this buyer transaction-id cannot be found anywhere. I am facing the same issue at integrating and for future customer support he will ask "my transactioncode is '1245ABCD" and we cannot do anything with this in support.
Problem
Further the "invoice-id" is identical for the transaction which can have multiple captures!
The buyer can search by this invoice-id and will find multiple "transactoins / captures". Here a screenshot from the sandbox buyer account and those two captures belong to one single payment-id. Its actually a guessing game which "capture-id" is which byuer "transaction".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I ended up with a "solution" based on this post. What I needed is a way for a user of my application to easily visit paypal and see their transaction from the source. It's not ideal, but it does seem to work. Here is the string format template that I am using, make note of the `searchKeyword={0}` which gets replaced with the merchant transaction id when string.Format gets called (below):
```
https://www.paypal.com/activities/?fromDate=2000-01-01&toDate=3000-01-01&searchType=ANY&searchKeyword={0}&transactiontype=ALL_TRANSACTIONS&archive=INCLUDE_ARCHIVED_TRANSACTIONS&amount_lower=0&amount_upper=0¤cy_value=ALL_TRANSACTIONS_CURRENCY¤cy_label=ALL_TRANSACTIONS_CURRENCY
```
I then call string.Format(template, Capture.Id) where Capture.Id is the capture id of the merchant transaction (what gets returned in the `details.purchase_units[0].payments.captures[0].id` on the OnApprove event).
The transaction does not list anywhere in the actual details, but it gets the user to more details of their purchase, which is what I am aiming for here.
There is a security concern, of course, that my merchant transaction ID is being leaked to the payer, but small price for functionality and having to deal with PayPal's overwhelming dysfunction with this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have been spending the morning on this overly confusing issue and in my case calling `details.purchase_units[0].payments.captures[0].id` returns the payment information for the merchant, not the payer. I would like to display the payer's transaction ID so that they can launch a direct browser request from my application and view the transaction details in PayPal.
The lack of "support" on this forum is most disturbing. Especially when PayPal has raised its fees. It is clearly not going towards improving its products, services and said "support." It's very disappointing to have to browse pages and pages of posts like this where PayPal appears to be non-existent, aloof, apathetic, or worse.
This is why everyone is moving to Stripe/Square/etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Has this been fixed? We also need the transaction ID. We call the capture orders rest API, but the payment/capture id is not the transaction id. We are able to get this transaction id with PayPal Pro and PayPal Standard, but not this???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am passing my invoice id in `invoice_id` and `reference_id` fields calling /orders. but on the transaction details in the paypal UI it cant be found. How would I reconcile PP transaction with my internal order? I dont want to send PATCH. this should be available from get go..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It should be noted that PayPal assigns a different Transaction ID to the buyer and seller for the same transaction.
No idea why as this just causes more confusion for both parties.
More details: https://www.paypal.com/gp/smarthelp/article/why-are-there-different-buyer-and-seller-transaction-ids...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having this same issue that I would like to track the transaction id so that when a customer calls for support, we are able to look up by transaction id in our support database. Has there been a fix by PayPal on this or are people still creating their own id that they PATCH on the order?

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- PHP SDK error: broken content-length header in SDKs
- Some negative testing value only reply 403 Forbidden in Sandbox Environment
- If I don't capture within the 3 hour limit, how can I be sure that the payment went through? in REST APIs
- PayPal integration with Next, Lambda and API Gateway - 400 Invalid Request in Sandbox Environment
- paypal angular sandbox, receiving not approved order ,when Capture even OnApprove is triggered in Sandbox Environment