How can I retrieve the credit card information that was used to place the order?

The Shopify API exposes the following information in the transaction data:

"payment_details": {
  "avs_result_code": "123456",
  "credit_card_bin": "M",
  "cvv_result_code": "M",
  "credit_card_number": "•••• •••• •••• 4242",
  "credit_card_company": "Visa"
}

In EZ Exporter, under Data Settings -> Calculated Fields, you can use this formula to pull a specific attribute of the payment details and place it in its own column. In the example below, we'll pull the credit_card_company data.

search_attributes({{ transactions }}, "success", search_key="status", result_key="payment_details.credit_card_company", return_all_results=True)

What the formula does is basically filter all the transaction records first for each order to only include successful transactions and then pull the value of the credit_card_company field. The transaction data may contain failed transactions so it's important to filter them first if we only care about the successful ones.

You can then repeat this formula for the other attributes by simply replacing the result_key="payment_details.credit_card_company" part of the formula with the field you want to retrieve.

EZ Exporter Shopify App - Export Credit Card Data using Calculated Fields


Related Articles:


App: EZ Exporter

Tags: advanced features, orders