--- title: refundCreate - GraphQL Admin description: >- Creates a refund for an order, allowing you to process returns and issue payments back to customers. Use the `refundCreate` mutation to programmatically process refunds in scenarios where you need to return money to customers, such as when handling returns, processing chargebacks, or correcting order errors. The `refundCreate` mutation supports various refund scenarios: - Refunding line items with optional restocking - Refunding shipping costs - Refunding duties and import taxes - Refunding additional fees - Processing refunds through different payment methods - Issuing store credit refunds (when enabled) You can create both full and partial refunds, and optionally allow over-refunding in specific cases. After creating a refund, you can track its status and details through the order's [`refunds`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Order#field-Order.fields.refunds) field. The refund is associated with the order and can be used for reporting and reconciliation purposes. Learn more about [managing returns](https://shopify.dev/docs/apps/build/orders-fulfillment/returns-apps/build-return-management) and [refunding duties](https://shopify.dev/docs/apps/build/orders-fulfillment/returns-apps/view-and-refund-duties). > Note: > The refunding behavior of the `refundCreate` mutation is similar to the [`refundReturn`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/returnRefund) mutation. The key difference is that the `refundCreate` mutation lets you to specify restocking behavior for line items, whereas the `returnRefund` mutation focuses solely on handling the financial refund without any restocking input. > Caution: > As of 2026-01, this mutation supports an optional idempotency key using the `@idempotent` directive. > As of 2026-04, the idempotency key is required and must be provided using the `@idempotent` directive. > For more information, see the [idempotency documentation](https://shopify.dev/docs/api/usage/idempotent-requests). api_version: 2025-07 api_name: admin type: mutation api_type: graphql source_url: html: 'https://shopify.dev/docs/api/admin-graphql/2025-07/mutations/refundCreate' md: 'https://shopify.dev/docs/api/admin-graphql/2025-07/mutations/refundCreate.md' --- # refund​Create mutation Requires `orders` access scope, `marketplace_orders` access scope or `buyer_membership_orders` access scope. Creates a refund for an order, allowing you to process returns and issue payments back to customers. Use the `refundCreate` mutation to programmatically process refunds in scenarios where you need to return money to customers, such as when handling returns, processing chargebacks, or correcting order errors. The `refundCreate` mutation supports various refund scenarios: * Refunding line items with optional restocking * Refunding shipping costs * Refunding duties and import taxes * Refunding additional fees * Processing refunds through different payment methods * Issuing store credit refunds (when enabled) You can create both full and partial refunds, and optionally allow over-refunding in specific cases. After creating a refund, you can track its status and details through the order's [`refunds`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Order#field-Order.fields.refunds) field. The refund is associated with the order and can be used for reporting and reconciliation purposes. Learn more about [managing returns](https://shopify.dev/docs/apps/build/orders-fulfillment/returns-apps/build-return-management) and [refunding duties](https://shopify.dev/docs/apps/build/orders-fulfillment/returns-apps/view-and-refund-duties). *** **Note:** The refunding behavior of the \\refund\Create\\ mutation is similar to the \\\refund\Return\\\ mutation. The key difference is that the \\refund\Create\\ mutation lets you to specify restocking behavior for line items, whereas the \\return\Refund\\ mutation focuses solely on handling the financial refund without any restocking input. *** *** **Caution:** As of 2026-01, this mutation supports an optional idempotency key using the \@idempotent\ directive. As of 2026-04, the idempotency key is required and must be provided using the \@idempotent\ directive. For more information, see the \idempotency documentation\. *** ## Arguments * input [Refund​Input!](https://shopify.dev/docs/api/admin-graphql/2025-07/input-objects/RefundInput) required The input fields that are used in the mutation for creating a refund. *** ## Refund​Create​Payload returns * order [Order](https://shopify.dev/docs/api/admin-graphql/2025-07/objects/Order) The order associated with the created refund. * refund [Refund](https://shopify.dev/docs/api/admin-graphql/2025-07/objects/Refund) The created refund. * user​Errors [\[User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/2025-07/objects/UserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Create a refund that's issued as a store credit #### Description Create a refund that's issued as store credit instead of returning it to the original payment method. The store credit amount is specified in the \`refundMethods\` field and applies to a specific line item in the order. The mutation returns the refund ID, total refunded amount, and transaction details associated with the store credit. #### Query ```graphql mutation RefundToStoreCredit($input: RefundInput!) { refundCreate(input: $input) { userErrors { field message } refund { id totalRefundedSet { presentmentMoney { amount currencyCode } } transactions(first: 2) { edges { node { gateway kind amountSet { presentmentMoney { amount currencyCode } } } } } } order { id } } } ``` #### Variables ```json { "input": { "orderId": "gid://shopify/Order/1073459983", "refundLineItems": [ { "lineItemId": "gid://shopify/LineItem/1071823193", "quantity": 1 } ], "transactions": [], "refundMethods": [ { "storeCreditRefund": { "amount": { "amount": "10.00", "currencyCode": "USD" } } } ] } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-07/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation RefundToStoreCredit($input: RefundInput!) { refundCreate(input: $input) { userErrors { field message } refund { id totalRefundedSet { presentmentMoney { amount currencyCode } } transactions(first: 2) { edges { node { gateway kind amountSet { presentmentMoney { amount currencyCode } } } } } } order { id } } }", "variables": { "input": { "orderId": "gid://shopify/Order/1073459983", "refundLineItems": [ { "lineItemId": "gid://shopify/LineItem/1071823193", "quantity": 1 } ], "transactions": [], "refundMethods": [ { "storeCreditRefund": { "amount": { "amount": "10.00", "currencyCode": "USD" } } } ] } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation RefundToStoreCredit($input: RefundInput!) { refundCreate(input: $input) { userErrors { field message } refund { id totalRefundedSet { presentmentMoney { amount currencyCode } } transactions(first: 2) { edges { node { gateway kind amountSet { presentmentMoney { amount currencyCode } } } } } } order { id } } }`, { variables: { "input": { "orderId": "gid://shopify/Order/1073459983", "refundLineItems": [ { "lineItemId": "gid://shopify/LineItem/1071823193", "quantity": 1 } ], "transactions": [], "refundMethods": [ { "storeCreditRefund": { "amount": { "amount": "10.00", "currencyCode": "USD" } } } ] } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation RefundToStoreCredit($input: RefundInput!) { refundCreate(input: $input) { userErrors { field message } refund { id totalRefundedSet { presentmentMoney { amount currencyCode } } transactions(first: 2) { edges { node { gateway kind amountSet { presentmentMoney { amount currencyCode } } } } } } order { id } } } QUERY variables = { "input": { "orderId": "gid://shopify/Order/1073459983", "refundLineItems": [ { "lineItemId": "gid://shopify/LineItem/1071823193", "quantity": 1 } ], "transactions": [], "refundMethods": [ { "storeCreditRefund": { "amount": { "amount": "10.00", "currencyCode": "USD" } } } ] } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation RefundToStoreCredit($input: RefundInput!) { refundCreate(input: $input) { userErrors { field message } refund { id totalRefundedSet { presentmentMoney { amount currencyCode } } transactions(first: 2) { edges { node { gateway kind amountSet { presentmentMoney { amount currencyCode } } } } } } order { id } } }`, "variables": { "input": { "orderId": "gid://shopify/Order/1073459983", "refundLineItems": [ { "lineItemId": "gid://shopify/LineItem/1071823193", "quantity": 1 } ], "transactions": [], "refundMethods": [ { "storeCreditRefund": { "amount": { "amount": "10.00", "currencyCode": "USD" } } } ] } }, }, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'mutation RefundToStoreCredit($input: RefundInput!) { refundCreate(input: $input) { userErrors { field message } refund { id totalRefundedSet { presentmentMoney { amount currencyCode } } transactions(first: 2) { edges { node { gateway kind amountSet { presentmentMoney { amount currencyCode } } } } } } order { id } } }' \ --variables \ '{ "input": { "orderId": "gid://shopify/Order/1073459983", "refundLineItems": [ { "lineItemId": "gid://shopify/LineItem/1071823193", "quantity": 1 } ], "transactions": [], "refundMethods": [ { "storeCreditRefund": { "amount": { "amount": "10.00", "currencyCode": "USD" } } } ] } }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2025-07/graphql.json', { method: 'POST', body: JSON.stringify({ query: ` mutation RefundToStoreCredit($input: RefundInput!) { refundCreate(input: $input) { userErrors { field message } refund { id totalRefundedSet { presentmentMoney { amount currencyCode } } transactions(first: 2) { edges { node { gateway kind amountSet { presentmentMoney { amount currencyCode } } } } } } order { id } } } `, variables: { "input": { "orderId": "gid://shopify/Order/1073459983", "refundLineItems": [ { "lineItemId": "gid://shopify/LineItem/1071823193", "quantity": 1 } ], "transactions": [], "refundMethods": [ { "storeCreditRefund": { "amount": { "amount": "10.00", "currencyCode": "USD" } } } ] } }, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "refundCreate": { "userErrors": [], "refund": { "id": "gid://shopify/Refund/943333862", "totalRefundedSet": { "presentmentMoney": { "amount": "10.0", "currencyCode": "USD" } }, "transactions": { "edges": [ { "node": { "gateway": "shopify_store_credit", "kind": "REFUND", "amountSet": { "presentmentMoney": { "amount": "10.0", "currencyCode": "USD" } } } } ] } }, "order": { "id": "gid://shopify/Order/1073459983" } } } ``` * ### refundCreate reference