Skip to content

Charge an invoice to the client's saved card

POST
/invoices/{id}/charge
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/invoices/example/charge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "paymentMethodId": "example" }'

Charges the invoice’s outstanding amount to a card its client’s Stripe customer already has saved, with nobody present, and records the payment. Without a body it charges the customer’s default card, the card its Stripe subscription uses, or its only card. When the customer has several cards and none of those, nothing is charged and the outcome is card_choice_required with the cards: list them with GET /clients/{id}/saved-cards, then call again with paymentMethodId (a card that is not the customer’s is answered with 422). The card is charged this once; Chelsea never changes the customer’s default card in Stripe. A decline, a missing card or an unpayable invoice is returned as the outcome in result, not as an error. An invoice another system collects answers 409. Requires the invoices.manage permission.

id
required

Resource identifier (CUID2).

string
>= 1 characters

Resource identifier (CUID2).

Media typeapplication/json
object
paymentMethodId

The saved card to charge, from the client’s saved cards, charged this once. Required when the customer has several cards and none is the default; it must be one of that customer’s cards. Chelsea never changes the customer’s default card in Stripe.

string
>= 1 characters

Example generated

{
"paymentMethodId": "example"
}

The charge outcome.

Media typeapplication/json
object
data
required
object
result
required

Outcome of an off-session charge attempt: the card was charged; Stripe took the money but recording it failed (never retry); the customer has several cards and none was chosen; no usable saved card exists; the invoice was not payable; the card was declined; or Stripe could not be reached.

One of:
object
amount
required
number
kind
required
string
Allowed value: charged
paymentIntentId
required
string

Example

{
"data": {
"result": {
"kind": "charged"
}
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Not found.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The invoice is collected by another system, not here.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

paymentMethodId is not one of the client’s saved cards.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.