comecerodocs

Quote an automatic top-up

POST
/customers/{customer_id}/usage/{subscription_id}/auto_top_up/quotes

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).

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.

Request Body

application/json
  1. body

What one top-up should do. Nothing else may be sent (400, reference UbV158).

below_amount*string

Top up when the credit is below this, above 0 and no finer than the currency, as a decimal string.

add_amount*string

The amount each top-up buys, above below_amount, within what the shop sells at once (min, max, and the smallest sale).

currency*string

The 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.

Range1 <= value <= 100
monthly_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*integer

Required. The revision read with GET (400, reference UbV154, when missing).

Range0 <= value

Response Body

The quote.

application/json
  1. 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?string
quote_id?string

Send it with PATCH .../auto_top_up to accept it.

customer_id?string
subscription_id?string
currency?string
below_amount?string
add_amount?string
principal?string

The credit one top-up adds, its price before tax (tax is never credit).

tax?string
gross?string

What one top-up charges now, tax included.

authorized_max_gross?string

The 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?integer

The monthly count cap that applies, the customer's or the shop's.

monthly_max_amount?string|null
payment_method?|

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

consent_text?string

The exact words the customer accepts, with every amount in them. Show them as they are; the consent kept is this text.

consent_version?string
consent_hash?string
locale?string

The language of consent_text; for now always en.

policy_revision?string
control_revision?integer

The top-up's revision the quote was made on.

expires_at?string
Formatdate-time
date_created?string
Formatdate-time
Example Request
curl -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}'
Example Response
{  "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"}