Charge an invoice to the client's saved card
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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Resource identifier (CUID2).
Resource identifier (CUID2).
Request Body
Section titled “Request Body”object
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.
Example generated
{ "paymentMethodId": "example"}Responses
Section titled “Responses”The charge outcome.
object
object
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.
object
object
object
A card saved on a client’s Stripe customer.
object
Stripe’s card brand, e.g. visa, mastercard, amex; unknown when it has none.
Expiry month, 1 to 12.
True once the card’s expiry month has passed.
The card’s Stripe payment method id; send it as paymentMethodId to charge this card.
True for the card a charge uses when no card is named: the customer’s default, the card its Stripe subscription is charged with, or its only card.
object
object
object
object
Example
{ "data": { "result": { "kind": "charged" } }}Validation error. Parse failures include field paths and expectations.
Validation error with safe field paths and expected values; submitted values are never returned.
object
object
Stable machine-readable error code.
object
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Unauthorized.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Forbidden.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Not found.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}The invoice is collected by another system, not here.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}paymentMethodId is not one of the client’s saved cards.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Rate limit exceeded. Wait for Retry-After before retrying.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Headers
Section titled “Headers”Maximum requests in the current quota window.
Quota policy in requests and window seconds, for example 60;w=60.
Requests left in this quota window (zero when blocked).
Seconds until the current quota window resets, when available from the rate-limit store.
Seconds until another request may be attempted.
Chelsea is operated by Arepa Labs LLC