Turn a customer's automatic top-up on or off
On: send enabled true with a quote_id from POST .../auto_top_up/quotes and consent_accepted true. Only the customer's own login can turn it on, since it is their consent to the quote's terms; the consent (the exact consent_text, the amounts, the card, who and from where) is kept as evidence, and the top-up is bound to that card. Accepting the same quote again changes nothing and answers the same. Accepting a new quote while it is on changes its amounts. Off: send enabled false; you or the customer may turn it off, and turning off what is off changes nothing. expected_revision is required, so a change made since you read it is never overwritten. The Idempotency-Key header is required: the request is kept (its body, then its answer, for a day) before anything changes, so a retry with the same key and body answers as the first did and changes nothing twice, and the same key with another body is refused.
AuthorizationBearer <token>A secret, trusted or limited token. See Authentication.
customer_id*stringThe Comecero customer id, or me.
subscription_id*stringThe customer's subscription.
Idempotency-Key*stringRequired. Names one change: the same request again with the same key (after a timeout, say) changes nothing more and answers as the first one did, for a day. 1 to 128 printable ASCII characters, sent once; missing or empty is refused (400, reference UbV150). Use a new random key, such as a UUID, for each change you mean to make. The same key with another body is refused (409, reference UbV151).
^[ -~]{1,128}$1 <= length <= 128application/json- body
Turning automatic top-up on (enabled true, with a quote_id and consent_accepted true) or off (enabled false, with only expected_revision needed; quote_id and consent_accepted are then ignored). No other field may be sent (400, reference UbV158).
enabled*booleanquote_id*stringA quote from POST .../auto_top_up/quotes, unexpired and unused (409, reference UbV167, when missing).
length <= 64consent_accepted*booleanExactly true, from the customer's own login after they read the quote's consent_text (400, reference UbV164).
expected_revision*integerThe revision read with GET; the quote must have been made on it too.
0 <= valueThe automatic top-up now.
application/json- 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?stringsubscription_id?stringcurrency?stringThe 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?booleanWhether the shop offers automatic top-up now (usage_customer_settings.auto_top_up.enabled, with credit sales on).
enabled?booleanWhether it is on. False whenever it is not offered.
paused?booleanThe 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?stringoff: 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.
"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.
"customer_disabled""merchant_disabled""disputed""payment_method_changed""payment_failed""payment_unknown""price_changed""subscription_ended"nullbelow_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?stringThe UTC month the caps count in, as YYYY-MM.
month_count?integerThe top-ups this month across the customer's subscriptions in this currency, those under way too.
month_amount?stringWhat they charge, tax included.
next_reset_at?stringWhen the monthly caps start again (the first of next month, UTC).
date-timepayment_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?integerGoes up by one with every change; 0 before any. Send it back as expected_revision.
0 <= valuedate_modified?|date-timecurl -X PATCH 'https://api.comecero.com/api/v1/customers/string/usage/string/auto_top_up' \ -H 'Idempotency-Key: 3f2b6c1e-9d4a-4e8b-a1f7-5c0d2e9b8a64' \ -H 'Content-Type: application/json' \ -d '{ "enabled": true, "quote_id": "uaq_5d2f8a1c9e7b4036a1f2c8d4e6b9a703", "consent_accepted": true, "expected_revision": 0}'{ "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"}Get a customer's automatic top-up GET
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.
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).