Delete a Virtual Account
Delete a customer’s Virtual Account. The close is executed with the institution that backs it: the VA enters a delete-pending window (status unchanged, deletionRequestedAt set) and finalizes to deleted once the provider confirms the close, answering 204 on a completed delete.
A VA that cannot be deleted in its current state is rejected with 409 — cannotDeletePendingVirtualAccount while it is still provisioning, nonZeroBalance while it holds funds, pendingTransactionsExist while a deposit is still in flight, and deleteInProgress when a concurrent DELETE has already stamped the marker. A later DELETE on a VA whose close is still pending resumes that same close rather than being refused. 409 virtualAccountNotFoundAtProvider means the provider cannot find the account being closed; nothing is deleted or failed locally and retrying will not clear it. 422 virtualAccountCloseRejected means the provider terminally rejected the close and the VA moves to failed. 501 deleteNotSupported means the provider has no delete for this account type.
On 503 virtualAccountCloseUnavailable the provider does not yet offer a close for this account: the call goes out and comes back refused, and deletionRequestedAt is cleared, whether this request set it or an earlier one did. The Virtual Account’s status is not changed and it can be deleted again, so retry after the interval given in Retry-After. A concurrent write on the same Virtual Account can block that clear and leave deletionRequestedAt set; a later DELETE resolves it.
502 virtualAccountProviderUnavailable means the close did not complete. It covers a failure at the provider, a failed live balance read behind the nonZeroBalance check, and a Virtual Account whose institution offers no close through this API, so it does not by itself mean that anything was sent. Read deletionRequestedAt afterwards to tell whether the Virtual Account is untouched or left in the delete-pending window; one already in that window stays in it. Retrying is safe either way: a DELETE on a delete-pending Virtual Account resumes the same close. On 502 virtualAccountUnexpectedCloseStatus (the provider returned an account status the close flow does not recognise) the provider did receive and attempt the close, so the VA stays in the delete-pending window with deletionRequestedAt set: retryable, but not untouched.