Retrieve Enabled Payment Providers By API

Retrieve Enabled Payment Providers By API

FabioP
Tourist
7 0 1

hi

 

i'm in need of an api or workaround to fetch the payment provider id for a store

 

i'm developing an app that basically bulk import a list of order, and i need the payment provider gateway id in order to complete the order, for now my usecase is only for COD / manual payments

 

i'm using the  draftOrderComplete graphql endpoint

how are we supposed to fetch the paymentGatewayId for that endpoint? it is supposed to be like:

gid://shopify/PaymentGateway/11xxxxxx
 
Thank you in advance
Replies 4 (4)

Liam
Shopify Staff
2873 312 821

Hi FabioP,

 

As of now, Shopify does not provide an API endpoint that directly exposes the payment provider's gateway ID. The paymentGatewayId you mentioned (gid://shopify/PaymentGateway/11xxxxxx) is a global ID that is generated by Shopify and isn't available through any public API endpoints.

 

However, you can use a workaround to accomplish your goal. When you create a new order through the GraphQL API, you don't need to specify a paymentGatewayId for Cash on Delivery (COD) or manual payments. Instead, you can set the financialStatus field to paid or pending depending on whether you want to mark the order as paid or unpaid.

 

After creating the draft order, you can complete it without specifying paymentGatewayId:

mutation {
  draftOrderComplete(id: "gid://shopify/DraftOrder/1", paymentPending: false) {
    draftOrder {
      id
    }
    userErrors {
      field
      message
    }
  }
}

In this example, replace "gid://shopify/ProductVariant/1" and "gid://shopify/DraftOrder/" with the actual IDs of your product variant and draft order. Set paymentPending to true if you want to mark the order as unpaid (COD), or false if you want to mark it as paid.

 

Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

FabioP
Tourist
7 0 1

Hello Liam, thank you for your response

 

i tried as you said, this is the result of the order created:

FabioP_0-1698765646879.png

 

whereas this is an order created specified the COD payment gateway:

 

FabioP_1-1698765719602.png

 

so they look equivalent except one is marked as "manual" and the other as "COD", i am afraid that down the line this little but subtle difference could cause trouble to the merchant, could you confirm me that both orders are legit, from a logistic/merchant/client perspective, in other words no loss of money from any side can occur from this difference (manual vs COD gateway), as i said i'm afraid of the implications of being unable to set it explictly as COD

 

Thank you very much

FabioP
Tourist
7 0 1

i consulted about this with the merchant shipping manager, and she said that order created with the manual gateway are not handled correctly as COD orders by their software (https://www.qapla.it/)

is there really any other way to access the cod gateway ID? i can see there is an internal graphql api already (used by the UI), this feature would be critical for my application

Thanks in advance

sergiop
Shopify Partner
1 0 1

Hey, did you ever figure this out? I'm running into a similar issue.