
Conditions Utility
Using the Conditions Utility
Depending on your business requirements you might want to route payments in EUR down one path, and payments in USD down another. You can also create multiple routes based on other available data, from payment status down to individual e-mail addresses if you would want to. The Conditions Utility enables you to create all these conditions. Conditions are used to evaluate if a certain path should be followed during the execution of the workflow. They are based on selecting a field (for example:Currency), an operator (for example: equals), and a value (for example: EUR).
Available fields
Available fields for any condition depend on the Outputs from previous blocks. A condition can use information from any block upstream, like the amount and currency for a payment, or a link to a created ticket with Freshdesk.
Outputs
Available operators
The available operators to evaluate a condition depend on the data type of the field. For some data types and operators a setting to either use a case-sensitive or a not case-sensitive comparison is available too. Supported operators are:
Operators
Assign values
Values for the condition can either be entered manually (like e-mails) or select from a list of available values (like currencies or payment states), dependent on the data type of the selected field. We also support comparing values to build routes comparing different fields, like issuing country with order country, or billing address zip code and shipping address zip code.
Dropdown
Using metadata for routing
One special type of conditions is based on unstructured data sent in via themetadata field attached to the Client Session when creating a payment. This field is used to send additional information with the payment outside of the available fields from the Payments API. This can also be used to attach information to create routes on, like custom risk scores or customer account status.
When using metadata for routing, make sure to specify the full path like in the example here.
JS

Metadata
Condition evaluation
All conditions are evaluated together (AND) by default, meaning that if there are three conditions set up, like Amount>100, Currency=EUR, Payment Type=UNSCHEDULED, then all three need to be fulfilled for the path to be followed during workflow execution.

Grouped Conditions
OR evaluation. In this example, a blocking route is created evaluating if a payment uses certain e-mail addresses or if a custom flag with the value “BLOCK” is sent in.

Using OR
(A AND B) OR (C) OR (D AND E) OR (F AND G AND H).
It is not possible to nest these groups further, but the ability to use trigger conditions, multiple condition builders, and multiple routes already gives you a lot of opportunity for complex branching.
Conditions are evaluated top down
Creating multiple sets of conditions is a great way to branch a workflow into multiple routes. Each block can have its own name, making it easier to keep track, as well as debug the workflow log. When multiple sets are used, they are evaluated from top to bottom. In this example, first the conditions within the email block will be checked and if they match, that path will be taken. Otherwise, the conditions within “recurring payments” will be checked, and so on until the “all other conditions” block at the bottom is reached.
Test Route
All other conditions
When the Conditions Utility is used within a workflow, then a fallback condition called “all other conditions” is always at the bottom. This could be used as anelse path, creating a route that is set up more generic than the specialized routes above, or could also be left empty. If left empty and the Workflow Run reaches this condition, the workflow will still end with as the workflow ended without a failure.
Duplicate a route
If you have to set up multiple similar routes where only some of the inputs change (like different processors for different markets) then you can use the menu within the condition block to duplicate the route. A new copy will be created below the original, retaining all conditions and assigned blocks.
Duplicate conditions
Trigger Conditions define when to start a workflow
It is perfectly valid to have more than one published workflows based on the same trigger. However, if you want to start each workflow only in very specific cases, be sure to set up the Trigger accordingly. If an event is sent that would trigger a workflow, but the conditions prevent that workflow from being started, then the workflow will neither run nor create a record in the Runs section, because the conditions do not apply.
Trigger Conditions