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

# Refund gift card

> Use the Refund Gift Card API to send a request to return the used gift card balance in cases where an order is canceled or a new refund is created.

<Note>
  Part of the [Gift Cards](/gift-cards-281937) integration guide — see it for when and how to use this endpoint.
</Note>


## OpenAPI

````yaml api-reference/specs/giftcards.yaml POST /RefundGiftCard
openapi: 3.0.3
info:
  title: Gift Cards
  version: 1.0.0
  description: >-
    Customers with a gift card can use the card to pay for their purchases just
    as they would use other payment methods.
servers: []
security: []
paths:
  /RefundGiftCard:
    post:
      summary: Refund gift card
      description: >-
        Use the Refund Gift Card API to send a request to return the used gift
        card balance in cases where an order is canceled or a new refund is
        created.
      operationId: refundGiftCard
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefundGiftCardRequest'
            example:
              MerchantGUID: abcdabcd-abcd-abcd-abcd-abcdabcdabcd
              Cards:
                - CardId: 167
                  BalanceInGiftCardCurrency: 10
                  BalanceInCustomerCurrency: 21.39
                  GiftCardCurrencyCode: GBP
                  CustomerCurrencyCode: EUR
                  BalanceUsedInCardCurrency: 10
                  BalanceUsedInCustomerCurrency: 21.39
                  RedeemTransactionId: 120423
                  CardFields:
                    CardId: card10
                    CardPin: '111'
              TotalToRefundInCustomerCurrency: 21.39
              TotalToRefundInGiftCardCurrency: 10
              ConversionRate: 2.138827
      responses:
        '200':
          description: Refund result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundGiftCardResponse'
              examples:
                success:
                  summary: Refund successful
                  value:
                    Cards:
                      - CardId: 167
                        BalanceInGiftCardCurrency: 10
                        BalanceInCustomerCurrency: 21.39
                        GiftCardCurrencyCode: GBP
                        CustomerCurrencyCode: EUR
                        BalanceUsedInCardCurrency: 10
                        BalanceUsedInCustomerCurrency: 21.39
                        RedeemTransactionId: 120423
                        CardFields:
                          CardId: card10
                          CardPin: '111'
                        RefundedBalanceInGiftCardCurrency: 10
                        RefundedBalanceInCustomerCurrency: 21.39
                        IsRefundSuccess: true
                    IsRefunded: true
                partialFailure:
                  summary: One or more cards failed to refund
                  value:
                    Cards:
                      - CardId: 167
                        BalanceInGiftCardCurrency: 10
                        BalanceInCustomerCurrency: 21.39
                        GiftCardCurrencyCode: GBP
                        CustomerCurrencyCode: EUR
                        BalanceUsedInCardCurrency: 10
                        BalanceUsedInCustomerCurrency: 21.39
                        RedeemTransactionId: 120423
                        CardFields:
                          CardId: card10
                          CardPin: '111'
                        RefundedBalanceInGiftCardCurrency: 10
                        RefundedBalanceInCustomerCurrency: 21.39
                        IsRefundSuccess: false
                        ErrorCode: Internal Error
                        ErrorText: Fail in card refund.
                      - CardId: 168
                        BalanceInGiftCardCurrency: 10
                        BalanceInCustomerCurrency: 21.39
                        GiftCardCurrencyCode: GBP
                        CustomerCurrencyCode: EUR
                        BalanceUsedInCardCurrency: 10
                        BalanceUsedInCustomerCurrency: 21.39
                        RedeemTransactionId: 120424
                        CardFields:
                          CardId: card20
                          CardPin: '222'
                        RefundedBalanceInGiftCardCurrency: null
                        RefundedBalanceInCustomerCurrency: null
                        IsRefundSuccess: null
                    IsRefunded: false
                    ErrorCode: Internal Error
                    ErrorText: Fail to refund one or more cards.
components:
  schemas:
    RefundGiftCardRequest:
      type: object
      title: RefundGiftCardRequest
      properties:
        MerchantGUID:
          type: string
          description: Merchant unique identifier.
        Cards:
          type: array
          description: Data of all applied cards.
          items:
            $ref: '#/components/schemas/CardData'
        TotalToRefundInCustomerCurrency:
          type: number
          description: Total value to refund for all gift cards in customer currency.
        TotalToRefundInGiftCardCurrency:
          type: number
          description: Total value to refund for all gift cards in Gift Card currency.
        ConversionRate:
          type: number
          description: >-
            Rate of conversion from Gift Card currency to Customer Currency.
            TotalToRefundInGiftCardCurrency = TotalToRefundInCustomerCurrency /
            ConversionRate. TotalToRefundInCustomerCurrency =
            TotalToRefundInGiftCardCurrency * ConversionRate.
    RefundGiftCardResponse:
      type: object
      title: RefundGiftCardResponse
      properties:
        IsRefunded:
          type: boolean
          description: Return true if amounts of redeemed cards are successfully returned.
        Cards:
          type: array
          description: >-
            The same list of cards from request after the refund process. Values
            for RefundedBalanceInCustomerCurrency property should be set.
          items:
            $ref: '#/components/schemas/CardData'
        ErrorCode:
          type: string
          description: Code of platform error.
        ErrorText:
          type: string
          description: Message of platform error.
    CardData:
      type: object
      title: CardData
      properties:
        CardId:
          type: integer
          format: int64
          description: ID of card in DB table on Global-e CORE side.
        BalanceUsedInCardCurrency:
          type: number
          description: Amount to redeem in gift card currency.
        GiftCardCurrencyCode:
          type: string
          description: Gift card currency code.
        CustomerCurrencyCode:
          type: string
          description: User currency code (checkout currency).
        CardFields:
          type: object
          additionalProperties:
            type: string
          description: >-
            The Value of each field is defined in the configuration. Key –
            defined field name. Value – user input data.
        CardHash:
          type: string
          description: Unique hash generated for each card.
        RedeemTransactionId:
          type: string
          description: Value which is set as a result of card redemption.
        RefundedBalanceInCustomerCurrency:
          type: number
          description: >-
            Amount of refunded money in customer currency (should be set in
            refund API call).
        RefundedBalanceInGiftCardCurrency:
          type: number
          description: >-
            Amount of refunded money in gift card currency (should be set in
            refund API call).
        IsRefundSuccess:
          type: boolean
          nullable: true
          description: >-
            If the refund is successful, set to True. If the refund fails, set
            to False. If there is no refund on the card it should be NULL.
        ErrorCode:
          type: string
          description: Code of error which should be set during Redeem and Refund calls.
        ErrorText:
          type: string
          description: Text of error message.

````