Getting Credit Card Company via GraphQL

10 0 0


I'm querying an order via the GraphQL API. I can't find a way in the docs to retrieve the credit card company (e.g. "Visa") via GraphQL.

This is easy to get in the regular REST storefront API in the "payment_details" object.

I can see that you get transactions.paymentIcon.originalSrc which contains the company inside a url - for example  "https:\/\/\/s\/assets\/payment_icons\/visa-319d545c6fd255c9aad5eeaad21fd6f7f7b4fdbdb1a35ce83b89cca12a187f00.svg.png"


Do I really have to parse this url if I want to get the credit card company? There must be a better way...

Shopify Staff
Shopify Staff
644 78 141

This is an accepted solution.

Hey @ebroberg,


I found an easier way using paymentIcon that doesn't require parsing the URL. You can look at the altText field instead which returns just the credit card company in plain text (VISA, MASTERCARD, etc). Here's the query I used:


  orders (first:5) {
    edges {
      node {
        transactions (first: 5) {
          paymentIcon {


I'm also going to raise this with our developers to clarify whether there should be another way to get this info without having to look at the paymentIcon. I suggest using paymentIcon for now, and keep an eye on the changelog for any new fields that may be included in future API versions.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution