> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kibocommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Refund

> Apply a refund to the order.



## OpenAPI

````yaml /openapi/openapi_commerce.json post /commerce/orders/{orderId}/refunds
openapi: 3.0.1
info:
  description: |-
    <div id="overview_COMMERCE">
                <h2>COMMERCE</h2>
                <p>The Commerce API interacts with the commerce entities of your tenant, including shoppers's active shopping
                    carts, checkouts, submitted orders, wishlists, and returns as well as B2B quotes.</p>
                <p>Use the <strong>Carts</strong> resource to manage storefront shopping carts as shoppers add and remove items for purchase.
                    Each time a shopper's cart is modified, the Carts resource updates the estimated total with any
                    applicable
                    discounts.</p>
                <p>Use the <strong>Channels</strong> and <strong>Channel Groups</strong> resources to manage the channels a company uses to create logical
                    commercial business divisions based on region or types of sales, such as "US Online," "Amazon," or "EMEA
                    Retail."
                    All orders include a channel association that enables the company to perform financial reporting for
                    each defined channel.
                    Because channels are managed at the tenant level, you must associate all the tenant's sites with a
                    channel. Sites that do not
                    have a defined channel association cannot successfully submit orders.</p>
                <p>Use the <strong>Checkouts</strong> resource to track a shopper's order items and their intended destinations on sites that
                    have the multiple shipment feature enabled.</p>
                <p>Use the <strong>Orders</strong> resource to manage all components of order processing, payment, and order-level
                    fulfillment.</p>
                <p>Use the <strong>Quotes</strong> resource to support B2B functionality by managing order quotes, similar to wishlists.</p>
                <p>Use the <strong>Returns</strong> resource to manage returned items that were previously fufilled. Returns can include any
                    number of items associated with an original
                    order. Each return must either be associated with an original order or a product definition to represent
                    each returned item.</p>
                <p>Use the <strong>Wish Lists</strong> resource to manage the shopper wish lists of products associated with a customer
                    account. Although customer accounts are managed at the tenant
                    level, the system stores shopper wish lists at the site level. This enables the same customer to have
                    wish lists for each of a merchant's sites. The <strong>Wish List Items</strong>
                    resource allows you to manage the individual items in a wish list.</p>
            </div>
  title: Cart/Checkout/Quote
  version: 0.0.1
servers:
  - description: Kibo Base URL
    url: '{baseUrl}/api'
    variables:
      baseUrl:
        default: https://t1000000.sb.usc1.gcp.kibocommerce.com
        description: Base URL
security:
  - bearerAuth: []
paths:
  /commerce/orders/{orderId}/refunds:
    post:
      tags:
        - Order
      summary: Create Refund
      description: Apply a refund to the order.
      parameters:
        - description: Unique identifier of the order with which to associate the package.
          in: path
          name: orderId
          required: true
          schema:
            type: string
        - description: limits which fields are returned in the response body
          in: query
          name: responseFields
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Refund'
        description: Refund to create on the order
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Refund'
            text/json:
              schema:
                $ref: '#/components/schemas/Refund'
            text/plain:
              schema:
                $ref: '#/components/schemas/Refund'
          description: OK
