Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
Beta

Payment setting gift cards

The payment setting gift card object and the allowed CRUD operations on the related resource endpoint

Gift card payment settings are a plain payment instrument subtype of payment settings. Unlike gateway-based subtypes, they require no external integration — redemption is resolved entirely within Commerce Layer by matching the provided code against a valid gift card scoped to the order's market or currency, and deducting the payment amount from its balance.

Since each payment session covers a single gift card, customers can combine multiple gift cards on the same order by creating one session per card.

Capabilities

Gift card payment settings support the following Commerce Layer features:

Feature
Supported

Payment sessions

Payment wallets

Payment links

3DS / SCA

Gift card validation

When a payment session is created with a gift card payment setting, the customer provides a gift_card_code. The code is validated against active, unexpired, non-empty gift cards scoped to the order's market or currency. The session amount is capped at the gift card's available balance.

The accepted gift card code length is controlled by the organization's gift_cards_min_code_length and gift_cards_max_code_length settings.

Paying a subscription

A gift card can also fund an order subscription: the subscription stores this payment setting together with the gift card code, and each run opens a new gift card session on its target order. Since a gift card cannot be vaulted, the code itself is what gets carried from one run to the next.

Invalidation at authorization

The gift card's validity and balance are re-checked when the session's payment authorization is processed, not only at session creation — time can pass between the two, and the gift card's state may have changed in the meantime (e.g. it was deleted, or its balance was spent elsewhere).

If the gift card can no longer be resolved, or its balance is now lower than the session's amount, the authorization attempt fails outright — without ever reaching succeeded — and the payment session moves directly to invalidated. No balance is deducted from the gift card.

Neither a reversal nor an overage

This is a separate path to invalidated from the gateway-reversal one. There, a transaction succeeds first and is corrected afterward. Here, it never succeeds at all.

This also differs from a session whose balance exceeded. There, the authorization genuinely succeeded and needs reconciling via a void, a refund, or a partial capture. Here, the authorization never succeeds in the first place, so there's nothing to reconcile — simply create a new payment session to retry, e.g. with a different gift card code.

Last updated