- Auto recharge: Automatically recharge a customer’s balance when it drops to the
threshold_amount - Manual purchase: Manually purchase commits for customers who don’t want to enable auto recharge
- Payment gating: Gate the release of the commit balance, from an auto recharge or a manual purchase, based on successful collection of payment
Set up auto recharge with balance thresholds
Configuring auto recharge of the customer’s balance on a contract ensures they never lose access to the product.Create a contract with balance thresholds
When you create a contract in Metronome, you can optionally configure aprepaid_balance_threshold_configuration. This config dictates:
- The
threshold_amountfor the customer’s contract: the balance level when a customer is recharged.- Note: When evaluating whether the
threshold_amounthas been reached, Metronome considers the total balance of all contract- and customer-level commits and credits. Individual seat-scoped credits are not included in this calculation.
- Note: When evaluating whether the
- The
recharge_to_amount: the balance the customer is topped up to after a recharge initiates. - A
payment_gate_config: configure whether to gate the release of balance on payment and what gateway to use.- Select
EXTERNALif you use a gateway that Metronome doesn’t currently support. - If using Stripe, configure
PAYMENT_TYPEto dictate whether payment is sent as an invoice through Stripe Billing or directly as apaymentIntentto Stripe’s payment gateway. - If using Stripe, select your existing tax provider.
- Select
- If the config
is_enabled. If a payment fails and payment gating is enabled, this shifts tofalse.
RECHARGE MINIMUMSWhen setting up Auto Recharge, the
recharge_threshold has a minimum value of $5, and the recharge_to amount must always be at least $10 higher than your threshold. For example, if your threshold is $10, your recharge_to_amount must be at least $20.These minimums apply regardless of whether the balance is denominated in fiat currency or a custom pricing unit. When using custom pricing units, the threshold and recharge amounts are evaluated in the custom pricing unit and converted to fiat currency using the conversion rate defined on the customer’s rate card.Auto recharge with custom pricing units
Prepaid balance thresholds support custom pricing units in addition to fiat currencies. When a customer’s contract uses a custom pricing unit (such as tokens or AI credits), thethreshold_amount and recharge_to_amount are expressed in that custom pricing unit. Metronome converts the recharge amount to fiat currency using the conversion rate defined on the rate card when processing payment.
For example, consider an AI platform that prices usage in a custom pricing unit called “AI Tokens,” where 1 AI Token = $0.10 USD:
- The customer’s contract has a prepaid balance of 500 AI Tokens
- You set a
threshold_amountof 50 AI Tokens and arecharge_to_amountof 500 AI Tokens - When the customer’s balance drops to 50 AI Tokens, Metronome initiates an auto recharge
- Metronome creates a commit for 450 AI Tokens (the difference to reach 500) and charges the customer $45.00 USD (450 × $0.10) through the configured payment gateway
Update the contract’s prepaid balance threshold
Update or add aprepaid_balance_threshold_configuration by editing the contract. For example, you can update the threshold_amount on a contract.
Note that these changes take effect immediately and Metronome forces an evaluation of the customer’s current balance on each config change.
Edit contracts in the Metronome app or with the Metronome API. This API call adds a prepaid balance threshold to a contract:
Prepaid balance threshold billing lifecycle
To best utilize prepaid balance threshold billing, consider its lifecycle: the actions Metronome takes and what actions you may need to take.1. Charge for prepaid balance threshold amount (Metronome)
Once configured, Metronome evaluates the remaining balance available to the customer on the contract to determine when thethreshold_amount has been reached. If the payment_gate_config is set to Stripe, Metronome attempts to charge the customer in Stripe.
If payment is successful, Metronome creates a commit for the amount that recharges the customer back to the recharge_to_amount.
2. Manage notifications (you)
Metronome fires three types of webhook notifications for prepaid balance threshold billing:payment_gate.threshold_reachedwhen the customer hits their threshold.payment_gate.payment_statusafter payment has been attempted. The status of that payment,paidorfailed, is denoted in thepayment_statusfield.payment_gate.payment_pending_action_requiredif intervention is required to process payment.
3. Handle failed payments (you)
If a payment fails, you receive apayment_gate.payment_status with the value of failed. Additionally, the contract’s is_enabled field is set to false.
You should expect to see a voided invoice in Metronome and Stripe for this transaction.
At this point, you should follow up with your customer directly or by creating an automated workflow triggered by this webhook notification.
Once you’re ready to reattempt payment, set the contract’s is_enabled field to true. This forces the contract to evaluate against the threshold_amount, resulting in a new payment attempt.
No Automatic RetriesMetronome does not automatically retry failed payments (as any automatic retries would likely fail, too).
Use an external payment gate
If using theEXTERNAL option for payment_gate_type, you are responsible for facilitating payment and letting Metronome know the response. Follow this workflow:
- Set the prepaid balance threshold config with
payment_gate_typeset toEXTERNAL. - Listen for
payment_gate.external_initiatethat indicates Metronome is ready to receive the outcome of the payment. - Save the
workflow_id- you need this to release the commit. - Charge the customer in your payment gateway of choice.
- Call commits/threshold-billing/release to either release the commit on successful payment, or cancel the commit in case of failure.