How do I export the PayPal transaction ID from my Shopify order data?

Depending on the payment gateway, the amount of information available in the Order Transaction data could vary a lot.

For the PayPal gateway specifically, the transaction ID can be found under transactions > receipt > transaction_id subfield:

In EZ Exporter, you can use the formula below in the Calculated Fields to pull out the transaction_id from the transaction data and place it in a separate column in the CSV/Excel file:

",".join([i.receipt.transaction_id for i in load_json_data({{ transactions.successful_transactions }}) if i.kind != "refund"])

Note that this formula excludes refund transactions as the transaction_id field doesn't exist in the receipt data of refund transactions.  For refund transactions, it has a different refund_transaction_id field.

In case you would also like to export the refund transaction ID, you can use this separate formula that will export that data from refund transactions:

",".join([i.receipt.refund_transaction_id for i in load_json_data({{ transactions.successful_transactions }}) if i.kind == "refund"])

Related Articles:


App: EZ Exporter

Tags: advanced features, paypal, shopify order transactions, transaction id