Partners Card SDK
Integrate Zebec virtual card purchases and Carbon card top-ups on EVM and Solana.
The Zebec Partners Card SDK lets partners quote and purchase Zebec virtual cards. It supports Ethereum, BNB Smart Chain, Polygon, and Base through ZebecCardEvmService. Solana integrations use ZebecCardSolanaService with the companion @zebec-network/zebec-card-v2-sdk.
The SDK handles wallet transactions and coordinates the purchase result with the Partner API. Keep authentication, end-user OTP, delegated access tokens, quote requests, preflight checks, and status polling in your Partner API client. See the Partner API docs for those operations.
Installation
npm install @zebec-network/partners-card-sdkyarn add @zebec-network/partners-card-sdkAuthentication and security
Zebec supplies partners with an API key and encryption key. The SDK keeps these constructor parameters for compatibility with integrations that use its legacy API client.
Do not commit either credential or expose them in browser-delivered source code. The SDK does not perform end-user login, OTP verification, OAuth, or an access-token exchange.
Partner API environments:
Production
https://api.superapp.zebec.io
Sandbox
https://dev-super.api.zebec.io
For the current Partner v1 API, supply a purchaseApiAdapter. It connects your authenticated Partner API client to the SDK's on-chain purchase workflow without adding authentication state to the SDK.
const service = new ZebecCardEvmService(
signer,
56,
{ apiKey, encryptionKey },
{
purchaseApiAdapter: {
ping: () => partnerApi.healthCheck(),
fetchZebecCardPrograms: (countryCode) =>
partnerApi.getCardPrograms(countryCode),
purchaseCard: (orderRequest) =>
partnerApi.submitConfirmedPurchase(orderRequest),
},
},
);The adapter methods in this example belong to your Partner API client. Existing integrations should omit purchaseApiAdapter only when their deployment still supports the SDK's legacy routes and authentication format. The current Super App hosts do not expose the legacy /orders/* routes.
EVM integration
Supported chains
Ethereum
1
SupportedEvmChain.Mainnet
Sepolia
11155111
SupportedEvmChain.Sepolia
Base
8453
SupportedEvmChain.Base
BNB Smart Chain
56
SupportedEvmChain.Bsc
BNB Smart Chain Testnet
97
SupportedEvmChain.BscTestnet
Polygon
137
SupportedEvmChain.Polygon
Polygon Amoy
80002
SupportedEvmChain.PolygonAmoy
Set sandbox: true when using a testnet. Production mode accepts only mainnet chains, and sandbox mode accepts only testnet chains.
Create a service
Create ZebecCardEvmService with an Ethers signer, a supported chain ID, and credentials supplied by Zebec.
For a testnet service:
Create a recipient
Recipient.create() validates the partner's participant ID and the cardholder's contact details.
address2 is an optional final argument. Each address line can contain up to 50 characters, and the email address can contain up to 80 characters.
Quote and purchase
With the current Partner v1 API, request the quote and run preflight through your Partner API client. Then pass the quote unchanged to purchaseCard().
purchaseCard():
Validates the quote, recipient, supported card program, wallet balance, and contract limits.
Approves ERC-20 spending when the existing allowance is too low.
Selects a direct purchase or DEX swap-and-buy path from the quote and token metadata.
Waits for the on-chain receipt and passes the confirmed purchase to
purchaseApiAdapter.purchaseCard().
For a non-USDC token, provide its contract address. The quote must include executable swap data from the Partner API.
The SDK rejects missing swap routes, mismatched tokens or chains, unsafe receivers, and card loads outside the contract limits before token approval.
Solana integration
Create ZebecCardSolanaService with a configured ZebecCardV2Service from @zebec-network/zebec-card-v2-sdk.
Use network: "devnet" together with sandbox: true for sandbox testing. The Solana service uses the same fetchQuote() and purchaseCard() workflow and selects direct or swap execution from the quote and token metadata.
Legacy quote methods
fetchQuote() and fetchQuoteForToken() on the EVM service use the SDK's built-in legacy API client. Use them only if your deployment supports the legacy routes. For the current Partner v1 API, obtain the quote through your authenticated Partner API client and pass it unchanged to purchaseCard().
Related
Partner API — authentication, OTP, card data, quotes, preflight, submission, and status.
Last updated