Close Card
Submits an irreversible close (cancellation) request for an active virtual card. The call is accepted synchronously — the card immediately enters status=4 (closing) and stays there until the closure completes — while the actual closure and the balance refund complete asynchronously via webhook + platform review.
- Only cards owned by the current
AppIDaccount and of a virtual card type are accepted. - Only
status=2 (active)cards can be closed; afrozen(6)card must be unfrozen first. - The remaining card balance is refunded to your wallet after platform review, per the card package's close-fee rules — the refund is not instant.
Endpoint
| Item | Value |
|---|---|
| Method | POST |
| Path | /api/v1/openapi/card/close |
| Auth | HMAC |
| Idempotency | Not required |
No Idempotency-Key needed
Close is protected by the card state machine: retrying returns 40000 card_is_closing (in progress) or 40000 card_already_closed (done) rather than double-applying. The submission itself moves no money.
Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
card_id | string | ✅ | card_<id> — must belong to your account and be a virtual card |
Example Request
{ "card_id": "card_12345" }Response Fields
| Field | Type | Description |
|---|---|---|
card_id | string | Echo of the card ID |
status | int | Card status after acceptance — always 4 (closing) on success |
status_desc | string | English status description — closing |
success | bool | true when the close request was accepted |
message | string | Fixed English acceptance note (not localized — do not parse) |
Example Response
{
"code": 0,
"message": "Success",
"data": {
"card_id": "card_12345",
"status": 4,
"status_desc": "closing",
"success": true,
"message": "Card closure request submitted, processing in progress"
}
}Lifecycle after acceptance
- Acceptance — this call returns
status=4 (closing)and/card/inforeports4from that moment until completion. The card can no longer be used for payments, and top-ups are rejected withcard_is_closing. Acard.status_changedwebhook (active → closing) is delivered. - Provider closure / clearing — the upstream provider confirms the closure asynchronously. Most card types complete shortly after the request (timing depends on the provider).
virtual_s921goes through a provider clearing period of about one day: during it the card staysclosing (4)and/card/infokeeps showing its balance unchanged. - Completion — you receive the
card.closedwebhook;/card/inforeportsstatus=5 (closed)with balance0. Since v1.5,card.closedis delivered for every completed closure — including cards that had a zero / negative balance at close and refunds automatically rejected for a currency mismatch (before v1.5 these were silently missing). Duplicate provider callbacks do not re-deliver it. (If the provider reports the closure through a status push instead of its close callback, it arrives ascard.status_changedwithto_status: "closed"— treat either event as completion.) - Refund review — the remaining balance (minus the package's close fee) enters the platform's refund review:
- Approved → credited to your wallet. No card webhook is sent for this step.
- Rejected by a platform reviewer → the card is restored to
active (2)and acard.status_changedwebhook (closed → active) is delivered. - Rejected automatically by risk rules → no refund; the card stays
closed.
Closes initiated by the platform (admin, risk control, system jobs) follow the same lifecycle and also emit card.status_changed (active / frozen → closing).
v1.5 fix — closing cards no longer flip back to active
Before v1.5 a provider status push or a recharge attempt could flip a closing card back to active (2), so a merchant could see "active, full balance" after closing it. A closing card now only moves to closed, or back to active through an explicit rollback that is always notified via card.status_changed.
Preconditions & Rules
- Ownership —
card_idmust belong to the authenticated account, else404 card_not_found. - Card type — only virtual cards (
virtual_l/virtual_p/virtual_v/virtual_r/virtual_g/virtual_a/virtual_s921). Avirtual_s921card entersclosing(4)on close and its balance is settled — withcard.closeddelivered — only after a clearing period of about one day. - State — only
status=2 (active);frozen(6)must be unfrozen first (card_frozen_cannot_close); repeat calls hitcard_is_closing/card_already_closed. - Irreversible — once accepted the closure cannot be cancelled by you.
Common Errors
Business errors come back with HTTP 200 and a non-zero code — always check code (0 = success) and branch on error_key.
| HTTP | code | error_key | Description |
|---|---|---|---|
| 200 | 40001 | validation_failed | Request body cannot be parsed |
| 200 | 40000 | openapi_invalid_card_id | card_id missing or malformed (expected card_<number>) |
| 200 | 40000 | openapi_card_type_not_supported | Card is not a virtual card type |
| 200 | 40000 | card_is_closing | A close request is already in progress |
| 200 | 40000 | card_already_closed | Card is already closed |
| 200 | 40000 | card_frozen_cannot_close | Card is frozen — unfreeze first |
| 200 | 40000 | card_status_cannot_close | Card is not active (e.g. pending / failed); cannot be closed |
| 200 | 40000 | close_not_accepted_by_upstream | Provider did not accept the closure; the card has been restored to active — retry later |
| 200 | 40000 | card_upstream_closed_pending_reconcile | Card was already closed directly by the provider and awaits manual refund reconciliation — do not close here |
| 200 | 40000 | card_config_not_found / card_type_mismatch / operation_not_supported | Configuration / card-type problems |
| 401 | 40100 | openapi_invalid_credentials | Auth failure |
| 404 | 40400 | card_not_found | Card not found / not owned |
| 429 | 42900 | too_many_requests | Rate limited — honor Retry-After |
| 200 | 50000 | openapi_close_card_failed | Server error, or the provider call failed. When the provider call failed the card has normally been restored to active — check /card/info before retrying |
A rejected request (any error above) changes nothing visible to you: no card.status_changed is sent.
Integration pitfalls & best practices
Read before integrating
Close is the highest-consequence card operation: irreversible, provider-bound, and money moves later via review.
- Synchronous, provider-bound call — allow up to ~60 s. The submission calls the upstream provider inline. Set your HTTP client timeout to ≥ 60 s for this endpoint.
- A client-side timeout does NOT mean the close failed. On any timeout / network error, reconcile via
/card/info:status=4/5→ accepted (do not resubmit as a "new" close);status=2→ not applied (safe to retry). - Completion signal is asynchronous. Treat the
card.closedwebhook (or polling untilstatus=5) as completion — the synchronous response only means "accepted". Forvirtual_s921expect about one day. - Refund is not instant and not guaranteed to equal the last seen balance. It passes platform review and deducts the package close fee; a reviewer's rejection restores the card to active (
card.status_changedclosed → active). Reconcile your books against the wallet credit, not against the pre-close card balance. close_not_accepted_by_upstreamauto-rolls back. The card is already restored toactivewhen you receive this error — no cleanup needed on your side, just retry later.- Treat
card_is_closing/card_already_closedas "already in the desired state", not hard errors, when retrying.