Expression syntax
The expressions used in rules follow a lean syntax inspired by spreadsheet formulas. Each expression is composed of, at minimum, a variable, an operation, and a value.
$merchant_id == "XYZ"
The expression above is true when the merchant ID equals "XYZ".
Variables
Every variable starts with $. The available variables depend on the event type being evaluated.
| Variable | Content | Type | Example |
|---|---|---|---|
$amount | Total payment amount | Decimal | 100.12 |
$card_bin | First 6 to 8 digits of the PAN (BIN/IIN) | Text | "44332211" |
$card_issuer_country | Card issuer country (ISO 3166-1 alpha-2) | Text | "BR" |
$device_fingerprint_id | Device fingerprint | Text | "xyz" |
$device_ip_address | Device IP address | IP address | "200.123.10.2" |
$device_user_agent | Device User-Agent | Text | "Mozilla/5.0" |
$merchant_id | Merchant ID | Text | "store-1234" |
$metadata_[key] | Metadata sent via API | Text | "value" |
$score | Risk score calculated by the platform (0.00 to 1.00) | Decimal | 0.75 |
$user_email_domain | User’s email domain | Text | "gmail.com" |
$user_id | User ID | Text | "customer-1234" |
$user_profiles | User’s payment profiles (available only with the count function) | Collection | N/A |
Operations
| Operation | Meaning |
|---|---|
== | Equality |
!= | Inequality |
> | Greater than |
>= | Greater than or equal to |
< | Less than |
<= | Less than or equal to |
in | Belongs to a collection |
not in | Does not belong to a collection |
Combining expressions
Use and and or to combine expressions, and parentheses to group precedence:
($amount > 1000 and $user_email_domain == "gmail.com") or $card_issuer_country != "BR"
Lists
Lists configured under Settings > Lists are available as collections. For example, to check whether a customer is on a quarantine list:
$user_id in @quarantined_customers