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

# Create credits by order number

> The following endpoint is used to create credits using an order number.



## OpenAPI

````yaml orders.openapi post /orders/order-number/{orderNumber}/actions/create-credits
openapi: 3.0.1
info:
  contact:
    email: support@fabric.inc
    name: fabric Support Team
  description: >-
    fabric **Orders** API is a scalable multi-tenant service designed to
    streamline your order management process. Orders API is a REST and JSON
    driven interface enabling retailers to create orders directly from online
    Storefronts and Point-of-Sale systems, and serve as records of purchase
    transactions to permit retailers to operate against a standard schema with
    varied purchase channels. <p> fabric Orders API creates orders real time in
    the orders database, unifying the order data for users to streamline order
    lifecycle orchestration and customer service operations. It offers a range
    of features including the ability to create orders, get orders, update
    pickup details, and track orders, as well as search for existing orders.
    Also, the Orders API makes it easy to check eligibility of return, cancel,
    and exchange requests as well process them, if eligible. In addition, you
    can flag fraudulent orders based on due diligence, and either release them
    from hold or cancel them altogether. The appeasement feature helps you
    resolve any issues that may arise with an order and keep your customers
    happy. </p>
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
  termsOfService: https://fabric.inc/terms-of-use
  title: fabric Orders API
  version: 3.0.0
  x-audience: external-public
servers:
  - description: Production
    url: https://api.fabric.inc/v3
security:
  - authorization: []
tags:
  - description: These endpoints authorize order payments.
    name: Payments
  - description: These endpoints help create appeasement requests.
    name: Appeasements
  - description: >-
      Credits are refunds to customers, often in the form of gift cards or
      credit notes, when customers have made payments with cash or a card that
      has subsequently expired. Credits are provided during order returns and
      appeasements. Use these endpoints to create and manage credits.
    name: Credits
  - description: >-
      These endpoints check eligibility of order cancellation requests and if
      eligible, processes order cancellation.
    name: Cancellations
  - description: These endpoints track orders.
    name: Tracking
  - description: >-
      These endpoints create orders, update pickup details (for BOPIS scenarios)
      and get order details.
    name: Orders
  - description: >-
      These endpoints check eligibility of order return or exchanges requests
      and, if eligible, processes order return or exchanges.
    name: Returns
  - description: These endpoints deal with potential fraud orders.
    name: Frauds
externalDocs:
  description: Find out more about fabric Orders (also called OMS)
  url: https://developer.fabric.inc/v3/docs/orders-overview
