Quote an automatic top-up
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).
AuthorizationBearer <token>A secret, trusted or limited token. See Authentication.
customer_id*stringThe Comecero customer id, or me.
subscription_id*stringThe customer's subscription.
application/json- body
What one top-up should do. Nothing else may be sent (400, reference UbV158).
below_amount*stringTop up when the credit is below this, above 0 and no finer than the currency, as a decimal string.
add_amount*stringThe amount each top-up buys, above below_amount, within what the shop sells at once (min, max, and the smallest sale).
currency*stringThe subscription's usage currency.
monthly_max_count?|A lower monthly count cap of the customer's own, at most the shop's. Leave it out for the shop's.
1 <= value <= 100monthly_max_amount?|A lower monthly amount cap of the customer's own (tax included), at most the shop's and at least one top-up. Leave it out for the shop's.
expected_revision*integerRequired. The revision read with GET (400, reference UbV154, when missing).
0 <= valueThe quote.
application/json- response
A priced offer of one top-up, made for the customer to accept: nothing is charged or changed. It can be accepted once, until expires_at (5 minutes), and only while nothing it was made under changed (the shop's setting, the default card, the top-up's revision).
object?stringquote_id?stringSend it with PATCH .../auto_top_up to accept it.
customer_id?stringsubscription_id?stringcurrency?stringbelow_amount?stringadd_amount?stringprincipal?stringThe credit one top-up adds, its price before tax (tax is never credit).
tax?stringgross?stringWhat one top-up charges now, tax included.
authorized_max_gross?stringThe most one top-up may ever charge under this consent (the quoted total). A later price above it stops the top-up before any charge.
monthly_max_count?integerThe monthly count cap that applies, the customer's or the shop's.
monthly_max_amount?string|nullpayment_method?|The saved card a top-up charges, as the customer may see it. No vault or gateway ids.
consent_text?stringThe exact words the customer accepts, with every amount in them. Show them as they are; the consent kept is this text.
consent_version?stringconsent_hash?stringlocale?stringThe language of consent_text; for now always en.
policy_revision?stringcontrol_revision?integerThe top-up's revision the quote was made on.
expires_at?stringdate-timedate_created?stringdate-timecurl -X POST 'https://api.comecero.com/api/v1/customers/string/usage/string/auto_top_up/quotes' \ -H 'Content-Type: application/json' \ -d '{ "below_amount": "10", "add_amount": "20", "currency": "USD", "expected_revision": 0}'{ "object": "usage_auto_top_up_quote", "quote_id": "uaq_5d2f8a1c9e7b4036a1f2c8d4e6b9a703", "customer_id": "0093717976099CuAiEBXu4", "subscription_id": "SB0123456789", "currency": "USD", "below_amount": "10", "add_amount": "20", "principal": "20", "tax": "0", "gross": "20", "authorized_max_gross": "20", "monthly_max_count": 3, "monthly_max_amount": null, "payment_method": { "type": "credit_card", "brand": "Visa", "ending": "4242" }, "consent_text": "I authorize this shop to charge Visa ending in 4242 automatically each time my prepaid usage credit falls below 10.00 USD, to add 20.00 USD of credit for 20.00 USD (tax included), and never more than 20.00 USD for one top-up. At most 3 top-ups per calendar month (UTC). Each top-up is tried once and is never retried. Automatic top-up stops if a payment fails or my card changes, and I can turn it off at any time.", "consent_version": "auto_top_up.v1", "consent_hash": "7c1e0b3a9f2d4c6e8a1b3d5f7e9c0a2b", "locale": "en", "policy_revision": "3e5a7c9b1d2f4e6a8c0b2d4f6a8c0e1b", "control_revision": 0, "expires_at": "2026-11-15T12:05:00Z", "date_created": "2026-11-15T12:00:00Z"}Turn a customer's automatic top-up on or off PATCH
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.
List a customer's automatic top-ups GET
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).