Processing a refund

To process a refund, Shopify makes an HTTP call to your app, and your app completes the refund by replying with a GraphQL mutation. This interaction is illustrated in the following diagram:

payment processing steps

  1. Merchant requests refund.
  2. Shopify sends a backend request to the payments app, specifying the refund.
  3. The app replies with a 201 and an empty response body.
  4. The app finalizes the refund using either RefundSessionResolve or RefundSessionReject mutations.
  5. Shopify updates the refund status.



To use the GraphQL mutations, your app must be aware of access scopes for payments apps.

Initiate the refund flow

The refund flow begins with an HTTP request sent from Shopify to the provider's refund session URL as provided during app extension configuration:

Request Body

Attribute Description Type
idRequired Unique identifier for the refund attempt. Used as the idempotency key. It can be assumed that requests with a given ID are identical to any previously-received requests with the same ID. String
gidRequired Identifies the refund when communicating with Shopify (in GraphQL mutations, for example). String
payment_idRequired ID of the original payment that is to be refunded. For captured payments, this ID corresponds to the original authorization ID rather than the capture ID. String
amountRequired The amount to be refunded. The amount is always sent using a decimal point as a separator, regardless of locale. Numeric
currencyRequired Three-letter ISO 4217 currency code. String
merchant_localeRequired IETF BCP 47 language tag representing the language used by the merchant. String
proposed_atRequired Timestamp representing when the refund request was proposed. String (ISO-8601)

Request headers

Header Description
Shopify-Shop-DomainRequired The permanent domain of the merchant's shop. Can be used to identify which shop is initiating the refund.
Shopify-Request-IdRequired The unique request ID used to track specific requests for troubleshooting purposes.
Shopify-Api-VersionRequired The API version selected in the payments app configuration. The version selected defines the response expected by the payments app.


Shopify must receive a HTTP 201 response for the refund session creation to be successful.

If the request fails, then it's retried several times. If the request still fails, then the merchant needs to manually retry the refund in the Shopify admin.

Resolve a Refund

After you've successfully processed the refund request, you can resolve it by using the RefundSessionResolve mutation:

The id argument corresponds to the gid of the refund.


View response

JSON response:

Reject a refund

If you cannot process a refund, then you should reject it. You should only reject a refund in the case of final and irrecoverable errors. Otherwise, you can re-attempt to process the refund.

You can reject a refund using the RefundSessionReject mutation:


As part of the rejection, you need to include a reason why the refund was rejected as part of RefundSessionRejectionReasonInput.

The RefundSessionRejectionReasonInput.code is a RefundSessionStatusReasonRejectionCode, which is an enum of standardized error codes.

The RefundSessionRejectionReasonInput.merchantMessage argument is a localized error message presented to the merchant explaining why the refund was rejected.

View response

JSON response:

Retry policy

If there's a Shopify service disruption (or if 5xx status codes are being returned), then requests must be retried. It is suggested to follow the guidelines in the retry policy section.

Additional information