paths:
  /orders/order-number/{orderNumber}/actions/create-credits:
    post:
      tags:
        - Credits
      summary: Create credits by order number
      description: The following endpoint is used to create credits using an order number.
      operationId: createCreditByOrderNumber
      parameters:
        - description: >-
            The merchant-defined order identifier provided during the Create
            Order - `POST /orders` endpoint.
          example: ORDER0001
          in: path
          name: orderNumber
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xFabricRequestId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/orderCreditsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/orderCreditsResponse'
          description: OK
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
        '400':
          content:
            application/json:
              example:
                errors:
                  - message: Invalid request
                    type: CLIENT_ERROR
                message: Bad request
                type: CLIENT_ERROR
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
        '401':
          content:
            application/json:
              example:
                message: Unauthorized request
                type: CLIENT_ERROR
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
        '404':
          content:
            application/json:
              example:
                message: Not found
                type: CLIENT_ERROR
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Not found
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
        '500':
          content:
            application/json:
              example:
                message: Internal server error
                type: SERVER_ERROR
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal server error
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
components:
  parameters:
    xFabricTenantId:
      description: >-
        A header used by fabric to identify the tenant making the request. You
        must include tenant id in the authentication header for an API request
        to access any of fabric’s endpoints. You can retrieve the tenant id ,
        which is also called account id, from
        [Copilot](/v3/platform/settings/account-details/getting-the-account-id).
        This header is required.
      example: 5f328bf0b5f328bf0b5f328b
      in: header
      name: x-fabric-tenant-id
      required: true
      schema:
        type: string
    xFabricChannelId:
      description: >-
        x-fabric-channel-id identifies the sales channel where the API request
        is being made; primarily for multichannel use cases. The channel ids are
        12 corresponding to US and 13 corresponding to Canada. The default
        channel id is 12. This field is required.
      example: '12'
      in: header
      name: x-fabric-channel-id
      required: true
      schema:
        type: string
    xFabricRequestId:
      description: Unique request ID
      example: 263e731c-45c8-11ed-b878-0242ac120002
      in: header
      name: x-fabric-request-id
      required: false
      schema:
        type: string
  schemas:
    orderCreditsRequest:
      description: Credits request
      properties:
        credits:
          items:
            $ref: '#/components/schemas/creditsRequest'
          type: array
      required:
        - credits
      type: object
    orderCreditsResponse:
      description: Credits response
      properties:
        credits:
          items:
            $ref: '#/components/schemas/creditsResponse'
          type: array
      type: object
    errorResponse:
      description: Error response
      properties:
        errors:
          description: Errors
          items:
            $ref: '#/components/schemas/errorResponse'
          type: array
        message:
          description: Error message
          example: Bad request
          type: string
        type:
          description: Error type
          example: CLIENT_ERROR
          type: string
      type: object
    creditsRequest:
      description: Request for credits
      properties:
        amount:
          description: Credits amount
          example: 21.5
          format: double
          type: number
        amountInCurrencies:
          description: >
            A list of amounts represented in different currencies.  

            Each item includes a monetary value and its corresponding currency
            code,  

            following the structure defined in the `amountInCurrency` schema.  

            This field is used to represent multi-currency totals or balances.
          items:
            $ref: '#/components/schemas/amountInCurrency'
          type: array
        attributes:
          description: >-
            Merchant-defined custom attributes. This is a placeholder for
            additional info in key-value pairs.
          example:
            giftCardNumber: XlQZTmFDFtPFGMxJP6oiAqN3vo+qKZ
          type: object
        currency:
          description: Three-letter currency code as defined by ISO-4217
          example: USD
          type: string
        employeeId:
          description: Employee (ID or name) who initiated a the credits request
          example: '12312232'
          type: string
        note:
          description: Note
          example: Credit request initiated
          type: string
        paymentCounter:
          description: >-
            A sequential or incremental counter associated with a payment for an
            order. Applicable in refund scenarios to identify the specific
            payment for refund.
          example: 1
          format: int32
          type: integer
        policyCode:
          description: >-
            Merchant-defined policy code, varies from merchant to merchant. If
            omitted, the default policy is used.
          example: RC1
          type: string
        reasonCode:
          description: Reason code
          example: EC
          type: string
        source:
          description: Source of credits request
          example: CSR
          type: string
        subReasonCode:
          description: Subreason code
          example: ACC
          type: string
        type:
          description: Credit type. Currently, supports only Gift Card
          enum:
            - GIFT_CARD
          example: GIFT_CARD
          type: string
      required:
        - amount
        - currency
        - reasonCode
        - source
        - type
      type: object
    creditsResponse:
      description: Credit response
      properties:
        amount:
          description: Credits amount
          example: 21.5
          format: double
          type: number
        amountInCurrencies:
          description: >
            A list of amounts represented in different currencies.  

            Each item includes a monetary value and its corresponding currency
            code,  

            following the structure defined in the `amountInCurrency` schema.  

            This field is used to represent multi-currency totals or balances.
          items:
            $ref: '#/components/schemas/amountInCurrency'
          type: array
        attributes:
          description: >-
            Merchant-defined custom attributes. This is a placeholder for
            additional info in key-value pairs.
          example:
            giftCardNumber: XlQZTmFDFtPFGMxJP6oiAqN3vo+qKZ
          type: object
        createdAt:
          description: Credits creation time, in UTC format
          example: '2022-07-11T15:03:14.642Z'
          format: date-time
          type: string
        creditId:
          description: Unique UUID of credit
          example: a05b72dc-78d8-4ea4-90fc-2fe6a1fe1111
          type: string
        currency:
          description: Three-letter currency code as defined by ISO-4217
          example: USD
          type: string
        employeeId:
          description: Employee (ID or name) who initiated a the credits request
          example: '12312232'
          type: string
        note:
          description: Note
          example: Credit request initiated
          type: string
        paymentCounter:
          description: >-
            A sequential or incremental counter associated with a payment for an
            order. Applicable in refund scenarios to identify the specific
            payment for refund.
          example: 1
          format: int32
          type: integer
        policyCode:
          description: >-
            Merchant-defined policy code, varies from merchant to merchant. If
            omitted, the default policy is used.
          example: RC1
          type: string
        reasonCode:
          description: Reason code
          example: EC
          type: string
        source:
          description: Source of credits request
          example: CSR
          type: string
        statusCode:
          description: Credit status
          enum:
            - PENDING
            - CONFIRMED
            - FAILED
            - CANCELED
          example: PENDING
          type: string
        subReasonCode:
          description: Subreason code
          example: ACC
          type: string
        type:
          description: Credit type. Currently, supports only Gift Card
          enum:
            - GIFT_CARD
          example: GIFT_CARD
          type: string
        updatedAt:
          description: Time of last update to credits, in UTC format.
          example: '2022-07-11T15:03:14.642Z'
          format: date-time
          type: string
      required:
        - amount
        - currency
        - reasonCode
        - source
        - type
      type: object
    amountInCurrency:
      description: Amount in currency object details.
      properties:
        amount:
          description: The amount displayed in the primary currency.
          example: 123.45
          format: double
          type: number
        currency:
          description: Currency in ISO-4217
          example: USD
          type: string
        group:
          description: >-
            A unique identifier for currencies. All calculations and invoicing
            are based on this identifier. For example, the `Shopper` group uses
            USD, while the `Retailer` group uses EUR.
          example: SHOPPER
          type: string
      required:
        - currency
        - group
      type: object
  headers:
    xFabricRequestIdResponseHeader:
      description: Unique request ID
      example: 263e731c-45c8-11ed-b878-0242ac120002
      required: false
      schema:
        type: string
  securitySchemes:
    authorization:
      bearerFormat: JWT
      scheme: bearer
      type: http

````