> For the complete documentation index, see [llms.txt](https://docs.commercelayer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.commercelayer.io/core-api-reference/2026-05/payment_rules.md).

# 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](/core-api-reference/2026-05/markets.md) and evaluated only for orders going through the Payments API.

## Rule types

There are two rule types: [order rules](#order-rules) evaluate conditions against the order itself and can block its placement, while [payment setting rules](#payment-setting-rules) determine which payment settings are available 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.

A default order rule is automatically created for every market when it is first saved. It requires **100% payment coverage** — meaning the sum of amounts from sessions in `authorized`, `paid`, or `partially_paid` status must fully cover the order total before placement is allowed. This threshold can be adjusted by updating the rule's `template_settings` (e.g. lowering it to 70%).

### Payment setting rules

Payment setting rules control which [payment settings](/core-api-reference/2026-05/payment_settings.md) are available for a given order based on conditions such as a minimum order amount or a customer tag. When at least one enabled, unexpired rule of this type exists on the market, Commerce Layer evaluates it against the order and computes the resulting set of allowed payment settings, exposed via the `available_payment_settings` relationship.

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

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.commercelayer.io/core-api-reference/2026-05/payment_rules.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