components:
  schemas:
    Refund:
      description: "Refund associated with an order. A refund is a single exchange of money from merchant to customer\r\nthat either encapsulates a refund to a credit card or an issuance of a store credit.\r\nA refund does not reduce the 'amount collected' on an order and it is possible for a refund to exceed the total order amount."
      properties:
        amount:
          description: Amount refunded.
          format: double
          type: number
        auditInfo:
          $ref: '#/components/schemas/CoreApiContractsAuditInfo'
        id:
          description: Unique identifier of this order transaction.
          nullable: true
          type: string
        orderId:
          description: Unique identifier of the order with which this refund is associated.
          nullable: true
          type: string
        payment:
          $ref: '#/components/schemas/Payment'
        reason:
          description: Merchant-entered reason for this refund.
          nullable: true
          type: string
        reasonCode:
          nullable: true
          type: string
        refundMethod:
          description: Refund Method.
          nullable: true
          type: string
      type: object
    CoreApiContractsAuditInfo:
      properties:
        createBy:
          nullable: true
          type: string
        createDate:
          format: date-time
          nullable: true
          type: string
        updateBy:
          nullable: true
          type: string
        updateDate:
          format: date-time
          nullable: true
          type: string
      type: object
    Payment:
      description: "Payment transaction associated with this order. It is the entire payment interchange between the merchant who is forwarding the customer's payment \r\ninformation and the payment service who is authorizing and capturing payment. Payment can be either by credit card, check, or PayPal. (PayPal not\r\ncurrently supported.)"
      properties:
        amountCollected:
          description: Amount collected on the payment
          format: double
          type: number
        amountCredited:
          description: Amount credited back to the payment.
          format: double
          type: number
        amountRequested:
          description: "Derived from the Amount on the initial payment create, used to help storefront determine how much can be captured for multiple payments.\r\nSee Order.AmountRemainingForPayment for an example."
          format: double
          type: number
        auditInfo:
          $ref: '#/components/schemas/CoreApiContractsAuditInfo'
        availableActions:
          description: Actions available to the payment
          items:
            type: string
          nullable: true
          type: array
        billingInfo:
          $ref: '#/components/schemas/BillingInfo'
        changeMessages:
          description: Change messages related to the payment.
          items:
            $ref: '#/components/schemas/CommerceRuntimeChangeMessage'
          nullable: true
          type: array
        data:
          description: Custom data from payment providers
          nullable: true
          type: object
        externalTransactionId:
          description: >-
            The external/third party transaction Id for this payment. This is
            used to store the transaction Id from digital wallet like Visa
            Checkout
          nullable: true
          type: string
        gatewayGiftCard:
          $ref: '#/components/schemas/GatewayGiftCard'
        groupId:
          $ref: '#/components/schemas/PaymentActionTarget'
        id:
          description: Unique identifier of this order transaction.
          nullable: true
          type: string
        installmentPlanCode:
          description: >-
            Stores the Installment Plan code. Installment is only supported on
            subscription orders
          nullable: true
          type: string
        interactions:
          description: "List of interactions for this transaction. A transaction is created upon authorization and lasts across the payment \r\ninterchange, which can consist of multiple interactions, such as consecutive captures."
          items:
            $ref: '#/components/schemas/PaymentInteraction'
          nullable: true
          type: array
        isRecurring:
          description: "If true, the product is purchased or fulfilled at regular intervals, for example, \r\nmonthly billing or a subscription. (Not currently supported.)"
          type: boolean
        orderId:
          description: >-
            Unique identifier of the order with which this transaction is
            associated.
          nullable: true
          type: string
        paymentServiceTransactionId:
          description: >-
            Unique identifier of the transaction, specified by the payment
            service processesing this transaction.
          nullable: true
          type: string
        paymentType:
          description: Type of Payment
          nullable: true
          type: string
        paymentWorkflow:
          description: >-
            The source of data for this payment.  By default, this will be set
            to 'mozu'
          nullable: true
          type: string
        status:
          description: >-
            Current status of this transaction which are described by the
            PaymentStatusConst class.
          nullable: true
          type: string
        subPayments:
          description: >-
            List of sub payments that correspond to child orders in case of
            multiship orders.
          items:
            $ref: '#/components/schemas/SubPayment'
          nullable: true
          type: array
      type: object
    BillingInfo:
      description: "Customer's payment details such as payment type (credit card, check by mail, or PayPal)\r\nand cardholder information if payment is by credit card."
      properties:
        auditInfo:
          $ref: '#/components/schemas/CoreApiContractsAuditInfo'
        billingContact:
          $ref: '#/components/schemas/CommerceRuntimeContact'
        card:
          $ref: '#/components/schemas/PaymentCard'
        check:
          $ref: '#/components/schemas/CheckPayment'
        customCreditType:
          description: Name of custom stored credit type
          nullable: true
          type: string
        data:
          description: Custom data from payment providers
          nullable: true
          type: object
        externalTransactionId:
          description: >-
            Transaction Id from third party payment source like Visa Checkout,
            Amazon
          nullable: true
          type: string
        isRecurring:
          description: >-
            Indicates whether the payment is used in recurring transactions. ex-
            subscription payments
          type: boolean
        isSameBillingShippingAddress:
          description: Indicates that billing and shipping address are the same
          type: boolean
        paymentType:
          description: "Type of payment, such as credit card, check by mail, or PayPal.\r\nsee Mozu.CommerceRuntime.Contracts.Payments.PaymentTypeConst for valid values"
          nullable: true
          type: string
        paymentWorkflow:
          nullable: true
          type: string
        purchaseOrder:
          $ref: '#/components/schemas/PurchaseOrderPayment'
        recurringTransactionId:
          description: "Recurring Payment Id returned by Payment Gateway\r\nnetworkTransactionId for vantiv\r\npreviousTransactionId for cybersource etc"
          nullable: true
          type: string
        storeCreditCode:
          description: The store credit to use for this purchase
          nullable: true
          type: string
        storeCreditType:
          description: The type of store credit used for this purchase
          nullable: true
          type: string
        token:
          $ref: '#/components/schemas/PaymentToken'
      type: object
    CommerceRuntimeChangeMessage:
      description: >-
        A message displayed by the system based on the last  action, for
        example, when a product price has changed. System-supplied and
        read-only.
      properties:
        amount:
          deprecated: true
          description: Monetary amount that pertains to the change if applicable
          format: double
          nullable: true
          type: number
        appId:
          description: App Id that identifies the user that performed the related change
          nullable: true
          type: string
        appKey:
          description: App Key
          nullable: true
          type: string
        appName:
          description: App Name
          nullable: true
          type: string
        attributes:
          additionalProperties:
            nullable: true
          description: Additional Data. This property will be a Dictionary of objects.
          nullable: true
          type: object
        correlationId:
          description: Correlation Id
          nullable: true
          type: string
        createDate:
          description: When the message was created. System-supplied. Read-only.
          format: date-time
          nullable: true
          type: string
        id:
          description: Unique identifier of the  message. System-supplied. Read-only.
          nullable: true
          type: string
        identifier:
          description: >-
            Unique identifier to what the message pertains, which can be a cart
            item, cart or another generic entity. System-supplied. Read-only.
          nullable: true
          type: string
        message:
          description: Human readable message. System-supplied. Read-only.
          nullable: true
          type: string
        metadata:
          description: >-
            Data. This property will be a JSON array that will contain 0-N
            items, when there is 1 item it will still be an array containing
            only one item. System-supplied. Read-only.
          nullable: true
        newValue:
          deprecated: true
          description: Current price of the item. System-supplied. Read-only.
          nullable: true
          type: string
        oldValue:
          deprecated: true
          description: Original price of the item. System-supplied. Read-only.
          nullable: true
          type: string
        subject:
          description: >-
            Text on the subject line of the message, for example, the product
            name. System-supplied. Read-only.
          nullable: true
          type: string
        subjectType:
          description: >-
            Subject of the message, for example, "Product." System-supplied.
            Read-only.
          nullable: true
          type: string
        success:
          description: Indicates if the message is related to a success or failure.
          nullable: true
          type: boolean
        userFirstName:
          description: User First Name
          nullable: true
          type: string
        userId:
          description: User Id that identifies the user that performed the related change
          nullable: true
          type: string
        userLastName:
          description: User Last Name
          nullable: true
          type: string
        userScopeType:
          description: User Type (e.g. Shopper, Admin, etc.)
          nullable: true
          type: string
        verb:
          description: "Action applicable to the message. This can be \"Increased,\" when the product price has increased, \"Decreased,\" when the \r\nproduct price has decreased, and \"Invalidated,\" when the product is no longer available. System-supplied. Read-only."
          nullable: true
          type: string
      type: object
    GatewayGiftCard:
      properties:
        amount:
          format: double
          nullable: false
          type: number
        cardNumber:
          nullable: true
          type: string
        cardPin:
          nullable: true
          type: string
        currencyCode:
          nullable: true
          type: string
        id:
          nullable: true
          type: string
      type: object
    PaymentActionTarget:
      properties:
        targetId:
          description: The Id of the Checkout/Order/Return to target.
          nullable: true
          type: string
        targetNumber:
          description: The number of the Checkout/Order/Return to target.
          format: int32
          nullable: true
          type: integer
        targetType:
          description: >-
            Specifies if the
            Mozu.CommerceRuntime.Contracts.Payments.PaymentActionTarget.TargetId
            is a Checkout Id, Order Id, or Return Id.
          nullable: true
          type: string
      type: object
    PaymentInteraction:
      description: "A single interaction of a potential list of interactions for a transaction. The scope of the transaction is the entire payment\r\ninterchange. It is created upon authorization and is used for all subsequent interactions performed against the authorize,\r\nsuch as consecutive captures."
      properties:
        amount:
          description: Amount of funds associated with this interaction.
          format: double
          nullable: true
          type: number
        auditInfo:
          $ref: '#/components/schemas/CoreApiContractsAuditInfo'
        capturableShipmentsSummary:
          description: >-
            Stores pairings of shipment number to shipment total for all
            captured shipments. This was added for generating TLogs.
          items:
            $ref: '#/components/schemas/CapturableShipmentSummary'
          nullable: true
          type: array
        checkNumber:
          description: If paying by check, the check number.
          nullable: true
          type: string
        currencyCode:
          description: >-
            ISO currency code for the transaction. Currently, only USD is
            supported.
          nullable: true
          type: string
        gatewayAVSCodes:
          description: Gateway AVS Codes. Supplied by PCIaaS.
          nullable: true
          type: string
        gatewayAuthCode:
          description: >-
            If required by the payment gateway, the authorization code of the
            transaction. Supplied by PCIaaS.
          nullable: true
          type: string
        gatewayCVV2Codes:
          description: Gateway CVV2 Codes. Supplied by PCIaaS.
          nullable: true
          type: string
        gatewayInteractionId:
          description: "Unique identifier of the gateway interaction. Used for credit card transactions, where the\r\npayment service creates a GatewayInteractionId for each transaction interaction."
          format: int32
          nullable: true
          type: integer
        gatewayResponseCode:
          description: Gateway response code. Supplied by PCIaaS.
          nullable: true
          type: string
        gatewayResponseData:
          description: >-
            A List of payment response data required to act on authorization
            when using external order management systems
          items:
            $ref: '#/components/schemas/PaymentGatewayResponseData'
          nullable: true
          type: array
        gatewayResponseText:
          description: Gateway response text. Supplied by PCIaaS.
          nullable: true
          type: string
        gatewayTransactionId:
          description: Unique identifier of the transaction supplied by PCIaaS.
          nullable: true
          type: string
        id:
          description: Unique identifier of this payment transaction interaction.
          nullable: true
          type: string
        interactionDate:
          description: Date the interaction occurred
          format: date-time
          nullable: true
          type: string
        interactionType:
          description: "Types of transaction interactions which can be \"Authorization,\" \"Capture,\" \"AuthorizeAndCapture,\"\r\n\"Void,\" or \"Credit,\" \"CheckRequested,\" or \"CheckReceived.\""
          nullable: true
          type: string
        isManual:
          description: If the payment is a manual payment, this is set to true
          nullable: false
          type: boolean
        isPending:
          description: >-
            If true, indicates payment action is still pending and not yet
            confirmed.
          nullable: false
          type: boolean
        isRecurring:
          description: >-
            If true, the product is purchased or fulfilled at regular intervals,
            for example, a monthly billing or a subscription. (Not currently
            implemented.)
          nullable: true
          type: boolean
        note:
          description: Note to be entered by merchant/application
          nullable: true
          type: string
        orderId:
          description: >-
            Unique identifier of the order with which this transaction is
            associated.
          nullable: true
          type: string
        paymentEntryStatus:
          description: Status of the payment when the transaction interaction was created
          nullable: true
          type: string
        paymentId:
          description: >-
            Unique identifier of the original transaction of which this current
            interaction is a part.
          nullable: true
          type: string
        paymentTransactionInteractionIdReference:
          description: "Unique identifier of previous PaymentTransactionInteraction that this PaymentTransactionInteraction is modifying.\r\nFor instance, when crediting a capture, set the PaymentTransactionInteractionIdReference to the capture PaymentTransactionInteractionID."
          format: int32
          nullable: true
          type: integer
        refundId:
          description: Refund Id, if the interaction is for a stand alone refund.
          nullable: true
          type: string
        returnId:
          description: Return Id, if the interaction is a Credit for a return-refund.
          nullable: true
          type: string
        status:
          description: >-
            Status of the payment transaction interaction which can be either
            "Success" or "Failure."
          nullable: true
          type: string
        target:
          $ref: '#/components/schemas/PaymentActionTarget'
      type: object
    SubPayment:
      properties:
        amountCollected:
          format: double
          nullable: false
          type: number
        amountCredited:
          format: double
          nullable: false
          type: number
        amountRefunded:
          format: double
          nullable: false
          type: number
        amountRequested:
          format: double
          nullable: false
          type: number
        status:
          nullable: true
          type: string
        target:
          $ref: '#/components/schemas/PaymentActionTarget'
      type: object
    CommerceRuntimeContact:
      properties:
        address:
          $ref: '#/components/schemas/CommerceRuntimeAddress'
        companyOrOrganization:
          nullable: true
          type: string
        email:
          format: email
          nullable: true
          type: string
        firstName:
          nullable: true
          type: string
        id:
          format: int32
          nullable: true
          type: integer
        lastNameOrSurname:
          nullable: true
          type: string
        middleNameOrInitial:
          nullable: true
          type: string
        phoneNumbers:
          $ref: '#/components/schemas/CommerceRuntimePhone'
      type: object
    PaymentCard:
      description: "If the customer is paying by credit card, the card holder's details, such as the name on the card, number, billing \r\naddress, and expiration dates."
      properties:
        bin:
          description: Year when the card expires.
          nullable: true
          type: string
        cardNumberPartOrMask:
          description: "The visible part of the card number that the merchant uses to refer to \r\npayment information, for example, the last for digits of the card number."
          nullable: true
          type: string
        ccLastFour:
          description: "Last four digit of Credit card\r\nOnly for OMS Only tenant."
          nullable: true
          type: string
        expireMonth:
          description: Month when the card expires.
          format: int32
          type: integer
        expireYear:
          description: Year when the card expires.
          format: int32
          type: integer
        isCardInfoSaved:
          description: If true, the card information is stored in the customer's account.
          type: boolean
        isTokenized:
          description: If true, the card is tokenized by external provider
          type: boolean
        isUsedRecurring:
          description: >-
            If true, the credit card is charged on a regular interval, such as
            for a subscription. (Not supported currently.)
          nullable: true
          type: boolean
        nameOnCard:
          description: Card holder's name as it appears on the card.
          nullable: true
          type: string
        paymentOrCardType:
          description: Card type such as Visa, MasterCard, American Express, or Discover.
          nullable: true
          type: string
        paymentServiceCardId:
          description: Credit card number.
          nullable: true
          type: string
      type: object
    CheckPayment:
      properties:
        checkNumber:
          nullable: true
          type: string
      type: object
    PurchaseOrderPayment:
      description: Purchase order payment
      properties:
        customFields:
          description: Memo/custom fields
          items:
            $ref: '#/components/schemas/CommerceRuntimePurchaseOrderCustomField'
          nullable: true
          type: array
        paymentTerm:
          $ref: '#/components/schemas/CommerceRuntimePurchaseOrderPaymentTerm'
        purchaseOrderNumber:
          description: Purchase order number
          nullable: true
          type: string
      type: object
    PaymentToken:
      properties:
        paymentServiceTokenId:
          nullable: true
          type: string
        type:
          nullable: true
          type: string
      type: object
    CapturableShipmentSummary:
      properties:
        amountApplied:
          description: The amount applied by the payment action
          format: double
          nullable: false
          type: number
        shipmentNumber:
          description: >-
            The identifying number of the shipment affected by the payment
            action
          format: int32
          nullable: false
          type: integer
        shipmentTotal:
          description: The shipment's total when the payment action occurred
          format: double
          nullable: false
          type: number
      type: object
    PaymentGatewayResponseData:
      description: Payment gateway response data
      properties:
        key:
          description: Key from payment gateway
          nullable: true
          type: string
        value:
          description: Value from payment gateway
          nullable: true
          type: string
      type: object
    CommerceRuntimeAddress:
      properties:
        address1:
          nullable: true
          type: string
        address2:
          nullable: true
          type: string
        address3:
          nullable: true
          type: string
        address4:
          nullable: true
          type: string
        addressType:
          nullable: true
          type: string
        cityOrTown:
          nullable: true
          type: string
        countryCode:
          nullable: true
          pattern: ^[A-Z]{2}$
          type: string
        isValidated:
          nullable: true
          type: boolean
        postalOrZipCode:
          nullable: true
          type: string
        stateOrProvince:
          nullable: true
          type: string
      type: object
    CommerceRuntimePhone:
      properties:
        home:
          nullable: true
          type: string
        mobile:
          nullable: true
          type: string
        work:
          nullable: true
          type: string
      type: object
    CommerceRuntimePurchaseOrderCustomField:
      properties:
        code:
          nullable: true
          type: string
        label:
          nullable: true
          type: string
        value:
          nullable: true
          type: string
      type: object
    CommerceRuntimePurchaseOrderPaymentTerm:
      properties:
        code:
          nullable: true
          type: string
        description:
          nullable: true
          type: string
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: JWT Authorization header using the Bearer scheme.
      scheme: bearer
      type: http

````