Gravv
/Docs
Search docs or ask a question⌘K
DocsAgent
ChangelogTry sandbox
Recipes Sandbox Test a card in sandbox

Test a card in sandbox

Issue, fund, freeze, withdraw from and change the limit of a sandbox card, and test the purchase and decline screens that sandbox cannot produce today.

4 min read

Use this recipe to issue, fund, freeze and change the limit of a sandbox card, to withdraw from it, and to test the purchase and decline screens that sandbox cannot produce today.

Who it is for. An expense-card app that wants to show employees their card, its balance and its status changes before going live.

Status. Available for issuing, funding, reading and updating a virtual card. Withdrawals work in sandbox. Not yet available in sandbox for purchases, declines and physical cards.

Money example

1.
Gravv issues Ada's sandbox card during activation, with a 100 USD daily limit.
2.
You fund it with 100 USD from a sandbox source on polygon. When the transfer is completed, the card's balance reads 100.
3.
You freeze it with {"status": "freeze", "limit": 100}. While the card is frozen, balance reads 0, and Gravv sends cards.status.update.
4.
You cannot make it spend 60 USD in sandbox today, so you test the purchase screen by posting a recorded cards.transaction.payment payload to your own endpoint.

Before you start

•
You have a sandbox key and your sandbox card account. See Set up your card account.
•
You have a verified sandbox cardholder. See Verify a customer in sandbox.

Find out what is required

StepIn sandbox
Card applicationApproved at once
First cardIssued during feature activation, with a daily limit equal to estimated_monthly_limit
FundingA transfer to the card from a source on polygon. The balance follows the card's wallet
A daily limit of 0Means no limit in sandbox. In live, it declines every payment
Purchases and declinesNot yet available
WithdrawalAvailable, to the card's linked card account or linked wallet. See Withdraw from card
Physical cardsIssuance fails with card creation failed!

Steps

1. Issue the card

Follow Issue a virtual card after a hosted check, with your sandbox key and your verified cardholder.

2. Fund it

Follow Top up a card. In sandbox, a funding transfer sends only transfer.status.pending events. Poll the transaction until it is completed, then read the balance.

cURLNodePython
curl --request GET \
--url https://api.gravv.xyz/v1/cards/a14ec356-f33d-4384-ba68-4d9bfa19765b/balance \
--header 'Api-Key: <API_KEY>'

3. Freeze it and change its limit

Always send status and limit together.

cURLNodePython
curl --request PATCH \
--url https://api.gravv.xyz/v1/cards/a14ec356-f33d-4384-ba68-4d9bfa19765b/update \
--header 'Api-Key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "freeze",
"limit": 100
}
'

Unfreeze with {"status": "active", "limit": 100}. Gravv sends cards.status.update for each real status change.

4. Test the purchase and decline screens without a purchase

You cannot produce card purchases in sandbox today. To test your handler:

•
Post a recorded payload, such as the one in Card decline reasons, to your own endpoint. If your endpoint checks signatures, sign the payload yourself with your sandbox secret.
•
Or resend a stored event that your endpoint already received. Gravv signs the resend like any other delivery.

What can go wrong

ResponseWhyFix
400 card creation failed!You requested a physical card in sandboxTest virtual cards
The daily limit reads 0 after an updateYou sent the update without limitSend status and limit together
The card's balance does not move after a funding transferThe transfer is not completed yetPoll the transaction
400 card does not existThe id is a live card id, or belongs to another business's cardUse a sandbox card id from GET /v1/cards

Webhooks you will receive

You receive cards.status.update for each real status change. You do not need cards.application.update in sandbox, because sandbox approves the application at once. You receive no purchase events, because sandbox cannot produce purchases.

Testing in sandbox

This page is the sandbox guide for cards. Sandbox also cannot produce refunds, reversals, settlement or foreign-currency purchases.

Reference

Was this page helpful? Yes No