Skip to main content
Issued cards are in early access and subject to change. To request access, contact hi@natural.com.
In Sandbox, your agent issues single-use cards the same way as in production. You then simulate the merchant side: authorize a purchase on the card, then capture, reverse, expire, or refund it. Natural approves or declines each authorization based on the card and the wallet. To test cards your customers use to pay you, see card fixtures. Issued-card simulations are available through the REST API and the Sandbox MCP server. The SDKs and CLI don’t support them yet.

Before you start

You need:
  • Issued cards turned on for your account in Sandbox. Natural turns issued cards on for each account. To request it, contact hi@natural.com. Turning them on in Sandbox doesn’t turn them on in production. Without it, card requests return 403 with issued_cards_not_enabled.
  • A funded wallet. Link a test bank account and deposit into the wallet. Sandbox deposits complete immediately.
  • An agent and its agent key. Only an agent can create agent cards. A party API key acts as your account, not as an agent, so POST /agent-cards with it returns 403.
  • cards.read for the agent on the wallet. Without it, card requests return 403 with cards_read_required.

Get an agent key

A person signed in to the dashboard creates agent keys. An API key can’t create one: POST /agent-keys with an API key returns 403. This keeps a leaked API key from minting new agent credentials.
  1. In the dashboard, switch to Sandbox and open Agents.
  2. Choose Add agent. The dashboard creates the agent and its key, and shows the key (ak_ntl_sandbox_...) once. Save it then.
  3. Repeat for each agent. If your code creates agents with POST /agents, a person still creates each agent’s key from the dashboard.
An agent spends from the wallets it has access to. An agent created with POST /agents gets your default wallet unless you pass walletId. For your own agent, cards.read comes from the agent’s permissions on each of those wallets. If you remove cards.read from an agent on a wallet, Natural closes the agent’s open cards on that wallet. If the agent had cards.read on every wallet and you narrow it to some wallets, Natural closes all of the agent’s open cards, and the agent can request new ones on the wallets it kept.

Issue cards for a connected customer

A Connect platform can issue and track agent cards for a connected customer, such as one customer per health plan.
  • Act through your connected agent. Pass the customer’s party ID as customerPartyId. Your agent can then issue a card on the customer’s wallet, read its details, close it, and simulate purchases on it. The customer’s grant to your agent must include cards.read. An agent connected over OAuth needs the cards:agent scope. If it connected before issued cards were turned on, reconnect it.
  • Issued cards follow your account. When your platform acts for a connected customer, Natural accepts your account’s issued-cards setting, so the customer’s account doesn’t need it turned on. The customer’s own agents and keys still follow the customer’s account. A test customer from Invite a test customer always follows your account.
  • Read card transactions with payments.read. Your party API key reads the customer’s card transactions with GET /card-transactions?customerPartyId=.... The customer’s grant to your platform must include payments.read on the card’s wallet, and you see every card transaction on the wallets it covers. Without it, requests return 403 with payments_read_required. Your agent sees only the transactions on its own cards. The same rule decides which card transaction webhooks you receive.
  • Close, but no unfreeze. Your connected agent can close a card it issued for the customer. Unfreezing a card isn’t available when you act for a customer.
Send every request below to https://api.sandbox.natural.com with a sandbox key.

Issue a test card

Issue a card with the agent’s key. maximumAmount is in cents and caps the card’s one purchase.
The response is the card (pcd_...). Use it once its status is active. A card expires after 60 minutes unless you set expiresInMinutes (5 to 1440). If the card can’t be issued, these errors come back: See Agent cards errors for the full list.

Read the test card

GET /agent-cards/{cardId}/details returns the card’s details. Every Sandbox card returns the same test card, unencrypted: Simulations use the card ID, not the number.

Close a test card

Close a card you no longer need with POST /agent-cards/{cardId}/close. It works the same in Sandbox as in production. The request has no body and doesn’t need an Idempotency-Key, because repeating it is safe.
These callers can close a card:
  • The agent the card was issued to, while it has cards.read on the card’s wallet.
  • Your party API key or a person on your account, with payments.create on the card’s wallet. Without it, the close returns 403 with payments_create_required.
To close a connected customer’s card, use the connected agent and pass customerPartyId as a query parameter. A card on another party’s wallet returns 404 with agent_card_not_found. The response is 200 with a status: A 503 with agent_card_close_unconfirmed or agent_card_close_unavailable has retryable: true. Send the same close again until it returns 200. After a close that returns closed, the issuing agent’s GET /agent-cards/{cardId} shows status closed with closedAt set. After already_closed, the card keeps its status (used, expired, or failed). Only the issuing agent can read the card, so a party API key or a person relies on the close response instead. An authorization you simulate on a closed card declines.

