Gift Cards
Gift cards are built on top of payment intents and (optionally) claimable sessions.
Card types
- Direct: locked to a specific recipient wallet. Requires an access code on redemption.
- Open (claimable): uses a claimable session grant + claim step before redemption.
Create a direct gift card
import { createApiClient } from '@pepaylabs/bnbpay';
const api = createApiClient();
const response = await api.giftcards.create({
network: 'bnb',
cardType: 'direct',
amount: '25.00',
token: 'USDT',
creator: creatorAddress,
recipient: recipientAddress,
payment: {
intent,
witness,
witnessSignature,
reference: 'giftcard:order-1',
scheme: 'permit2',
permit,
},
});
The response includes the card plus an optional access code.
Claimable gift card flow
- Create a claimable session grant (
buildClaimableSessionGrantTypedData). POST /giftcards/createwithcardType: 'open'andsessionpayload.- Redeemer claims with
POST /giftcards/claim(signed byclaimSigner). - Redeemer calls
POST /giftcards/redeemwith session auth.
Redemption
POST /giftcards/redeem expects:
accessCodefor direct cards.sessionAuth+sessionAuthSignaturefor claimable cards.
List + status
GET /giftcards/:cardId– fetch by idGET /giftcards– filter by wallet, role, status, network