Skip to main content

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

  1. Create a claimable session grant (buildClaimableSessionGrantTypedData).
  2. POST /giftcards/create with cardType: 'open' and session payload.
  3. Redeemer claims with POST /giftcards/claim (signed by claimSigner).
  4. Redeemer calls POST /giftcards/redeem with session auth.

Redemption

POST /giftcards/redeem expects:

  • accessCode for direct cards.
  • sessionAuth + sessionAuthSignature for claimable cards.

List + status

  • GET /giftcards/:cardId – fetch by id
  • GET /giftcards – filter by wallet, role, status, network