> ## 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.

# Client apply loyalty vouchers

> Validates the Loyalty Vouchers selected by the user and applies them to the current user's cart if all vouchers in the list are valid and applicable.

<Note>
  Part of the [Loyalty Vouchers (from Global-e)](/integration-guides/loyalty-vouchers) integration guide — see it for when and how to use this endpoint.
</Note>

<Note>
  This API is part of Global-e's extensions and plug-ins. Merchants do not need to implement this API unless a custom integration is required.
</Note>

Use this method to validate the Loyalty Vouchers selected by the user from the list that has been provided in the `loyaltyVouchersList` argument of the `SendCart` API call for the current user's checkout page. This method can only be executed from within the context of the current user's client session. Validates Loyalty Vouchers and applies them to the current user's cart if all the vouchers in the list are valid and applicable.

* If at least one Loyalty Voucher in the list is invalid, `Merchant.ResponseInfo.Success` is set to `FALSE`.
* If all Loyalty Vouchers are valid, the Merchant's server should re-calculate the cart pricing and execute before returning a response, the `SendCart` API call with the `CartToken` argument value returned from the previous call to `SendCart` for the current user.


## OpenAPI

````yaml api-reference/specs/clientapplyloyaltyvouchers.yaml POST /ClientApplyLoyaltyVouchers
openapi: 3.0.3
info:
  title: ClientApplyLoyaltyVouchers
  version: 1.0.0
  description: >-
    Use this method to validate the Loyalty Vouchers selected by the user from
    the list that has been provided in the loyaltyVouchersList argument of the
    SendCart API call for the current user's checkout page. This method can only
    be executed from within the context of the current user's client session.
    Validates Loyalty Vouchers and applies them to the current user's cart if
    all the vouchers in the list are valid and applicable.
servers:
  - url: https://{merchant_site_domain}
    variables:
      merchant_site_domain:
        default: www.merchant-site-domain.com
        description: >-
          The merchant's site domain hosting the ClientApplyLoyaltyVouchers
          endpoint. The merchant supplies the actual URL to Global-e; the
          documentation shows it as a placeholder.
security: []
tags:
  - name: ClientApplyLoyaltyVouchers
    x-page-title: ClientApplyLoyaltyVouchers
  - name: 'Direction: Global-e → Merchant'
  - name: 'Domain: Checkout & Cart'
paths:
  /ClientApplyLoyaltyVouchers:
    post:
      tags:
        - ClientApplyLoyaltyVouchers
      summary: Validate and apply loyalty vouchers to the current user's cart
      description: >-
        Use this method to validate the Loyalty Vouchers selected by the user
        from the list that has been provided in the loyaltyVouchersList argument
        of the SendCart API call for the current user's checkout page. This
        method can only be executed from within the context of the current
        user's client session. Validates Loyalty Vouchers and applies them to
        the current user's cart if all the vouchers in the list are valid and
        applicable.


        If at least one Loyalty Voucher in the list is invalid,
        Merchant.ResponseInfo.Success is set to FALSE.


        If all Loyalty Vouchers are valid, the Merchant's server should
        re-calculate the cart pricing and execute before returning a response,
        the SendCart API call with the CartToken argument value returned from
        the previous call to SendCart for the current user.
      operationId: clientApplyLoyaltyVouchers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                cartAction:
                  allOf:
                    - $ref: '#/components/schemas/CartAction'
                  description: Delineates what action to perform with the cart data.
              required:
                - cartAction
            example:
              LoyaltyVouchers:
                - '123456'
                - '123467'
      responses:
        '200':
          description: >-
            Describes the response to the API call. In case of an error,
            indicates the error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseInfo'
components:
  schemas:
    CartAction:
      type: object
      title: Merchant.CartAction
      properties:
        CartHash:
          type: string
          description: >-
            Cart hash originally specified in the merchantCartHash argument for
            the SendCart method preceding the current cart action.
        CartId:
          type: string
          description: >-
            Identifier of the cart on the Merchant's site originally specified
            in the merchantCartToken argument for the SendCart method preceding
            the current cart action.
        CartToken:
          type: string
          description: >-
            Cart token for the cart generated on the Global-e side by the
            SendCart method preceding the current cart action. This property is
            mandatory only for server-side calls.
        LoyaltyVouchers:
          type: string
          description: >-
            A JSON-serialized array of Loyalty Voucher codes to be applied to
            the cart. This list is mandatory only in the
            ClientApplyLoyaltyVouchers method.
        MerchantGUID:
          type: string
          description: >-
            Unique identifier of the Merchant on Global-e. This property is
            mandatory only for server-side calls.
        UserId:
          type: string
          description: >-
            Internal User identifier on the Merchant's site originally specified
            in the shipping details.UserId argument for the SendCart method
            preceding the current cart action.
    ResponseInfo:
      type: object
      title: Merchant.ResponseInfo
      description: >-
        Describes the response to the API call. In case of an error, indicates
        the error.
      properties:
        Description:
          type: string
          description: >-
            Optional response description. In case of an error, this property
            indicates the error message description.
        ErrorCode:
          type: string
          description: Error code to be returned when an error occurs.
        InternalOrderId:
          type: string
          description: Order unique identifier on the Merchant's site
        Message:
          type: string
          description: >-
            Optional response message. In case of an error, this property
            indicates the error message text.
        OrderId:
          type: string
          description: >-
            Order identifier on the Merchant's site used for display and
            reporting purposes only. Unlike the InternalOrderId, this identifier
            is not necessarily unique over time, as the Merchant's site may
            potentially reuse it (for example after deleting the old order
            having the same OrderId).
        PaymentAmount:
          type: string
          description: >-
            The total payment amount in PaymentCurrency charged for the order
            (if payment was processed in the respective API method call).
        PaymentCurrencyCode:
          type: string
          description: >-
            3-char ISO currency code for the order (if payment was processed in
            the respective API method call).
        StatusCode:
          type: string
          description: >-
            Code denoting the order status on the Merchant's site (to be mapped
            on the Global-e side).
        Success:
          type: boolean
          description: >-
            Indicates if the call has succeeded. TRUE - Call succeeded. FALSE -
            Denotes an error or failure.

````