Paypal - Get the order identifier out of transaction identifier - paypal

I could not find info in the documentation on how to grab an order id out of the capture id that I receive from the daily transaction detail report. The only way I found was to check the links field in the capture after the capture gets the request, however, that does not seem like the best way to do it.
Does anyone know how to achieve it directly?

If you are using the Orders V2 API, the Order ID is only used during checkout approval. It is not persisted after transaction creation, and looking up captured payment details with the transaction/capture id: https://developer.paypal.com/docs/api/payments/v2/#captures_get , will not return the Order ID used during checkout, since it is not useful for anything at that point.

Related

GET transaction information from a specific PayPal transaction using Webhooks and PayPal API in Zapier

UPDATE: After troubleshooting on postman, I've found that start_date and end_date are nessesary fields. Everything now works fine on postman with 200 code. However I am still getting a 400 error on zapier...
I've managed to POST my API credentials and generate an access-token from the previous step in my zap sequence using a Webhook. I then used this token in a GET Webhook in the next step to try and retrieve transaction information (PayPal processing fee, etc...) using transaction_id and fields queries. The transaction ID I am using is being pulled from an actual Woocommerce order on our store, where the customer decided to use PayPal (I've also searched the ID in paypal and it is valid).
The reason I'm doing this is to try and pull extra information from PayPal- Such as payment processing fees about the transaction that Woocommerce does not provide through their app on Zapier.
Unfortunately I am seeing the following error 'The app returned "Invalid request - see details."'
I suspect it is because I am calling for the information incorrectly. In my mind, I am using transaction_id as the unique identifier for the specific transaction, and fields to retrieve all information regarding the transaction.
Error code in Zapier: "Status Code 400 Bad Request" - PayPal docs state: "INVALID_REQUEST. Request is not well-formed, syntactically incorrect, or violates schema"
Update: If you use this method to pull transaction information, you will need to set a delay long enough where the activity time on your paypal dashboard switches from a time to a date (meaning it is the next day). If you don't do this, no important information will be pulled.
I've figured it out. If anyone has a similar issue, set it up like this (probably use more dynamic dates though):

Getting country data from PayPal transaction export, or API

The "country" field in the PayPal transaction history CSV exports is almost always empty. However, PayPal must know the country where a transaction originates, and in fact tools such as Putler can display the country for nearly all transactions.
I wish to obtain this data myself, but since the export doesn't appear to have it, should I obtain it by using the API? And which of the APIs wold be appropriate to use for this purpose?
Thanks in advance.
Yes you can probably do this using the API. First you'll need to search your account's transaction history. After that you'll get a list of transaction ID's, you can then retrieve information about a specific ID which includes the country code of the buyer.
You can see more details here: https://developer.paypal.com/docs/classic/express-checkout/ht_searchRetrieveTransactionData-curl-etc/

Payments Callback URL not being call after new local currency changes

After switching to the new Facebook local currency API the process is working, but
my server is not involve in the process so i really don't know if the user bought coins cause the payment callback URL is not being called now (using static payment).
I tried to use real time update to get Facebook data but can make it work, what is the best practice to involve the server in the process so it will be aware of the purchase?
I prefer for security reasons to get the update from Facebook and not from my client.
Ok after searching a log i found the solution
There are two primary methods through which you are notified of the outcome of the purchase, and a further method by which you can verify any payment information.
Firstly, Facebook will return details of the order via a JavaScript callback. The data sent to this callback includes:
payment_id, which uniquely identifies the transaction.
quantity, which indicates the amount of the item which was sold.
request_id, optionally, the developer can provide their own unique identification for the transaction when calling our Javascript SDK to render the payment dialog. This value is then returned upon purchase completion.
status, which indicates the current state of the transaction, i.e. 'pending', 'completed', 'failed' etc.
Secondly, Facebook will issue a realtime update notifying the developer that a new order has completed. The developer can subscribe to the payment_object callback to track order completions, using the payment_id as the unique identity parameter for each transaction.
Thirdly, at any time, the payment_id can be used to verify details of a transaction via the Graph API. Details such as the associated user_id, updated_time and amount can be queried, using the payment_id. The Graph API will also allow you to access further details including any refunds or disputes associated with the transaction.
If for some reason both the JavaScript callback and the realtime update fail and you do not receive the payment_id, we also allow you to query the Graph API using the optional request_id parameter, which can be specified by the developer when invoking the Facebook payment dialog.
please refer to:
https://developers.facebook.com/docs/concepts/payments/
and to:
https://developers.facebook.com/docs/howtos/payments/fulfillment/#rtu

facebook chargeback refund details

we are dealing with heavy chargebacks and refunds. But I am unable to identify how can I get the details of chargebacks and refunds. We have published our game through third party so they own the Company Account for transactions. We have asked them, but apparently they don't have anything to help us out. I have used Graph API to log the transaction details and I have also used the debug tool to find out the reason or details of chargebacks and refunds. but even our refunds does not have any reason attached with it. Please help me out of this. I have done alot of Google on this but i am unable to find out what I need to know
Regards.
All you will actually get is a “Refund Reason Code” – which of these there are, and how to access them, is described here:
https://developers.facebook.com/docs/payments/disputes/#refundcb_tracking
Edit:
It does not look like you can look up the refund reason code via the API – but Facebook will send it to you, via a ping to your callback URL:
“If the order has been refunded by Facebook, we will ping your callback with a payments_status_update for the order in questions with a status of refunded. In addition, there will be an additional field returned called refund_reason_code with one of the following values: […]”
So you will have to react to that and evaluate the refund reason code (save it to your database, …) in this callback.

Facebook Credits API: refunding creates a new order id?

When I refund a specific order ID using the updateOrder() API, it correctly updates this order's status to 'refunded' as expected but also creates an entirely new order id also with a status of 'refunded'. This makes it look like a user has been refunded twice as much as they spent ... anyone know why this is? Or if it's documented anywhere in Facebook's amazing API docs?