validateRefundStep - Medusa Core Workflows Reference

This documentation provides a reference to the validateRefundStep. It belongs to the @medusajs/medusa/core-flows package.

This step validates that the refund is valid for the order

src/workflows/my-workflow.ts
1import { createWorkflow } from "@medusajs/framework/workflows-sdk"2import { validateRefundStep } from "@medusajs/medusa/core-flows"3
4const myWorkflow = createWorkflow(5  "my-workflow",6  () => {7    const data = validateRefundStep({8      "order": {9        "id": "id_ScT29ulv8OCuFN",10        "version": 31,11        "display_id": 24,12        "status": "draft",13        "currency_code": "{value}",14        "created_at": "2025-11-03T11:49:09.128Z",15        "updated_at": "2025-10-23T16:49:38.203Z",16        "original_item_total": {17          "numeric": 4318        },19        "original_item_subtotal": {20          "numeric": 4921        },22        "original_item_tax_total": {23          "numeric": 4724        },25        "item_total": {26          "numeric": 2127        },28        "item_subtotal": {29          "numeric": 4630        },31        "item_tax_total": {32          "numeric": 2333        },34        "original_total": {35          "numeric": 1936        },37        "original_subtotal": {38          "numeric": 1239        },40        "original_tax_total": {41          "numeric": 542        },43        "total": {44          "numeric": 945        },46        "subtotal": {47          "numeric": 048        },49        "tax_total": {50          "numeric": 2451        },52        "discount_subtotal": {53          "numeric": 4054        },55        "discount_total": {56          "numeric": 3257        },58        "discount_tax_total": {59          "numeric": 3760        },61        "gift_card_total": {62          "numeric": 3763        },64        "gift_card_tax_total": {65          "numeric": 166        },67        "shipping_total": {68          "numeric": 1369        },70        "shipping_subtotal": {71          "numeric": 472        },73        "shipping_tax_total": {74          "numeric": 175        },76        "original_shipping_total": {77          "numeric": 4178        },79        "original_shipping_subtotal": {80          "numeric": 2881        },82        "original_shipping_tax_total": {83          "numeric": 184        }85      },86      "payment": {87        "id": "id_wQ7DWNOU1Vhpofgzrs",88        "amount": {89          "numeric": 4990        },91        "currency_code": "{value}",92        "provider_id": "{value}",93        "payment_collection_id": "{value}"94      }95    })96  }97)

Input#

The order details.
idstring
The ID of the order.
versionnumber
The version of the order.
display_idnumber
The order's display ID.
The status of the order.
currency_codestring
The currency of the order
created_atstring | Date
When the order was created.
updated_atstring | Date
When the order was updated.
original_item_totalBigNumberValue
The original item total of the order.
original_item_subtotalBigNumberValue
The original item subtotal of the order.
original_item_tax_totalBigNumberValue
The original item tax total of the order.
item_totalBigNumberValue
The item total of the order.
item_subtotalBigNumberValue
The item subtotal of the order.
item_tax_totalBigNumberValue
The item tax total of the order.
original_totalBigNumberValue
The original total of the order.
original_subtotalBigNumberValue
The original subtotal of the order.
original_tax_totalBigNumberValue
The original tax total of the order.
The total of the order.
The subtotal of the order. (Excluding taxes)
The tax total of the order.
discount_subtotalBigNumberValue
The discount subtotal of the order.
discount_totalBigNumberValue
The discount total of the order.
discount_tax_totalBigNumberValue
The discount tax total of the order.
gift_card_totalBigNumberValue
The gift card total of the order.
gift_card_tax_totalBigNumberValue
The gift card tax total of the order.
shipping_totalBigNumberValue
The shipping total of the order.
shipping_subtotalBigNumberValue
The shipping subtotal of the order.
shipping_tax_totalBigNumberValue
The shipping tax total of the order.
original_shipping_totalBigNumberValue
The original shipping total of the order.
original_shipping_subtotalBigNumberValue
The original shipping subtotal of the order.
original_shipping_tax_totalBigNumberValue
The original shipping tax total of the order.
order_changeOrderChangeDTOOptional
The active order change, if any.
region_idstringOptional
The ID of the region the order belongs to.
customer_idstringOptional
The ID of the customer on the order.
sales_channel_idstringOptional
The ID of the sales channel the order belongs to.
emailstringOptional
The email of the order.
shipping_addressOrderAddressDTOOptional
The associated shipping address.
billing_addressOrderAddressDTOOptional
The associated billing address.
itemsOrderLineItemDTO[]Optional
The associated order details / line items.
shipping_methodsOrderShippingMethodDTO[]Optional
The associated shipping methods
transactionsOrderTransactionDTO[]Optional
The tramsactions associated with the order
credit_linesOrderCreditLineDTO[]Optional
The credit lines for an order
summaryOrderSummaryDTOOptional
The summary of the order totals.
metadatanull | Record<string, unknown>Optional
Holds custom data in key-value pairs.
canceled_atstring | DateOptional
When the order was canceled.
paymentPaymentDTO
idstring
The ID of the payment.
The payment's total amount.
currency_codestring
The ISO 3 character currency code of the payment.
provider_idstring
The ID of the associated payment provider.
payment_collection_idstring
The ID of the associated payment collection.
raw_amountBigNumberValueOptional
The raw amount of the payment.
authorized_amountBigNumberValueOptional
The authorized amount of the payment.
raw_authorized_amountBigNumberValueOptional
The raw authorized amount of the payment.
cart_idstringOptional
The ID of the associated cart.
order_idstringOptional
The ID of the associated order.
order_edit_idstringOptional
The ID of the associated order edit.
customer_idstringOptional
The ID of the associated customer.
dataRecord<string, unknown>Optional
The data relevant for the payment provider to process the payment.
created_atstring | DateOptional
When the payment was created.
updated_atstring | DateOptional
When the payment was updated.
captured_atstring | DateOptional
When the payment was captured.
canceled_atstring | DateOptional
When the payment was canceled.
captured_amountBigNumberValueOptional
The sum of the associated captures' amounts.
raw_captured_amountBigNumberValueOptional
The sum of the associated captures' raw amounts.
refunded_amountBigNumberValueOptional
The sum of the associated refunds' amounts.
raw_refunded_amountBigNumberValueOptional
The sum of the associated refunds' raw amounts.
capturesCaptureDTO[]Optional
The associated captures.
refundsRefundDTO[]Optional
The associated refunds.
payment_collectionPaymentCollectionDTOOptional
The associated payment collection.
payment_sessionPaymentSessionDTOOptional
The payment session from which the payment is created.
amountBigNumberInputOptional
valuestring | number
numericnumber
bigNumberBigNumberOptional
Was this page helpful?