comecerodocs

List a customer's automatic top-ups

GET
/customers/{customer_id}/usage/{subscription_id}/auto_top_up/attempts

One subscription's top-ups, newest first, a page at a time: what each charged, how it went, and its invoice. No gateway answers or vault ids. A shopper's token reads only its own customer (me works).

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Path Parameters

customer_id*string

The Comecero customer id, or me.

subscription_id*string

The customer's subscription.

Query Parameters

limit?integer

How many to return, from 1 to 100. The default is 25. A number outside 1 to 100 is taken as the nearest of them.

Range1 <= value <= 100
Default25
starting_after?string

The attempt_id of the last one of the page before. Leave it out for the newest.

Response Body

Success.

application/json
  1. response
object?string
data?array<>

Newest first.

has_more?boolean

True when there are older attempts; pass the last attempt_id as starting_after.

Example Request
curl -X GET 'https://api.comecero.com/api/v1/customers/string/usage/string/auto_top_up/attempts'
Example Response
{  "object": "list",  "data": [    {      "object": "usage_auto_top_up_attempt",      "attempt_id": "uat_8f2c1a9d0b7e4c3a",      "state": "succeeded",      "trigger_at": "2026-11-14T02:00:00Z",      "principal": "20",      "tax": "0",      "gross": "20",      "currency": "USD",      "invoice_id": "4827-KTPMW-641",      "order_id": "1100",      "payment_id": "1102611073847PAa1B2c3",      "failure_code": null,      "failure_message": null,      "date_completed": "2026-11-14T02:00:05Z",      "automatic_retry": false    }  ],  "has_more": false}

Quote an automatic top-up POST

Prices one top-up for the customer to accept: the credit it adds (its price before tax), the tax and the total charged to their default saved card, the monthly caps, and the consent text to show them. Nothing is charged or changed. The quote can be accepted with `PATCH .../auto_top_up` for 5 minutes. The default card must be saved with a payment provider that can charge it with the customer away (today Stripe). A shopper's token quotes only for its own customer (`me` works).

Buy prepaid credit POST

Makes an open invoice with one "Prepaid credit" line of `amount`, in the plan's currency, for the customer to pay through the normal invoice payment page. Once it is paid the credit is added to the subscription's usage plan, once whatever repeats. The credit is the line's price before tax, at most `amount`: where prices include tax, it is less than the total paid. The invoice says how much in `credit_purchase.credit_granted` (and in its line's `meta`). The first purchase makes the plan's credit and pays its meters from it. A refund or chargeback of the invoice takes back its share of the credit, as far as it is unused. Your shop must sell credit (`usage_customer_settings` on `/settings/subscription`). A shopper's token buys only for its own customer (`me` works, and needs a customer's login). Here `customer_id` is the Comecero customer id, not your own id. Send an `Idempotency-Key` header so a retry after a timeout never makes a second invoice: the same key with the same body answers the first invoice (`200`) for a day. A plan may have at most 20 unpaid credit invoices at once.