Setting Up Rules

Introduction

Rules are set of IF conditions on various payment parameters that allow you to route payments based on your business use case. Each rule can have multiple conditions, joined by AND/OR, so as to give full width of customisation possible.

For eg. IF you want to route only HDFC Credit Cards transaction, you can create a rule similar to below.

IF Payment Mode is CREDIT CARD
AND
IF Bank is HDFC Bank
(see image below for reference)


Types of Rule Creation:

There are two types of logics/rule creation you will find on the dashboard.

1. Advanced Logic (Payment Parameter Based Rules)

Advanced Logic can be used when your business has specific payment requirements, based on various parameters such as payment method, bank, card networks, and more, which can be used to determine the most relevant payment gateway to handle a specific transaction.

For eg, you may want to send all UPI transactions through Cashfree and PayU, and want to ensure routing such that flowWise ensures the best gateway at that point in time.
Below screenshot shows how you can accomplish this.

There are various payment parameters to chose from, as you can see in the dropdown.

The full list of parameters and their use-case is given below:

Payment ParameterPossible ValuesUse Case
Order CurrencyINR, USDUseful in case you have customers who want to pay using USD currency based credit cards
Payment MethodsCredit Cards, Debit Cards, Prepaid Cards, Corporate Credit Cards, Netbanking, UPI, WalletsUseful when you want to define rules based on payment methods
Card SchemeVisa, MasterCard, Rupay, AmEx, DinersIf you accept card payments and want to define which card scheme payment goes to which gateway, this parameter is handy
AmountAny non-negative integerIf you use-case is such that you want to route a transaction greater than, less than or equal to a particular amount through a preferred gateway, this parameter is helpful
Card BINFirst six digits of a card, eg. rupay card bin (817442)This can come in handy when you may have a certain card BIN available for transcation on a particular gateway. You can add multiple card BINs, each separated by a comma to this rule
Issuing BankBank names vis-a-vis, ICICI, HDFC…This parameter can be used to decide on txns based on the issuing bank, say for netbanking or for cards. This parameter can be combined with other parameters to create more specific rules
eg. Payment Method IS netbanking
AND
Issuing Bank IS HDFC
Wallet ProviderPhonepe, AmazonPay, Mobikwik, Freecharge…etcRoute your transactions to a particular gateway based on wallet names. This can be particularly useful when you have certain wallets activated on a particular gateway but not others
UPI TypeCollect, IntentCollect is when customer enters vpa id onto the checkout and receives payment request on the PSP app
Intent is when you click on the payment app on checkout and the app is opened
GMVDaily, Weekly, MonthlyTotal transaction that can be routed through a given payment gateway or multiple payment gateways can also be set as a rule, where you can define how much volume of transaction in INR can go through particular gateway/s
Time of TransactionHourly, Daily, WeeklyYou can now set rules on transaction done at any point of time in a day, or any day in a week or month for routing transactions
Eg: route UPI transactions through PhonePe between 12 AM to 5 PM daily on Monday to Friday
Custom Identifiers (User-defined fields)udf1, udf2, udf3Apart from regular payment parameters, you might need to route payments to a particular gateway based on some business logic defined at your end, such as customer or product information. You can use custom fields for such requirements to pass the value to us while creating the order and use it to create an Advanced Logic

2. Simple Logic (Default Rule/Without payment parameters)

Simple, or Default Logic can be used for the below two use-cases:

  1. When the incoming transaction doesn’t satisfy any rule created in Advanced Logic, the transaction will fall-back to simple rule, and gateway/s defined in Simple Rule will be used for the transaction.
  2. When you do not have any specific use-case based on payment parameters defined in Advanced Logic (point 1), and you want to route all transactions through one or more gateways, based on just Routing Type.

🚧

Watchout

It is mandatory to set Simple Logic, even if you do/do not define Advanced Logic


Experience the all-new Cashfree Payments Docs! Faster, smarter, and easier to navigate. Check it out here!🎉