Goal: include a human-readable payment method on invoices generated from order-creation webhooks.
payment_gateway_names often returns only the gateway/provider (e.g., shopify_payments, bogus), while credit card orders can expose the brand via payment_details.credit_card_company (e.g., Mastercard).
For PayPal, payment_details is absent. Use gateway_name/payment_gateway_names and inspect order transactions (/admin/orders/{id}/transactions.json or order_transactions/create webhook) for gateway, status, and a gateway-specific receipt object.
Workaround used: map the first payment_gateway_names value to a known set (american_express, apple_pay, google_pay, sofort, maestro, master, paypal, visa); if no match, omit the “Paid with …” line.
Implementation guidance: prefer server-side handling via webhooks; avoid exposing API credentials in Liquid/checkout scripts. If needed on-storefront, consider the Liquid order object.
Limitation: some gateways (e.g., Razorpay) only return the gateway name in transactions, not the underlying funding source (e.g., Google Pay within Razorpay), so granular method detection may not be available.
No official, comprehensive list of possible payment methods was provided. Status: partially addressed with workarounds; detailed sub-method identification remains unresolved.
Summarized with AI on December 21.
AI used: gpt-5.
I wrote a webhook endpoint for order creation to generate invoices and send it to the customers.
Now I want to add information about the payment on the invoice. For example “Paid with PayPal/Google Pay/Apple Pay/Visa”, and so on. I just need the name.
I thought I could use the value “payment_gateway_names”, but it just returns the provider (e.g. shopify_payments and bogus).
When I do a test order via Shopify Payment with a Mastercard, I could use the “payment_details” → “credit_card_company” index:
Now I ask myself, how the structure would be with a non-creditcard payment. Is the field “credit_card_company” in this case present, too? If the field will return “PayPal” or “Google Pay” for example everything is fine.
I would test it myself, but sadly I didn’t find a method to create test orders with other payment methods without charging my bank account.
Also it would be nice if there is a list of all payment methods that could be returned.
If the order was processed in PayPal, there won’t be a payment_details field to reference. You’ll have gateway_name and payment_gateway_names on the order itself. For more information, you can look at the order’s transactions either with a followup request to /admin/orders/id/transactions.json or subscribing to an order_transactions/create webhook. The transaction will have information like the gateway, the payment status, a receipt object with more paypal specific information, etc.
Hey Chip, thank you for your response, are you using the order api via js to get the payment_gateway_names. Currently I am trying to get my data in the additional scripts for the checkout
page located in settings, and am just using liquid to get data(ie {{ customer.id }} ). But it looks like I could use the product id to get the order api object.
I’m just using the data passed via the order creation webhook. It’s passed by Shopify in the HTTP-Request to my app automatically, if a new order was created.
In my case, I’m not using the value in the Shopify shop itself. When the order is created, I create an invoice with the customers data and send it to the customer via email.
For this I created a new application, which is listening for the Shopify webhook. If the request arrives, I could do all the fancy stuff related to the invoice creation.
I couldn’t help you requesting the shopify API through the liquid templates, because I’ve never done it before.
This could also be a security issue, if you provide your API credentials in the HTML Code / Liquid template. So accessing the Shopify API should only be done on the server and not on the clients side.
I’m trying to build a analytics platform , here what I need is I need to get the payment method used I cannot find anyways to retrieve that I tried out it with RazorPay and when the payment is done using the google pay option within the shopify transactions payment details just hold the name Razor Pay , so is there any other way to find out the payment method used