Rule inputs
Define merchant context fields from your payment metadata and save reusable aggregations, so your rules and Activity filters can use them.
Rule inputs are fields you add to the rule builder. A merchant context
field turns a key you send in a payment's metadata into a typed field, such
as a number or a date. An aggregation field saves an aggregation over past
payments under a name. Both appear in the rule builder next to Pay.com's own
fields.
To manage them, go to Settings → Product Settings → Rule Inputs in the Pay.com dashboard. The page has a Merchant Context tab and an Aggregations tab. It's available when rules are turned on for your account, to users who can edit rule inputs.
Merchant context fields
A merchant context field gives a metadata key a type and a label. Rules then compare it with the operators of its type, and Activity can filter payments by it. Without one, a rule can still read any metadata key with the Metadata field, but only as text.
Add a field
On the Merchant Context tab, click Add Field and fill in the form:
| Setting | Description |
|---|---|
| Metadata Key | The key you send in metadata. Letters, numbers, underscores, and hyphens only. It must be unique, and you can't change it later. |
| Label | The name the rule builder and Activity show. |
| Field Type | Text, Number, Select, Boolean, or Date. |
| Value and Label pairs | For Select only, the options the field can take. |
| Regex (optional) | For Text only, a pattern the value must match. |
| Placeholder (optional) | The hint the value box shows, for every type except Boolean. |
Click Add Field to save it. You can edit the label and options later, and delete a field that no rule uses. The Used in Rules section lists the rules that use it.
Send the values
Send the key in the metadata of each payment. Metadata values are text, so
send numbers and dates as strings, with dates in ISO 8601 format. Amounts are
in the currency's smallest unit, so 5000 is $50.00 USD.
{
"amount": 5000,
"currency": "usd",
"source": "pm_card_692434600374304768",
"metadata": {
"loyalty_tier": "gold",
"account_age_days": "412",
"signup_date": "2025-10-03"
}
}Use the field
The field appears in the rule builder under Merchant Context, with the
operators for its type. For example, if you add account_age_days as a
Number field labeled Account age (days), a payment rule can require 3D
Secure when Account age (days) is less than 30. See
Operators.
In Activity, each field becomes a filter in the Metadata group. A Select field filters by its options, a Boolean field by Any, Yes, or No, and the other types by the value you type.
Aggregation fields
An aggregation field is an aggregation you save under a name, so you can use it in many rules without building it again. The Aggregations tab lists them with their Name, Grouped by, Timeframe, and Function.
To add one, click Add Field on the Aggregations tab, enter a Name of aggregated field, and set the aggregation's parts, as in Build a custom aggregation. Then click Add Field. You can also save one from a rule, with Save in Aggregation Fields when you build a custom aggregation.
- If you leave the name empty, Pay.com names the field from its function, field, filters, and time period.
- Names must be unique, ignoring case, and the same aggregation can't be saved twice.
- Add your first List Unique aggregation here. The is in aggregation operator appears in the rule builder once your account has one.
In the rule builder, choose Aggregated Field as the condition's field type to pick a saved field. Saved fields that return a number can also be used in calculated fields.
You can view and delete an aggregation field, but not edit it. To change one, add a new field and switch your rules to it. Its Used in Rules section lists the rules that use it, and Delete Field is available only when no rule does.
Next steps
- Rule conditions: Pay.com's own fields and how operators compare values.
- Aggregations: The parts of an aggregation and how customers and cards are counted.
- Payment rules: Use your fields to block payments or require 3D Secure.