Create a contract with spend thresholds
When you create a contract in Metronome, you can optionally configure aspend_threshold_configuration
. This config dictates:
- The
threshold_amount
for the customer’s contract: how much they can spend before a payment attempt is triggered - The
payment_gate_config
:- Configure whether to payment gate the release of the commit and what gateway to use. Select
EXTERNAL
if you are using a gateway Metronome does not currently support. See Use an external payment gate for details. - If using Stripe, configure
PAYMENT_TYPE
to dictate whether payment is sent as an invoice through Stripe Billing or directly as apaymentIntent
to Stripe’s payment gateway. - If using Stripe, select your existing tax provider.
- Configure whether to payment gate the release of the commit and what gateway to use. Select
- What
product_id
should be used to represent the commit: theproduct_id
dictates what the customer sees on their incremental invoice
CONFIGURE BILLINGIf using Stripe as your payment gateway, ensure there is a valid Stripe billing configuration set on the contract. Additionally, set
spend_threshold_configuration.is_enabled
to true
if you want Metronome to immediately evaluate the contract after its creation.Update a contract’s spend threshold
You can update or add aspend_threshold_configuration
at any point by editing the user’s contract. Add spend threshold limits to existing, non-limited contracts or change existing limits on a contract (for example, after some period of successful payments).
Note that these changes take effect immediately.
Edit contracts in the Metronome app or with the Metronome API. This API call adds a spend threshold to a contract:
Manage notifications and handle failed payments
To learn how to manage webhook notifications from Metronome and handle failed customer payments, see the threshold billing lifecycle.Using 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 spend threshold config with
payment_gate_type
set toEXTERNAL
-
Listen for
payment_gate.external_initiate
that indicates Metronome is ready to receive the outcome of the payment -
Save the
workflow_id
- you will 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.