How can I export the credit card transaction fee for the Shopify Payments gateway?

Depending on the payment gateway, the transaction fee may or may not be availabe in the Shopify order transaction data.  The data structure could vary as well depending on the payment gateway.

For the shopify_payments gateway, this data is available under transactions > fees subfield:

In EZ Exporter, you can use the formula below in the Calculated Fields to pull out the "amount" value of the transaction fees and sum them up:

get_total([f["amount"]["amount"] for t in load_json_data({{ transactions.successful_transactions }}) if t.get("fees") for f in t["fees"]])

Related Articles:


App: EZ Exporter

Tags: transaction fee, shopify payments, advanced features, shopify order transactions