Hi,
I am looking for a way to gather some information about an order once this has been purchased. When the confirmation page is shown, some details about the order purchased by the customer are shown. I would like to find out the payment method that was used for this order purchase e.g. PayPal, ApplePay, Klarna.
I have tried a few suggestions from other people asking for the same thing, however unsuccessful. I have tried using the checkout as well as the transaction object, but the values returned are not what I was expecting:
-
Paying with ApplePay, would return ‘MasterCard’
-
transaction.gateway returns the same name when using different payment methods (using cyber-source for testing mode), but not when PayPal Express is used.
On further investigation, it was found out that requesting the tender_transactions.json from the admin would give all is needed:
{shopName}.myshopify.com/admin/tender_transactions.json
"tender_transactions": [
{
"id": 000000000000000,
"order_id": 0000000000000,
"amount": "39.99",
"currency": "GBP",
"user_id": null,
"test": true,
"processed_at": "2022-01-20T16:52:05+00:00",
"remote_reference": "XXXXXXXX",
"payment_details": {
"credit_card_number": "•••• •••• •••• 0000",
"credit_card_company": "Visa"
},
"payment_method": "paypal"
}
]
The field of interest is “payment_method”, which seems to return all is needed. The only issue with this is that the request won’t work from within the front-end source code as authentication is needed, thus a back-end service is needed to grab this and return it to the front end.
When looking into a real order, purchased with Apple Pay in the admin/orders, I can see in the Timeline:
‘A £X GBP payment was processed using a Visa ending in XXXX via Apple Pay.’
When clicking that, there is information on the order such as Gateway: CyberSource and an option to dive deeper by choosing ‘Information from the gateway’: Apple pay: true.
Can this be retrieved in some way from the order itself?
Is there another way this field of interest can be gathered without a back-end?
Is there something else that could provide the payment method used for a purchased order?