Esta página solo está disponible en inglés.Abrir en inglés
API v2 overview
The Web3Card API lets the server of your company operate your card program by code. It reads the users, the cards, the transactions and the vault of your program. It freezes, unfreezes, renames and cancels cards. It prepares card requests, top-ups, deposits and withdrawals for a wallet to sign. It sends signed events to your system, creates invites and, for embedded accounts, shows the card to its holder on a secure screen.
The API is part of the paid plans. Account access, team, branding and domain stay in the Business panel.
Principles
| Principle | What it means for your integration |
|---|---|
| One door, the same rules | Each route applies the same rules as the screens of the platform. What the panel or the app refuses, the API refuses too |
| The key stays on your server | The secret key goes in the Authorization header. Requests coming from a browser are refused. This is how Stripe treats its secret keys |
| One key per environment | w3c_test_ keys work only in the sandbox, w3c_live_ keys only in production |
| The network is still the network | Requesting a card, topping it up, depositing and withdrawing are transactions of a wallet with the contract of your program. The API returns the request ready to sign (to, data, chainId) and never keeps or uses a private key. The result counts when the network confirms. This is how DeFi APIs such as 0x and Uniswap work: the API builds, the wallet signs |
| You choose who signs | The wallet of the person (MetaMask, WalletConnect) or wallets your company runs (ethers, viem, custody), with the same object |
| Safe retries | Every write carries an Idempotency-Key. The same key with the same request returns the same answer and does not run twice, as in Stripe |
| Public ids | The API shows ids like card_7KQ2M9XF3TB1A. They are different from the ids of the panel |
| Signed events | Your system receives a signed POST for each event, and checks the signature with your secret |
Two layers: the platform and the network
Web3Card is hybrid. Part of your program runs on the platform, and part runs on a blockchain, in the contract of your program, which the API calls the vault. The money of your program is always in that contract, under the wallets that deposited it, and never with us.
| Layer | What lives there | How you reach it |
|---|---|---|
| The platform | Users, identity verification, invites, the cards at the card issuer, purchases and events | The API answers by itself: the reads, renaming, freezing and canceling a card, the invites and the secure card screen |
| The network | The balance of each wallet in the contract, the deposits, the withdrawals, and the payment of each card and of each top-up | A wallet signs a transaction. The API prepares it and returns it in calls. You can also read the contract and build the transaction yourself |
An operation on the network always goes through the same four steps:
- Your server asks the API. The API checks the rules of the platform and returns
calls. - A wallet signs the transaction and sends it to the contract.
- The network confirms it. The platform sees the request in the contract, checks it again, and confirms or refuses it on the network.
- The card issuer creates or loads the card, and your server receives the signed event.
| Operation | Route | In the contract |
|---|---|---|
| Deposit | POST /v2/vault/deposits | approve in the token, then deposit |
| Withdraw | POST /v2/vault/withdrawals | withdraw |
| Request a card | POST /v2/cards | requestCard |
| Top up a card | POST /v2/cards/{id}/loads | requestLoad |
| Cancel a pending load | POST /v2/loads/{loadId}/cancel | cancelLoad |
| Read a balance | None: you read the contract | balances, lockedOf, pendingCosts, minDeposit |
Everything else in the API happens on the platform, with no transaction. The details are in Network operations.
Addresses
| Environment | Base address | Key |
|---|---|---|
| Sandbox | https://api.sandbox.creditcard/v2 | w3c_test_ followed by 32 characters |
| Production | https://api.web3card.dev/v2 | w3c_live_ followed by 32 characters |
The sandbox works with test banks and test tokens, like the sandbox panel. The API page of your panel shows the address of your environment.
Your first call
Create a key in the Business panel, menu API (see Authentication), and list your cards:
curl https://api.sandbox.creditcard/v2/cards \
-H "Authorization: Bearer w3c_test_YOUR_SECRET"
{
"success": true,
"cards": [
{
"id": "card_7KQ2M9XF3TB1A",
"userId": "user_4M8T2KX9PQ7AB",
"name": "Online ads",
"last4": "6786",
"status": "active",
"balance": 20,
"currency": "USD",
"productId": "prd_12"
}
],
"next": null,
"summary": { "cards": 1, "frozen": 0, "cardBalance": 20 }
}
The example shows part of the fields. Each page of this chapter lists the routes of one area.
Test in the sandbox
- Create a
w3c_test_key in the API page of the sandbox panel. - The sandbox runs on the same networks as production, with a test token in place of USDT and USDC.
GET /v2/vaultgives you the network, the address of the token and its decimals. See Test tokens. - When your company creates its contract in the sandbox, the wallet that creates it receives 100,000 test USDT and 100,000 test USDC, once per network. For another wallet of your company, ask support.
- A wallet that signs needs a little of the real coin of the network (BNB, ETH on Arbitrum, POL), to pay for gas, and your own access to the network (an RPC address) to send the transaction.
POST /v2/cards/{id}/simulatesends test purchases to a card. See Test purchases.- Emails and SMS are real in the sandbox: the codes arrive in the inbox and on the phone. The identity verification runs in a test environment, with the same steps as in production.
- Invite credit is bought on a test payment page, with no real money.
- The events of the sandbox carry
"livemode": false. The sandbox has its own keys, its own webhook endpoint and its own white label.
The chapter
| Page | What it covers |
|---|---|
| Authentication | Keys, read-only keys, allowed IPs, revoking |
| Errors and limits | The format of answers, errors, lists in pages, retries and limits |
| Users and cards | Reading users, cards, products and transactions; renaming, freezing, unfreezing and canceling cards; test purchases |
| Network operations | Requesting a card, topping up, depositing to and withdrawing from the vault, with the request ready for the wallet |
| Webhooks | Events, the signature and the deliveries |
| Invites | Creating and changing invites |
| Embedded accounts | Wallets of embedded accounts and the secure card screen |