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 > receipt > metadata > transaction_fee_total_amount
subfield.
One thing you'll notice as well is the value of the transaction_fee_total_amount
field is an integer in cents (actual amount multiplied by 100), so we'll need to divide this by 100.
In EZ Exporter, you can use the formula below in the Calculated Fields to pull out the transaction fee from the transaction data:
get_total([i.receipt.metadata for i in load_json_data({{ transactions.successful_transactions }})], "transaction_fee_total_amount") / 100
Related Articles:
App: EZ Exporter