# refundOrder (https://developer.godaddy.com/en/docs/references/rest/orders/order/mutations/refundOrder)

***

title: refundOrder
description: "Refund an existing order. Only non-draft orders can be marked as refunded"
full: true
----------

mutation

Requires one of `commerce.order:create`, `commerce.order:update`, `commerce.order:cancel`, or `commerce.order:complete` (use the scope that matches the operation).

Refund an existing order. Only non-draft orders can be marked as refunded

## Required headers

| Header       | Required | Description                                                                                                                     |
| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `x-store-id` | Yes      | ID of the store the operation targets. Omitting it returns HTTP 200 with a GraphQL error: `extensions.code: "UNAUTHENTICATED"`. |

Go to [Authentication](https://developer.godaddy.com/docs/api-users/auth) for credential setup.

## Arguments

* `input` `RefundOrderInput!` **required**
  * `orderId` `ID!` **required** — Global ID in format `Order_\<KSUID\>`
  * `refundedAt` `DateTime` **optional**

## Possible returns

* `Order` `Order`

- `billing` `BillingInfo` **nullable** — Order level billing snapshot information
- `canceledAt` `DateTime` **nullable** — The datetime when the order was canceled
- `cartId` `String` **nullable** — ID associated with a cart. Used to link orders and carts for Inventory tracking purposes
- `completedAt` `DateTime` **nullable** — The datetime when the order was completed
- `context` `Context` **nullable** — Context for an order
- `createdAt` `DateTime` **nullable** — The datetime when the order was created in our system
- `customerId` `String` **nullable** — Reference to a Customer as defined by the Connections service
- `discounts` `[Discount!]` **nullable** — Discounts for an order
- `externalId` `String` **nullable** — External identifier for the order. If provided, it must be a unique identifier at a channel level
- `fees` `[Fee!]` **nullable** — Fees for an order
- `fulfilledAt` `DateTime` **nullable** — The datetime when the order was completely fulfilled
- `fulfillmentModes` `[String!]` **nullable** — Fulfillment modes for an order
- `history` `[OrderHistoryType!]` **nullable** — History for an order
- `id` `ID!` **non-null** — An identifier unique to the order node. Auto-generated by the service on the fly
- `inventoryAction` `InventoryAction` **nullable** — Controls inventory adjustment behavior for this order
- `lineItems` `[LineItem!]` **nullable** — Line items for an order
- `links` `[Links!]` **nullable** — A request-related [HATEOAS link](https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-02).
- `metafields` `[OrderMetafield!]` **nullable** — Metafields that allow clients to specify more information about the order. Attributes present in this object will not map across all channels
- `notes` `[Note!]` **nullable** — Notes for an order
- `number` `String` **nullable** — An identifier unique to the order. The `number` field can be used to map an existing order to an order in the Order Service. Null until the order is assigned a number (for example, DRAFT orders).
- `numberDisplay` `String` **nullable** — A human readable order number handed out to customers. Used for any communications with the customer (e.g. emails, SMS, or invoices). If not provided on creation, it will match the `number` attribute
- `paidAt` `DateTime` **nullable** — The datetime when the order was completely paid
- `processedAt` `DateTime` **nullable** — The datetime when the order was processed. If you are importing orders from an app or another platform, then you can set `processedAt` to a datetime in the past to match when the original order was created
- `refundedAt` `DateTime` **nullable** — The datetime when the order was completely refunded
- `returnTotals` `OrderReturnTotals` **nullable** — Grouped totals for an order return
- `shipping` `ShippingInfo` **nullable** — Order level shipping snapshot information
- `shippingLines` `[ShippingLine!]` **nullable** — Shipping lines for an order
- `staffUserIds` `[String!]` **nullable** — Staff users associated with the Order
- `statuses` `OrderStatuses` **nullable** — Current fulfillment status, payment status, and main status for the order
- `tags` `[String!]` **nullable** — Comma delimited string of tags for an order. A tag should be an attribute of the order that does not change
- `taxes` `[OrderTax!]` **nullable** — Taxes for an order
- `taxExempted` `Boolean` **nullable** — Details whether the order is tax exempt
- `totals` `OrderTotals` **nullable** — Grouped totals for an order
- `transactionIds` `[String!]` **nullable** — Transactions as defined by the Transaction Service associated with the Order
- `updatedAt` `DateTime` **nullable** — The datetime when the order was last updated in our system
- `deprecatedNote` `String` **nullable** deprecated — Merchant note for an Order Deprecated: Replaced by the notes array
