Rule conditions and operators
Every field and operator a Pay.com rule can evaluate, which rule types can use each field, and how operators compare values.
A rule condition compares one field of a payment with a value. Each condition has a Field, an Operator, and a Value, and you combine conditions with AND and OR. Routing, configuration, payment, cancel, review, and action rules all build conditions from the fields on this page.
Build a condition
In the rule builder, the left side of a condition is one of these:
- Field: a field of the payment, from the lists on this page.
- Calculated Field: an arithmetic expression on number fields and saved aggregations, such as a card's declines divided by its approvals. See Calculated fields.
- Aggregated Field: an aggregation you saved in Rule Inputs.
- Custom Aggregation: an aggregation over past payments that you build in the rule. See Aggregations.
The right side is a value you type (Type Value), or another field to compare with (Field), a calculated field, or an aggregation.
Conditions joined with AND must all match. OR starts another group, and the rule matches when any group matches.
Fields by rule type
Every rule type can use the fields in the groups below. Some fields exist only after the card network responds, so only rules that run after authorization can use them:
| Rule type | When it runs | Extra fields |
|---|---|---|
| Routing, Configuration, Configuration Overrides | Before authorization, to choose where and how to process the payment | None |
| Payment | Before authorization | None |
| Cancel | After authorization, before capture | Authorization results and Matched payment rule |
| Review | After the payment completes | Authorization results and Matched payment rule |
| Action | After the payment completes | Matched payment rule |
Payment, cancel, review, and action rules apply to card payments, including saved cards, Apple Pay, Google Pay, and network tokens. On payouts, payment rules can only block or allow. Routing and Configuration Overrides rules apply to the payment method you choose in the rule.
Card info
The card fields come from the card number's BIN, the first digits that identify the issuer:
| Field | What it evaluates |
|---|---|
| Card BIN | The first 6 digits of the card number. |
| Card brand | The card network, such as Visa or Mastercard. |
| Card country | The country of the bank that issued the card. |
| Card funding | Whether the card is credit, debit, or prepaid. |
| Card category | The card's category, such as consumer or business. |
| Issuer name, Card issuer name | The name of the bank that issued the card. |
| Card token | The card's token, which is the same for every payment with that card on your account. |
Customer info
The customer fields come from source_data.billing_details, the shipping
details, or the customer object:
| Field | What it evaluates |
|---|---|
| The customer's email address. | |
| First name, Last name | The customer's first and last names. |
| Phone | The customer's phone number. |
| Customer Reference ID | The customer_reference_id you send. |
| Is Disposable Email | Whether the email's domain is a known disposable email service. Pay.com refreshes the list of these domains every day. |
| Customer Name Similarity Score | How similar the customer's first and last name are to the name on the card, from 0 (different) to 100 (the same). It has no value if either name is missing. |
Payment details
These fields describe the payment request:
| Field | What it evaluates |
|---|---|
| Amount (in Processing currency) | The amount in the payment's currency, in major units, such as 25.50 for $25.50. |
| Amount (in USD) | The amount converted to US dollars, in major units. |
| Currency | The payment's currency. |
| Transaction Type | Charge, Hold, Refund, Payout, or Payment Method. |
| Digital Wallet | ApplePay, GooglePay, Click to Pay, or GooglePay (PAN_ONLY). A card used without a wallet matches is not in any of them. |
| Payment Channel | Checkout for a payment session, or Payment Link. |
| User agent | The customer's browser, from authentication_context.browser_details.user_agent. |
| API Key | The API key that created the payment. |
Cancel and review rules can also read the results the card network returns:
| Field | What it evaluates |
|---|---|
| AVS - Address Line 1 Result, AVS - Address Postal code Result | The address verification results for the street address and postal code. |
| CVC Result | The CVV check result. |
| 3DS Result | The result of 3D Secure authentication. |
| 3DS Authentication Flow | Whether 3D Secure was frictionless or needed a challenge. |
| Name verification - Status | Whether Account Name Inquiry ran. |
| Name verification - Result (Full name) | The Account Name Inquiry result for the full name. |
Address
The address fields come from the billing and shipping details:
| Field | What it evaluates |
|---|---|
| Cardholder billing country | The country in billing_details.address. |
| Cardholder billing state | The state in billing_details.address. |
| Cardholder shipping country | The country of the shipping address. |
IP address
The IP fields come from authentication_context.customer_ip_address. For
server-to-server payments, send it on every request.
| Field | What it evaluates |
|---|---|
| IP address | The customer's IP address. |
| IP country-level geolocation | The country of the IP address. |
| IP - US state/region-level geolocation, IP - AU state/region-level geolocation, IP - CA state/region-level geolocation | The state or region of the IP address, in the US, Australia, or Canada. |
| Is Anonymous IP | Whether the IP address belongs to an anonymizing proxy. Needs advanced fraud screening. |
Risk score and flags
These fields come from advanced fraud screening, so a rule that uses them runs after the payment is screened:
| Field | What it evaluates |
|---|---|
| Risk Score | The fraud score, from 0 to 100. |
| Is Free Email Provider | Whether the email comes from a free email provider. |
| Matched payment rule | The payment rules that matched this payment earlier. Only cancel, review, and action rules have it. |
Metadata
The metadata fields read one key at a time. Their values are compared as text.
| Field | What it evaluates |
|---|---|
| Metadata | A key in the payment's metadata. |
| Payment Method Metadata | A key in the metadata of the payment method. |
To compare a key as a number, a date, a yes or no value, or a set of options, define it as a merchant context field. It then appears under Merchant Context with its own type.
General
These fields describe recurring payments and split traffic:
| Field | What it evaluates |
|---|---|
| Is Recurring | Whether the payment is a merchant-initiated payment after the first in a series. |
| Recurring Sequence | Where the payment is in a recurring series. |
| % Split (1-100) | A number from 1 to 100 that Pay.com assigns to each payment. Use it to send a share of payments down one path, for example is less than or equal 20 for 20%. |
Past payments
To evaluate past payments, such as the declines on the same card in the last hour or the cards used from one IP address today, use a Custom Aggregation or a saved Aggregated Field in the condition. You choose which past payments count, the time period, and what to count, sum, or list. To combine numbers, such as declines divided by approvals, use a Calculated Field. See Aggregations and Calculated fields.
Merchant context fields
Fields you define in Settings → Product Settings → Rule Inputs appear under Merchant Context, with the type you gave them. See Rule inputs.
Operators
The operators you can pick depend on the field's type:
| Operator | Matches when |
|---|---|
| equals, does not equal | The value is, or isn't, exactly the value you set. Text comparisons are case-sensitive. |
| is in, is not in | The value is, or isn't, one of the values you list. |
| is in list, is not in list | The value is, or isn't, in a risk list. |
| is in aggregation, is not in aggregation | The value is, or isn't, among the values a List Unique aggregation returns. |
| contains, does not contain | Text includes, or doesn't include, the value. |
| starts with, does not start with, ends with, does not end with | Text starts or ends with the value. Case-sensitive. |
| regex | Text matches a JavaScript regular expression. Case-sensitive unless you add the i flag, as in /^test/i. |
| is less than, is greater than, is less than or equal, is greater than or equal | A number compares with the value. |
| is before, is after, is on or before, is on or after | A date compares with the value. |
| exists | With its switch on, the field has a value. With the switch off, the field has no value. 0 and false count as no value. |
Operators by field type
Each field type supports a fixed subset of operators:
| Field type | Operators |
|---|---|
| Text | equals, does not equal, contains, does not contain, starts with, does not start with, ends with, does not end with, regex, is in, is not in, exists |
| Number | equals, does not equal, is in, is not in, is less than, is greater than, is less than or equal, is greater than or equal |
| Country, currency, settlement account, API key, or a set of options | equals, does not equal, is in, is not in, exists |
| Yes or no | equals |
| Date | is before, is after, is on or before, is on or after |
| Matched payment rule | is in, is not in |
is in list and is not in list are offered for every type except yes or no, dates, and Matched payment rule, when you have a list of a matching type. is in aggregation and is not in aggregation appear once your account has a saved List Unique aggregation. See Match a list of past values.
How values are compared
All rule conditions follow these evaluation behaviors:
- Empty fields never match. If the payment has no value for the field, the condition doesn't match, regardless of the operator, including does not equal and is not in. The one exception is exists with its switch off, which matches payments that have no value for the field.
- Text is case-sensitive.
Johndoesn't equaljohn. Use regex with theiflag to ignore case. - Amounts are in major units. Write
100for $100.00, not10000. - Numbers compare as numbers when you type a number, so
100equals an amount of100.00.
Examples
These conditions answer common questions:
| Goal | Conditions |
|---|---|
| Cards from one country, except one BIN | Card country equals BR AND Card BIN does not equal 412345 |
| IP address in another country than the card | IP country-level geolocation does not equal the Field Card country |
| Skip Apple Pay and Google Pay | Digital Wallet is not in ApplePay, GooglePay |
| A large amount on a card that was already declined today | Amount (in USD) is greater than 500 AND a Custom Aggregation, Count of Declines for the same Payment method (Card) since the start of the day, is greater than or equal 1 |
| A key you send in metadata | Metadata affiliate_id equals partner_42 |
Next steps
- Aggregations: Count, sum, and list past payments in a condition.
- Calculated fields: Combine number fields and aggregations with arithmetic.
- Rule inputs: Define typed metadata fields and saved aggregations.
- Risk lists: Match a condition against a list of values.
- Payment rules: Block payments or require 3D Secure.