Card status

Card controls

An agent card has these controls, and they work the same in Sandbox as in production:
  • Single use. The card approves one purchase. After that, it’s used and declines with single_use_card_used.
  • Maximum amount. maximumAmount is set when you issue the card, from 1 cent to $10,000 (1000000). A purchase over it declines with single_use_amount_over_maximum.
  • Lifetime. expiresInMinutes is 5 to 1440 (24 hours), and 60 if you leave it out. After expiresAt, the card declines with single_use_card_expired.
  • Close. You can close a card before it’s used.
Program spending limits also apply to every card on a wallet. When a person owns the wallet, the limits are $3,000 per purchase and $5,000 per day. When a business owns it, they’re $10,000 per purchase and $25,000 per day. The daily total covers all card purchases on the wallet and resets at 00:00 UTC. A card’s maximum applies inside these limits, so a purchase over the per-purchase limit declines with purchase_over_program_limit even when it’s under the card’s maximum. A purchase that goes over the daily total declines with daily_spend_over_program_limit. You can’t set merchant category or country rules on a card. The merchant you pass when you issue a card is returned with the card but isn’t matched against the purchase.

Simulate a purchase

Authorize a purchase on the card:
The response is a card transaction (cit_...) with status authorized or declined. Amounts are in cents. Then act on it with POST /simulations/card-transactions/{cardTransactionId}/{action}: For reverse and expire, send {"data": {"attributes": {}}}. Rules:
  • A purchase can be captured, reversed, or expired once. A capture can be up to the authorized amount.
  • A refund needs a capture first. You can refund more than once, up to the captured amount.
  • An action the purchase’s state doesn’t allow returns 409 with card_purchase_simulation_not_allowed.
Read the result with GET /card-transactions/{cardTransactionId}.

Who can simulate

  • The agent the card was issued to, while it has cards.read on the wallet.
  • The wallet owner’s dashboard user or party API key with payments.create on the wallet. This includes purchases on a person’s own card (see Personal cards).
To simulate for a connected customer, use the connected agent and pass customerPartyId in the request attributes.

Personal cards

A person on the wallet can also get their own card in Sandbox. In the dashboard, switch to Sandbox, open the wallet, and choose Create card.
  • Hovering the card number or CVV shows the Sandbox test card: 4242424242424242, CVV 123, and the card’s own expiration.
  • Freezing and unfreezing the card work as in production.
  • To simulate a purchase, choose Copy ID from the card’s menu to copy the card ID (pcd_...). Then call POST /simulations/agent-cards/{cardId}/authorize with the wallet owner’s party API key, which needs payments.create on the wallet. The capture, reverse, expire, and refund actions above work the same way.
  • An agent can’t simulate purchases on a person’s card.
A personal card has no maximum or expiry of its own, so the single-use declines below don’t apply. A purchase over the wallet’s balance declines with insufficient_funds, and a frozen card declines.

Declines

A declined authorization returns 200 with status declined and a decline object. No money moves.

Card transaction webhooks

Natural sends a webhook event when a card transaction changes. Each event’s data.object is the card transaction as GET /card-transactions/{cardTransactionId} returns it at that moment. Events go to the webhooks of the party that owns the card’s wallet. For a connected customer’s card, your webhook needs connected in sources, and the customer’s grant to your platform must include payments.read on the card’s wallet. The dashboard’s event picker doesn’t list these events yet. To subscribe, create or update a webhook with the event names in enabledEvents, or use "*". See Receive events to register a webhook and verify signatures. Simulations send the same events as real purchases, because they go through the same records: A purchase sends each event once, and a refund doesn’t send an event on its purchase. Events can arrive out of order or more than once, so key your handling on the event id and read the card transaction for its latest state. To confirm an event was sent, list your events with GET /events and eventType, for example cardTransaction.captured. To see each delivery attempt to your URL, open the webhook in the dashboard under Developers.

Retries

  • Every simulation needs an Idempotency-Key. Retrying with the same key and body returns the first result without running the simulation again. See Idempotency.
  • Agents also send X-Instance-ID.
  • A 503 with retryable: true means the simulation was accepted but its result wasn’t ready yet. Retry with the same key.