comecerodocs

Get a customer's automatic top-up

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

One subscription's automatic top-up of its prepaid credit: whether the shop offers it, whether it is on and why not, the amounts and the card the customer accepted, this month's caps and what they used, and the latest top-up. Send its revision back when you change it. A shopper's token reads only its own customer (me works). Here customer_id is the Comecero customer id, not your own id.

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.

Response Body

The automatic top-up.

application/json
  1. response

A customer's automatic top-up of one subscription's prepaid credit: while it is on and the credit falls below below_amount, one top-up of add_amount is bought (giving principal of credit), charged to the saved card the customer accepted, and not again until the credit is back at or above below_amount and falls below it again. Each top-up is tried once and never retried. A failed or unknown payment, a chargeback or a change of the default card turns it off, and only the customer's fresh consent turns it on again. While the shop does not offer it (it stopped top-up or credit sales), no top-up is made and an accepted consent shows as paused: it starts again by itself once offered again, and can still be turned off. Comecero switching usage billing off for the shop, or the subscription's last usage plan ending, turns it off instead. Amounts are decimal strings in currency.

object?string
subscription_id?string
currency?string

The currency of the subscription's usage plans, which every amount is in. With no single usage plan left, the currency the top-up was saved in.

offered?boolean

Whether the shop offers automatic top-up now (usage_customer_settings.auto_top_up.enabled, with credit sales on).

enabled?boolean

Whether it is on. False whenever it is not offered.

paused?boolean

The customer's consent stands but the shop does not offer it now (it stopped top-up or credit sales): nothing is charged, it starts again by itself once offered again, and it can still be turned off. Show the customer a way to turn it off. Comecero switching usage billing off turns it off instead, and so does the subscription's last usage plan ending (within the hour, paused or not).

status?string

off: never turned on, or turned off by the customer. active: on, and it tops up the next time the credit falls below below_amount. awaiting_rearm: on, it topped up, and waits for the credit to be back at or above below_amount first. cap_reached: on, but this month's caps are used up until next_reset_at. disabled: stopped for disabled_reason.

Value in"off""active""awaiting_rearm""cap_reached""disabled"
disabled_reason?|

Why it was stopped, while it is off. merchant_disabled also while the shop does not offer it (it comes back on when the shop offers it again). disputed: a credit purchase was charged back. payment_method_changed: the default card is no longer the one the customer agreed to. payment_failed, payment_unknown: a top-up's payment failed, or its result is not known yet. price_changed: one top-up would now give other credit or charge more than the customer agreed to (a new price or tax). subscription_ended: the subscription ended.

Value in"customer_disabled""merchant_disabled""disputed""payment_method_changed""payment_failed""payment_unknown""price_changed""subscription_ended"null
below_amount?|

Top up when the credit is below this. Null before it was ever turned on.

add_amount?|

The amount each top-up buys, as its invoice line is priced (tax included where prices include tax).

principal?|

The credit one top-up gives, as the customer accepted it: the price before tax, so less than add_amount where prices include tax. Null before it was ever turned on.

authorized_max_gross?|

The most one top-up may charge, tax included, as the customer accepted it. A later price above it is not charged.

monthly_max_count?|

The most top-ups this month in force now, the lower of the cap the customer accepted and the shop's now (a shop's raise never grows a consent). Null when not offered and never set up.

monthly_max_amount?|

The most top-ups may charge this month, tax included, the lower of the cap the customer accepted and the shop's now; null for no cap.

month?string

The UTC month the caps count in, as YYYY-MM.

month_count?integer

The top-ups this month across the customer's subscriptions in this currency, those under way too.

month_amount?string

What they charge, tax included.

next_reset_at?string

When the monthly caps start again (the first of next month, UTC).

Formatdate-time
payment_method?|

The saved card a top-up charges, as the customer may see it. No vault or gateway ids.

last_attempt?|

The latest top-up, with its state, gross, currency and trigger_at only. See the attempts route for the rest.

revision?integer

Goes up by one with every change; 0 before any. Send it back as expected_revision.

Range0 <= value
date_modified?|
Formatdate-time
Example Request
curl -X GET 'https://api.comecero.com/api/v1/customers/string/usage/string/auto_top_up'
Example Response
{  "object": "usage_auto_top_up",  "subscription_id": "SB0123456789",  "currency": "USD",  "offered": true,  "enabled": true,  "status": "active",  "disabled_reason": null,  "below_amount": "10",  "add_amount": "20",  "principal": "16.67",  "authorized_max_gross": "20",  "monthly_max_count": 3,  "monthly_max_amount": "200",  "month": "2026-11",  "month_count": 1,  "month_amount": "20",  "next_reset_at": "2026-12-01T00:00:00Z",  "payment_method": {    "type": "credit_card",    "brand": "Visa",    "ending": "4242"  },  "last_attempt": null,  "revision": 1,  "date_modified": "2026-11-15T12:00:00Z"}