Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
Beta

Payment rules

The payment rule object and the allowed CRUD operations on the related resource endpoint

Payment rules define conditional logic evaluated at order placement time. They are scoped to a market and evaluated only for orders going through the Payments API.

Rule types

Payment rules come in two types, each with a different effect at placement time:

  • Order rules — evaluate conditions against the order itself and can block its placement.

  • Payment setting rules — gate the availability of specific payment settings for a given order.

Order rules

Order rules evaluate conditions against the order itself. If an enabled, unexpired rule in this category applies and its conditions are not met, order placement is blocked.

Payment coverage is measured on the sessions in authorized, paid, or partially_paid status, whose amounts are summed and compared to the order total (with taxes). The order exposes the covered amount and percentage as read-only attributes: payment_taken_amount_cents (in cents) and payment_taken_percentage (as a percentage of the order total).

Markets don't get an order rule by default. When a market has no enabled, unexpired order rule, 100% payment coverage is required: the order can't be placed until its payment sessions fully cover the order total. The same applies when all the market's order rules are disabled or expired. To lower the requirement, create an order rule with the desired threshold (e.g. 70 for 70% coverage). Setting the threshold to 0 lets the order be placed with no payment at all.

Payment setting rules

Payment setting rules control the availability of specific payment settings for a given order based on conditions such as a minimum order amount or a customer tag. Each rule gates only the payment settings listed in its payment_setting_ids: they're available for the order when the rule's conditions are met, and not available otherwise. Payment settings that no rule lists stay available regardless. The resulting set is exposed via the order's available_payment_settings relationship, and every payment session associated with the order must use one of them for the order to be placed.

If the same payment setting is listed by more than one rule, it's available as soon as any of those rules is met.

If no payment setting rules exist on the market, all enabled payment settings configured for that market are available.

Templates

Rules are template-based. Each rule references a template_id (identifying a predefined rule schema) and a template_settings object that provides the variable inputs for that template (e.g. a coverage threshold value).

The available templates are:

Template ID
Rule type
Description

08ddf06d-4d99-4f37-9488-ec41f2e5eef2

Order

Blocks placement unless the paid percentage of the order total reaches value, a number between 0 and 100.

4f82a3dd-a4e7-45fe-831c-92e2d1514547

Order

Blocks placement unless the paid amount reaches value, a non-negative integer in cents.

dcb5299b-25d1-489c-aa78-b9d28ce1be05

Payment setting

Enables the payment settings listed in payment_setting_ids when the order total amount is greater than or equal to value, a non-negative integer in cents.

f1016462-8c0e-444d-9e10-2c25fdc21440

Payment setting

Enables the payment settings listed in payment_setting_ids based on the order customer's tags. With matcher set to in_or, they're enabled when the customer has at least one of the tags whose IDs are listed in tag_ids, and with not_in_or when they're missing at least one.

Each order rule template can be used only once per market — creating a second rule with the same order template on the same market is rejected. Payment setting rule templates can be used multiple times on the same market (e.g. to enable different payment settings at different order amounts).

The full JSON schemas of the templates are publicly available, and their endpoints are listed in the public endpoints page. Each schema's unique flag tells whether the template can be used only once per market.

Disabling and expiring rules

A rule can be temporarily taken out of evaluation without being deleted. Use the _disable and _enable trigger attributes to toggle it off and back on — the read-only disabled_at timestamp reflects the current state. Alternatively, set the expires_at attribute to a future date and time: once that moment passes, the rule stops being evaluated automatically, with no need to pass _disable explicitly.

Last updated