Refunding using the GraphQL API - what "gateway" to set ?

Highlighted
New Member
9 0 0

I am implementing refunding through the GraphQL API.

As part of the parameters, I have to specify a gateway.

I do not know what to put as parameter here. How can I get this through the GraphQL API?

 

According to the refund documentation, there seems to be a REST endpoint to call that gives parameters for the create refund call.

Is the solution to call the corresponding GraphQL equivalent, and if so, where is it?

 

Thanks,

0 Likes
Highlighted
Shopify Staff
Shopify Staff
644 78 141

Hey @Elrendio,

You can find the gateway by querying the orderTransaction connection on the order you're refunding. This base query should get you started, you can add additional fields for line_items, tax, discounts, etc and use this query to get order info before using the refundCreate mutation.

 

{
  order(id: "gid://shopify/Order/833980291") {
    id
    transactions(first: 5) {
      id
      kind
      gateway
      amountSet {
        shopMoney {
          amount
          currencyCode
        }
      }
    }
  }
}

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

0 Likes
Highlighted
New Member
9 0 0

Thank you.

I beleive we would benefit from documentation mentionning this in the OrderTransactionInput doc.

0 Likes
Highlighted
New Member
9 0 0

As a note for future users searching for this, the compute refund endpoint seems to also be accessible as suggestedRefund in the GraphQL API, as mentionned here.

0 Likes