Stream API Errors
This page documents the error response format and the standardized error codes returned by Stream API endpoints. The goal is to provide a stable, predictable contract for client applications and integrators.
Error response envelope
All handled errors return a response body in this format:
{
"error": {
"code": "STREAM_ERROR",
"message": "Something wrong happened, please contact support.",
"additional_info": "Optional human-readable details"
}
}
code: A stable error code fromStreamErrorCodes.message: A user‑facing message associated with the code.additional_info: Optional, best‑effort details to aid debugging.
HTTP status codes
| HTTP status | Meaning |
|---|---|
| 400 | The request is invalid. |
| 401 | The API key is missing or invalid. |
| 403 | The API key doesn't have permission for this action or resource. |
| 404 | The resource doesn't exist. |
| 409 | Another request changed the invoice or payment at the same time, or is still changing it. The code says whether to retry; see Invoice and payment errors. |
| 410 | The resource is no longer available. |
| 422 | The request failed validation, or a value conflicts with an existing record. |
| 503 | A temporary failure on Stream's side; nothing was changed. Retry after a short wait. |
Stream error codes
The following codes are used across all Stream API endpoints:
| Code | Message |
|---|---|
STREAM_ERROR | Something wrong happened, please contact support. |
STREAM_UNKNOWN_ERROR | Unknown exception happened; this exception will be handled as soon as possible. |
PHONE_ALREADY_REGISTERED | Phone is already registered. |
INVALID_PARAMETERS | Request input is not valid. |
INVOICE_FINALISED | Invoice is finalised and cannot undergo this action. |
PAYMENT_REFUNDED_ALREADY | Duplicate action; payment has already been refunded. |
PAYMENT_REFUNDED_FAILED | Could not refund payment; processor failed. |
PAYMENT_GATEWAY_ONE_REFUND_ONLY | The payment gateway allows only one refund per payment, and this payment has already been refunded once. Money is still left on the payment; contact support to refund the rest. |
DUPLICATE_CONSUMER | Consumer already exists. |
DUPLICATE_PAYMENT | A payment with the given information already exists. |
PERMISSION_FORBIDDEN | Permission forbidden. |
PRODUCT_USED_IN_FINALIZED_INVOICE | Product cannot be updated; it is used by a finalized invoice. |
COUPON_USED_IN_FINALIZED_INVOICE | Coupon cannot be updated; it is used by a finalized invoice. |
Invoice and payment errors
These codes come from invoice and payment actions. Several of them mean another request is working on the same invoice or payment at the same moment, for example a payer paying while you cancel. In that case the whole request is undone: nothing was changed, and a retry is safe unless the table says otherwise.
| Code | HTTP | Returned by | What happened | What to do |
|---|---|---|---|---|
INVOICE_ROW_LOCKED | 409 | Invoice cancel and edit, subscription cancel and uncancel, mark a payment as paid, refund, auto-charge on demand | Another action is updating the same invoice or its payments right now: a payment, refund, cancellation, edit, accounting sync or the automatic expiry. | Retry after a few minutes. Auto-charge on demand: fetch the payment first; the card may already have been charged. |
INVOICE_CANCEL_CONFLICT | 409 | Invoice cancel, subscription cancel | The invoice changed while it was being canceled. | Fetch the invoice again, then retry if it still needs canceling. |
INVOICE_REACTIVATION_CONFLICT | 409 | Subscription uncancel | The subscription's next invoice changed while it was being reactivated. | Fetch the subscription again, then retry. |
INVOICE_REACTIVATION_BLOCKED | 409 | Subscription uncancel | The payer's card was charged for the subscription's canceled invoice and that charge hasn't been returned yet, so the subscription can't be uncanceled. | Don't retry; contact Stream support. |
INVOICE_EXPIRED | 400 | Mark a payment as paid, auto-charge on demand | The invoice passed its expiry date (expires_at) unpaid and can no longer be paid. additional_info holds the invoice id. | Don't retry. Create a new invoice if the payer still needs to pay. |
INVOICE_EXPIRY_CONFLICT | 409 | Auto-charge on demand | The invoice changed while it was being expired. | Fetch the invoice again; if it's expired, see INVOICE_EXPIRED. |
PAYMENT_SUCCESS_CONFLICT | 409 | Mark a payment as paid, auto-charge on demand | The payment changed while its success was being recorded. | Mark as paid: fetch the payment, then retry if it isn't paid. Auto-charge on demand: fetch the payment first; the card may already have been charged. |
PAYMENT_LATE_CHARGE_EXPIRED | 409 | Auto-charge on demand | The invoice expired while the card was being charged. The charge went through, and Stream is returning the full amount to the card. | Don't retry. The payer is notified; create a new invoice if they still need to pay. |
PAYMENT_LATE_CHARGE_CANCELED | 409 | Auto-charge on demand | The invoice was canceled while the card was being charged. The charge went through, and Stream is returning the full amount to the card. | Don't retry. The payer is notified. |
PAYMENT_REFUND_CONFLICT | 409 | Refund | The payment changed while its refund was being recorded. Nothing was refunded. | Fetch the payment, then retry. |
PAYMENT_REFUND_BUSY | 409 | Refund | The payment is being updated by another process. Nothing was refunded. | Retry after a few minutes. |
PAYMENT_REFUND_NOT_RECORDED | 409 | Refund | The refund went through at the payment gateway but couldn't be saved yet. It is recorded automatically shortly after. | Don't refund again: the payer has been (or is being) refunded, and a retry would refund twice. |
PAYMENT_REFUND_PENDING | 400 | Refund | An earlier refund on this payment is still pending at the payment gateway. Nothing was refunded. | Retry once the pending refund completes (check the payment's refunds). |
PAYMENT_REFUND_NOT_SENT | 400 | Refund | The refund didn't reach the payment gateway. Nothing was refunded. | Retry later. |
PAYMENT_REFUND_OUTCOME_UNKNOWN | 400 | Refund | The payment gateway returned an error without confirming the refund, which may still go through. | Check the payment's refunds before trying again. |
A 503 with code STREAM_ERROR can come from any of these actions when a Stream service is briefly unavailable. Nothing was changed; retry after a short wait.
Invoice expiry date (expires_at)
Creating an invoice (POST /v2/invoices) or changing it (PUT /v2/invoices/{invoice_id}, PATCH /v2/invoices/{invoice_id}/inplace) with an expires_at that breaks a rule returns 400 with code STREAM_ERROR and the reason in additional_info:
additional_info | Meaning |
|---|---|
expires_at is only supported for one-off invoices | Only one-off invoices can expire; installment and recurring invoices can't. |
expires_at must be in the future | The expiry time has already passed. |
expires_at must be after scheduled_on | The expiry must be later than the invoice's due date. |
expires_at can't be changed for an invoice in status <status> | The expiry can only be changed while the invoice is DRAFT, CREATED or SENT (PUT), or CREATED (PATCH /inplace). |
An expires_at without a timezone (for example 2026-12-01T10:00:00 instead of 2026-12-01T10:00:00Z) returns 422. The expiry edit can also return INVOICE_ROW_LOCKED (above).