GiftCardPaymentAdapter
Paying with a gift card, a partial method: it covers the smaller of the card's balance and what is left to pay, and several cards can sit on one cart beside the method that pays the rest.
import { GiftCardPaymentAdapter } from "@evolve-framework/commercetools/gift-card";new GiftCardPaymentAdapter(options: GiftCardPaymentAdapterOptions)| Option | Type | Description |
|---|---|---|
clientFactory | ClientFactory | The commercetools client its requests to the project go through, built
with |
store | GiftCardStore | Where the cards live. |
GiftCardStore4The fields of store.
| Field | Type | Description |
|---|---|---|
checkBalance | (card: GiftCardCredentials) => Promise<GiftCardBalance> | The balance available to spend. Throws |
reserve | (card: GiftCardCredentials & { holdId: string; centAmount: number; currency: string; }) => Promise<void> | Hold |
capture | (args: { number: string; holdId: string; }) => Promise<void> | Take what |
release | (args: { number: string; holdId: string; centAmount?: number | undefined; }) => Promise<void> | Give back |
| Method | Description |
|---|---|
partialAmount(
target: Cart | Order,
methodArgs: Record<string, unknown>,
): Promise<number> | How much of the cart the card can pay. |
captureReserved(payment: Payment): Promise<void> | Takes the amount held for this payment off the card it was reserved on. |
releaseReserved(
payment: Payment,
centAmount?: number,
): Promise<void> | Gives back centAmount of the amount held for this payment to the card, or all of it when centAmount is omitted. |
Extends BasePaymentAdapter.

