Skip to Content
Docs

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 typeWhen it runsExtra fields
Routing, Configuration, Configuration OverridesBefore authorization, to choose where and how to process the paymentNone
PaymentBefore authorizationNone
CancelAfter authorization, before captureAuthorization results and Matched payment rule
ReviewAfter the payment completesAuthorization results and Matched payment rule
ActionAfter the payment completesMatched 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:

FieldWhat it evaluates
Card BINThe first 6 digits of the card number.
Card brandThe card network, such as Visa or Mastercard.
Card countryThe country of the bank that issued the card.
Card fundingWhether the card is credit, debit, or prepaid.
Card categoryThe card's category, such as consumer or business.
Issuer name, Card issuer nameThe name of the bank that issued the card.
Card tokenThe 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:

FieldWhat it evaluates
EmailThe customer's email address.
First name, Last nameThe customer's first and last names.
PhoneThe customer's phone number.
Customer Reference IDThe customer_reference_id you send.
Is Disposable EmailWhether the email's domain is a known disposable email service. Pay.com refreshes the list of these domains every day.
Customer Name Similarity ScoreHow 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:

FieldWhat 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.
CurrencyThe payment's currency.
Transaction TypeCharge, Hold, Refund, Payout, or Payment Method.
Digital WalletApplePay, GooglePay, Click to Pay, or GooglePay (PAN_ONLY). A card used without a wallet matches is not in any of them.
Payment ChannelCheckout for a payment session, or Payment Link.
User agentThe customer's browser, from authentication_context.browser_details.user_agent.
API KeyThe API key that created the payment.

Cancel and review rules can also read the results the card network returns:

FieldWhat it evaluates
AVS - Address Line 1 Result, AVS - Address Postal code ResultThe address verification results for the street address and postal code.
CVC ResultThe CVV check result.
3DS ResultThe result of 3D Secure authentication.
3DS Authentication FlowWhether 3D Secure was frictionless or needed a challenge.
Name verification - StatusWhether 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:

FieldWhat it evaluates
Cardholder billing countryThe country in billing_details.address.
Cardholder billing stateThe state in billing_details.address.
Cardholder shipping countryThe 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.

FieldWhat it evaluates
IP addressThe customer's IP address.
IP country-level geolocationThe country of the IP address.
IP - US state/region-level geolocation, IP - AU state/region-level geolocation, IP - CA state/region-level geolocationThe state or region of the IP address, in the US, Australia, or Canada.
Is Anonymous IPWhether 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:

FieldWhat it evaluates
Risk ScoreThe fraud score, from 0 to 100.
Is Free Email ProviderWhether the email comes from a free email provider.
Matched payment ruleThe 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.

FieldWhat it evaluates
MetadataA key in the payment's metadata.
Payment Method MetadataA 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:

FieldWhat it evaluates
Is RecurringWhether the payment is a merchant-initiated payment after the first in a series.
Recurring SequenceWhere 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:

OperatorMatches when
equals, does not equalThe value is, or isn't, exactly the value you set. Text comparisons are case-sensitive.
is in, is not inThe value is, or isn't, one of the values you list.
is in list, is not in listThe value is, or isn't, in a risk list.
is in aggregation, is not in aggregationThe value is, or isn't, among the values a List Unique aggregation returns.
contains, does not containText includes, or doesn't include, the value.
starts with, does not start with, ends with, does not end withText starts or ends with the value. Case-sensitive.
regexText 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 equalA number compares with the value.
is before, is after, is on or before, is on or afterA date compares with the value.
existsWith its switch on, the field has a value. With the switch off, the field has no value. 0 and false count as no value.

The exists operator treats 0 and false as missing values. A numeric or boolean field with either value doesn't match exists with its switch on, and matches it with the switch off.

Operators by field type

Each field type supports a fixed subset of operators:

Field typeOperators
Textequals, 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
Numberequals, 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 optionsequals, does not equal, is in, is not in, exists
Yes or noequals
Dateis before, is after, is on or before, is on or after
Matched payment ruleis 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. John doesn't equal john. Use regex with the i flag to ignore case.
  • Amounts are in major units. Write 100 for $100.00, not 10000.
  • Numbers compare as numbers when you type a number, so 100 equals an amount of 100.00.

Examples

These conditions answer common questions:

GoalConditions
Cards from one country, except one BINCard country equals BR AND Card BIN does not equal 412345
IP address in another country than the cardIP country-level geolocation does not equal the Field Card country
Skip Apple Pay and Google PayDigital Wallet is not in ApplePay, GooglePay
A large amount on a card that was already declined todayAmount (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 metadataMetadata 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.
Was this page helpful?