How to identify order is COD or not using admin graphql api of get order

I am using admin graphql api for fetch order details from shopify and I want to know how can I know that order is Cash on delivery or not? is there any flag? using that i can check or is there any different API? because right now I am getting paymentGatewayNames but using this I can’t check because any merchant can set different name for cash on delivery so, let me know is there another way I can check this?

1 Like

Hi @Ketan_Modi

There isn’t a dedicated “isCOD” boolean flag on the Order object, but you can reliably identify COD orders by looking at the order’s transactions rather than paymentGatewayNames.

The key field is manualPaymentGateway on the OrderTransaction object. In Shopify, Cash on Delivery is a manual payment method, so this will return true for COD orders. Combined with the gateway field (which returns the internal gateway identifier, not the merchant-customized display name), you can identify COD orders more reliably.

Here’s a query to get the payment details you need:

query OrderPaymentDetails($id: ID!) {
  order(id: $id) {
    id
    name
    paymentGatewayNames
    displayFinancialStatus
    transactions {
      gateway
      formattedGateway
      manualPaymentGateway
      kind
      status
    }
  }
}

How to use this:

  • manualPaymentGateway — returns true if the transaction was processed through a manual payment gateway (which COD is)
  • gateway — the internal gateway name (more stable than the display name in paymentGatewayNames)
  • formattedGateway — the human-readable name (this is the one merchants can customize)

For your logic, check if manualPaymentGateway is true and the gateway value matches the COD gateway. For the built-in Shopify COD payment method, the gateway value is typically "Cash on Delivery (COD)", but since merchants could have other manual payment methods too (like Bank Deposit or Money Order), you’ll want to check the gateway string to distinguish between them.

You’ll also notice displayFinancialStatus will typically be PENDING for COD orders since payment hasn’t been collected yet — that can be a useful secondary signal.

Docs reference: OrderTransaction object

Hey Ketan, yeah paymentGatewayNames is unreliable for exactly the reason you mentioned, merchants can rename their manual payment methods to whatever they want so string matching breaks across stores.

The field you actually want is manualPaymentGateway on the OrderTransaction object. It’s a boolean that returns true when the transaction was processed through any manual payment gateway, which includes Cash on Delivery. Instead of checking names, you query the order’s transactions and look for that flag. Something like:

{
  order(id: "gid://shopify/Order/YOUR_ORDER_ID") {
    transactions {
      gateway
      formattedGateway
      manualPaymentGateway
      kind
    }
  }
}

If manualPaymentGateway comes back true and the kind is SALE or AUTHORIZATION, you know the order was placed with a manual payment method. COD is one of those, along with things like bank deposits or money orders. If you need to distinguish COD specifically from other manual methods, combining manualPaymentGateway: true with the gateway field value gives you the internal handle which is more stable than the display name ( OrderTransaction - GraphQL Admin ). I’ve worked with enough Shopify environments through Stacksync to know that relying on display names for payment method detection is one of those things that works in dev and then breaks the moment you onboard a second merchant.

One thing to watch out for: if the store uses a third party COD app rather than Shopify’s built in manual payment, the transaction might not flag as manualPaymentGateway: true because those apps sometimes process through their own gateway. In that case you’d fall back to checking the gateway string, but at least for native Shopify COD the boolean is the reliable path. Hope this helps.