- Created by user-5c3b0, last modified by user-8f2bd on Jul 20, 2020
Fusion supports creation of complex policies to govern transactions based on various factors like velocity, volume, time and balance. Creating transaction policies involves the following steps:
- Create transaction category
- Create transaction policy
- Get transaction policy
- Replace transaction policy
- Update transaction policy state
Create transaction category
Transactions on which policies are applied must be grouped before the actual policy is created and mapped. This is done by creating a Transaction Category and specifying the grouping criteria.
Use \transactionCategory
endpoint to create a Transaction Category and provide values for the following parameters:
code
: Unique alphanumeric ID for the Transaction Category.attrKey
: System generated key that defines the grouping criteria. Used in conjunction withattrVal
parameter. Example: super-card.txn-type for grouping transactions based on transaction type.
attrVal
: Value according to the key mentioned inattrKey
. Example: ECOM for e-commerce transaction category.
txnCategoryComparator
: Transaction Category comparator. Supported values:- EQUALS: Exact match; CONTAINS: sub-string match.
In this example, we create and assign a Transaction Category for an Account Holder, based on the following criteria:
- All payments made by the Account Holder at POS terminals, and
- All cards held by the Account Holder containing the digits 1112.
The response returns a unique identifier, id
, for each of the above criteria.
Request
Response
curl --location --request POST 'https://fusion.preprod.zeta.in/api/v1/ifi/140827/transactionCategories' \ --header 'Content-Type: application/json' \ --header 'X-Zeta-AuthToken: eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwidGFnIjoiNFZqbVdZMVVWT2VXSDVqa3pJaExRdyIsImFsZyI6IkExMjhHQ01LVyIsIml2IjoiUWdudjBMcEZQVHlYb1BnOCJ9.7eWR8oF0Wmo67dwxOzHqkZxeNQNd1qkpIPTjgqxhZGY.8e_lpOb2zpRSSWRIGIW-lA.r0y6nhnkIZooY7QSydf7uqZ3br-NjId_JaseOMiOqOqpnvHlSu1kRdv6QT9LXIfhvYjVmKtEz7c09i1IvuOvvIwitaaZqdJlDYSfvIy52Tp4rxmA-E1WtqpcuqdFpHraedydnJhejMTHLEl5Uq2p8D_xtWm6EnmaKNF4qu9htEdQZVavEOQyrBRpt7ovqrqXh0r3dp-aalzikQz99sDI1n0EB_6zPYYxrxCFKkGc-tXx8adPuTTe3l5N3b6TNa-6zNdOTv3jn0ijsT-Eu__Lpgm5sadlzVuLvioZqjOWllAgyrczD0jzvwVik9k6FR7GQKjMcZRX2RoqVaT4VcxTJMlZ4sQvIScl4PEgitdLKvQq-2NxGLhOxg11NXs_VLMa.YP640tJj9vcmCotw8liTBA' \ --data-raw '{ "ifiID": 140827, "code": "POLIN00000001", "description": "Test category", "transactionCategoryAttributes": [ { "attrKey": "super-card.txn-type", "attrVal": "ATM", "txnCategoryComparator": "EQUALS" } ] }'
{ "attrs": [ { "attrKey": "string", "attrVal": "string", "code": "string", "id": 0, "txnCategoryComparator": "EQUALS" } ], "code": "string", "desc": "string", "headers": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" } }
Create transaction policy
Idempotency for creating a policy is based on the combination of IFI and transaction category configured for the said IFI. If you try to create a transaction policy for an already existing combination, Fusion system will throw an exception.
Use \transactionPolicies
endpoint to create a transaction policy and provide values for following basic parameters:
policyViolationAction
: Action to be taken on the transaction when constraints specified in the policy are violated. Supported values—DECLINE, NOTIFY, DECLINE_AND_NOTIFY.action
: Type of transaction for which the policy and the transaction constraints should apply. Allowed values —DEBIT, CREDIT.allowedTransactionCategoryCodes
: MCC codes or transaction category codes as defined while creating transaction categories.disallowedTransactionCategoryCodes
: Similar to allowed transaction category codes but does the reverse. That is, it applies when the transaction code is not present in disallowedTransactionCategoryCodes.allowedTimeSlices
: Time period when the Transaction policy should apply, in crontab format. Example: To create a policy that should be applicable from 6 am—10 am and 6 pm—10 pm use * 6-10,18-22 * * *disallowedTimeSlices
: Time period when the policy should not apply.errorCode
: Error code, user-defined or system, thrown when transaction constraints in the policy are violated.
Transaction Policies can be created at different entity levels like Product, Product Family, Program, Program Family and Account Holder.
In this example, we create a transaction policy for an Account Holder with the following constraints:
- The policy applies only on payments made on e-commerce websites.
- Any payment exceeding INR 10,00,000 will be declined, and violation will be notified.
- Payment is allowed only in the time period of 7 am-11 pm.
The response returns a unique identifier for the policy created, id.
Request
Response
curl -X POST \ 'http://{{fusionbaseurl}}/api/v2/ifi/140827/transactionPolicies' \ -H 'Content-Type: application/json' \ -d '{ "accountsApplicableTo": { "account.pf-id" : "558731570586644109" }, "aggregateRules": [ { "action": "DEBIT", "transactionCategoryCode": "*", "aggExpressionCode": "8", "dailyLimit": 100, "weeklyLimit": 0, "monthlyLimit": 0, "quarterlyLimit": 0, "yearlyLimit": 0, "errorCode": "GENERIC_ERROR", "type": "VELOCITY" } ], "attributes": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "balanceRules": [ { "action": "DEBIT", "minRequiredBalanceAfter": 0, "maxAllowedBalanceAfter": 100000, "minRequiredBalanceBefore": 0, "maxAllowedBalanceBefore": 10000000, "transactionCategoryCode": "string", "errorCode": "GENERIC_ERROR" } ], "coaID": 3071036307140878880, "code": "POLIN0012345", "description": "string", "effectiveFrom": "2019-02-18T06:24:14.000Z", "expiresAt": "2022-02-18T06:24:14.000Z", "scope": "AGGREGATE_OF_ALL_ACCOUNTS_OF_ACCOUNT_HOLDER or EACH_ACCOUNT_OF_ACCOUNT_HOLDER", "transactionConstraints": [ { "action": "DEBIT", "allowedTransactionCategoryCodes": [ "*" ], "disallowedTransactionCategoryCodes": [ ], "allowedTimeSlices": [ ], "disallowedTimeSlices": [ ], "errorCode": "GENERIC_ERROR" } ], "transactionRules": [ { "action": "DEBIT", "transactionCategoryCode": "*", "minRequiredAmount": 0, "maxAllowedAmount": 10, "errorCode": "GENERIC_ERROR" } ], "violationAction": "DECLINE" }'
{ "accountHolderID": "aa267641-f475-4acb-859e-bb9c60d3e9db", "aggregateRules": [ { "action": "DEBIT", "aggExpressionCode": "string", "dailyLimit": 0, "errorCode": "string", "monthlyLimit": 0, "quarterlyLimit": 0, "transactionCategoryCode": "string", "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ], "attributes": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "balanceLimits": [ { "action": "DEBIT", "errorCode": "string", "id": 0, "maxAllowedBalance": 0, "maxAllowedBalanceBeforeTxn": 0, "minRequiredBalance": 0, "minRequiredBalanceBeforeTxn": 0, "policyVersionID": 0, "transactionCategory": "string" } ], "balanceRules": [ { "action": "DEBIT", "errorCode": "string", "maxAllowedBalanceAfter": 0, "maxAllowedBalanceBefore": 0, "minRequiredBalanceAfter": 0, "minRequiredBalanceBefore": 0, "transactionCategoryCode": "string" } ], "coaID": "POLIN0012345", "code": "string", "createdAt": "2020-02-18T06:24:14.000Z", "description": "string", "effectiveFrom": "2020-02-18T06:24:14.000Z", "expiresAt": "2020-02-18T06:24:14.000Z", "headers": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "id": 0, "ifiID": 123123, "ifiId": 0, "policyViolationAction": "DECLINE_AND_NOTIFY", "scope": "AGGREGATE_OF_ALL_ACCOUNTS_OF_ACCOUNT_HOLDER or EACH_ACCOUNT_OF_ACCOUNT_HOLDER", "state": "ENABLED or DISABLED", "status": "ENABLED", "transactionConstraints": [ { "action": "DEBIT", "allowedTimeSlices": [ "string" ], "allowedTransactionCategoryCodes": [ "string" ], "disallowedTimeSlices": [ "string" ], "disallowedTransactionCategoryCodes": [ "string" ], "errorCode": "string" } ], "transactionRules": [ { "action": "DEBIT", "errorCode": "string", "maxAllowedAmount": 0, "minRequiredAmount": 0, "transactionCategoryCode": "string" } ], "txnConstraints": [ { "action": "DEBIT", "allowedTimeSlices": [ "string" ], "allowedTxnCategoryCodes": [ "string" ], "disallowedTimeSlices": [ "string" ], "disallowedTxnCategoryCodes": [ "string" ], "errorCode": "string", "id": 0, "policyVersionID": 0 } ], "txnLimits": [ { "action": "DEBIT", "categoryCode": "string", "errorCode": "string", "id": 0, "maxAllowedAmount": 0, "minRequiredAmount": 0, "policyVersionID": 0 } ], "updatedAt": "2020-02-18T06:24:14.000Z", "validFrom": 0, "validUntil": 0, "velocityLimits": [ { "action": "DEBIT", "aggExpressionCode": "string", "aggExpressionID": 0, "categoryCode": "string", "dailyLimit": 0, "errorCode": "string", "id": 0, "monthlyLimit": 0, "policyVersionID": 0, "quarterlyLimit": 0, "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ], "violationAction": "DECLINE, NOTIFY, DECLINE_AND_NOTIFY", "volumeLimits": [ { "action": "DEBIT", "aggExpressionCode": "string", "aggExpressionID": 0, "categoryCode": "string", "dailyLimit": 0, "errorCode": "string", "id": 0, "monthlyLimit": 0, "policyVersionID": 0, "quarterlyLimit": 0, "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ] }
Get transaction policy
Retrieve transaction policy details like category code, constrains, limits and validity mapped to any entity, using the /{entity}/{entityID}/transactionPolicies/{policyID}\
endpoint.
In the following example, we fetch the details of the transaction policy created for e-commerce transactions for the Account Holder.
Request
Response
curl -X GET \ 'https://{{fusionbaseurl}}/api/v1/ifi/140827/accountHolders/d43d7095-c6f5-4ab8-a708-c2b1f62bd42c/transactionPolicies/653567603216923887' \
{ "id": "05a12e14-2d94-4a2a-bee2-493f4230622c", "ifiId": 140827, "code": "eCOM Transactions", "status": "ENABLED", "description": "Enable eCOM Transaction with limit", "attributes": {}, "validFrom": 1584209741088, "validUntil": 1741976141088, "policyViolationAction": "DECLINE_AND_NOTIFY", "txnConstraints": [ { "id": 274, "policyVersionID": 4848132788987861828, "action": "DEBIT", "allowedTxnCategoryCodes": [ "ECOM_1112" ], "disallowedTxnCategoryCodes": [], "allowedTimeSlices": [], "disallowedTimeSlices": [], "errorCode": "GENERIC_ERROR" } ], "txnLimits": [ { "id": 4845, "policyVersionID": 4848132788987861828, "action": "DEBIT", "categoryCode": "ECOM_1112", "minRequiredAmount": 0, "maxAllowedAmount": 2000000, "errorCode": "GENERIC_ERROR" } ], "balanceLimits": [], "volumeLimits": [], "velocityLimits": [], "createdAt": 1584209741156, "updatedAt": 1584209741156, "headers": {} }
Replace transaction policy
A Transaction Policy can be replaced by mentioning the transactionPolicyID
as a query parameter. Use /transactionPolicies/{transactionPolicyID}
endpoint to replace the policy.
In the following example, we replace the transaction policy created for e-commerce transactions:
Request
Response
curl -X PUT \ 'https://{{fusionbaseurl}}/api/v1/ifi/140827/accountHolders/d43d7095-c6f5-4ab8-a708-c2b1f62bd42c/transactionPolicies/653567603216923887' \ -H 'Content-Type: application/json' \ -d '{ "aggregateRules": [ { "action": "DEBIT", "transactionCategoryCode": "*", "aggExpressionCode": "8", "dailyLimit": 10, "weeklyLimit": 0, "monthlyLimit": 0, "quarterlyLimit": 0, "yearlyLimit": 0, "errorCode": "GENERIC_ERROR", "type": "VELOCITY" } ], "attributes": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "balanceRules": [ { "action": "DEBIT", "minRequiredBalanceAfter": 0, "maxAllowedBalanceAfter": 100000, "minRequiredBalanceBefore": 0, "maxAllowedBalanceBefore": 100, "transactionCategoryCode": "string", "errorCode": "GENERIC_ERROR" } ], "description": "TestPolicy", "effectiveFrom": "2020-02-18T06:24:14.000Z", "expiresAt": "2030-02-18T06:24:14.000Z", "policyViolationAction": "DECLINE", "transactionConstraints": [ { "action": "DEBIT", "allowedTransactionCategoryCodes": [ "*" ], "disallowedTransactionCategoryCodes": [ ], "allowedTimeSlices": [ ], "disallowedTimeSlices": [ ], "errorCode": "GENERIC_ERROR" } ], "transactionRules": [ { "action": "DEBIT", "transactionCategoryCode": "*", "minRequiredAmount": 0, "maxAllowedAmount": 100, "errorCode": "GENERIC_ERROR" } ] }'
{ "accountHolderID": "aa267641-f475-4acb-859e-bb9c60d3e9db", "aggregateRules": [ { "action": "DEBIT", "aggExpressionCode": "string", "dailyLimit": 0, "errorCode": "string", "monthlyLimit": 0, "quarterlyLimit": 0, "transactionCategoryCode": "string", "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ], "attributes": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "balanceLimits": [ { "action": "DEBIT", "errorCode": "string", "id": 0, "maxAllowedBalance": 0, "maxAllowedBalanceBeforeTxn": 0, "minRequiredBalance": 0, "minRequiredBalanceBeforeTxn": 0, "policyVersionID": 0, "transactionCategory": "string" } ], "balanceRules": [ { "action": "DEBIT", "errorCode": "string", "maxAllowedBalanceAfter": 0, "maxAllowedBalanceBefore": 0, "minRequiredBalanceAfter": 0, "minRequiredBalanceBefore": 0, "transactionCategoryCode": "string" } ], "coaID": "POLIN0012345", "code": "string", "createdAt": "2020-02-18T06:24:14.000Z", "description": "string", "effectiveFrom": "2020-02-18T06:24:14.000Z", "expiresAt": "2020-02-18T06:24:14.000Z", "headers": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "id": 0, "ifiID": 123123, "ifiId": 0, "policyViolationAction": "DECLINE_AND_NOTIFY", "scope": "AGGREGATE_OF_ALL_ACCOUNTS_OF_ACCOUNT_HOLDER or EACH_ACCOUNT_OF_ACCOUNT_HOLDER", "state": "ENABLED or DISABLED", "status": "ENABLED", "transactionConstraints": [ { "action": "DEBIT", "allowedTimeSlices": [ "string" ], "allowedTransactionCategoryCodes": [ "string" ], "disallowedTimeSlices": [ "string" ], "disallowedTransactionCategoryCodes": [ "string" ], "errorCode": "string" } ], "transactionRules": [ { "action": "DEBIT", "errorCode": "string", "maxAllowedAmount": 0, "minRequiredAmount": 0, "transactionCategoryCode": "string" } ], "txnConstraints": [ { "action": "DEBIT", "allowedTimeSlices": [ "string" ], "allowedTxnCategoryCodes": [ "string" ], "disallowedTimeSlices": [ "string" ], "disallowedTxnCategoryCodes": [ "string" ], "errorCode": "string", "id": 0, "policyVersionID": 0 } ], "txnLimits": [ { "action": "DEBIT", "categoryCode": "string", "errorCode": "string", "id": 0, "maxAllowedAmount": 0, "minRequiredAmount": 0, "policyVersionID": 0 } ], "updatedAt": "2020-02-18T06:24:14.000Z", "validFrom": 0, "validUntil": 0, "velocityLimits": [ { "action": "DEBIT", "aggExpressionCode": "string", "aggExpressionID": 0, "categoryCode": "string", "dailyLimit": 0, "errorCode": "string", "id": 0, "monthlyLimit": 0, "policyVersionID": 0, "quarterlyLimit": 0, "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ], "violationAction": "DECLINE, NOTIFY, DECLINE_AND_NOTIFY", "volumeLimits": [ { "action": "DEBIT", "aggExpressionCode": "string", "aggExpressionID": 0, "categoryCode": "string", "dailyLimit": 0, "errorCode": "string", "id": 0, "monthlyLimit": 0, "policyVersionID": 0, "quarterlyLimit": 0, "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ] }
Update transaction policy state
A Transaction Policy can be enabled or disabled by changing its policy state.
Use /transactionPolicies/enabled
and /transactionPolicies/disabled
to enable and disable the policy respectively using the policy ID.
In the following example, we disable the transaction policy created for e-commerce transactions:
Request
Response
curl -X PATCH \ 'https://{{fusionbaseurl}}/api/v1/ifi/140827/accountHolders/d43d7095-c6f5-4ab8-a708-c2b1f62bd42c/transactionPolicies/653567603216923887/DISABLED' \
{ "accountHolderID": "aa267641-f475-4acb-859e-bb9c60d3e9db", "aggregateRules": [ { "action": "DEBIT", "aggExpressionCode": "string", "dailyLimit": 0, "errorCode": "string", "monthlyLimit": 0, "quarterlyLimit": 0, "transactionCategoryCode": "string", "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ], "attributes": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "balanceLimits": [ { "action": "DEBIT", "errorCode": "string", "id": 0, "maxAllowedBalance": 0, "maxAllowedBalanceBeforeTxn": 0, "minRequiredBalance": 0, "minRequiredBalanceBeforeTxn": 0, "policyVersionID": 0, "transactionCategory": "string" } ], "balanceRules": [ { "action": "DEBIT", "errorCode": "string", "maxAllowedBalanceAfter": 0, "maxAllowedBalanceBefore": 0, "minRequiredBalanceAfter": 0, "minRequiredBalanceBefore": 0, "transactionCategoryCode": "string" } ], "coaID": "POLIN0012345", "code": "string", "createdAt": "2020-02-18T06:24:14.000Z", "description": "string", "effectiveFrom": "2020-02-18T06:24:14.000Z", "expiresAt": "2020-02-18T06:24:14.000Z", "headers": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "id": 0, "ifiID": 123123, "ifiId": 0, "policyViolationAction": "DECLINE_AND_NOTIFY", "scope": "AGGREGATE_OF_ALL_ACCOUNTS_OF_ACCOUNT_HOLDER or EACH_ACCOUNT_OF_ACCOUNT_HOLDER", "state": "ENABLED or DISABLED", "status": "ENABLED", "transactionConstraints": [ { "action": "DEBIT", "allowedTimeSlices": [ "string" ], "allowedTransactionCategoryCodes": [ "string" ], "disallowedTimeSlices": [ "string" ], "disallowedTransactionCategoryCodes": [ "string" ], "errorCode": "string" } ], "transactionRules": [ { "action": "DEBIT", "errorCode": "string", "maxAllowedAmount": 0, "minRequiredAmount": 0, "transactionCategoryCode": "string" } ], "txnConstraints": [ { "action": "DEBIT", "allowedTimeSlices": [ "string" ], "allowedTxnCategoryCodes": [ "string" ], "disallowedTimeSlices": [ "string" ], "disallowedTxnCategoryCodes": [ "string" ], "errorCode": "string", "id": 0, "policyVersionID": 0 } ], "txnLimits": [ { "action": "DEBIT", "categoryCode": "string", "errorCode": "string", "id": 0, "maxAllowedAmount": 0, "minRequiredAmount": 0, "policyVersionID": 0 } ], "updatedAt": "2020-02-18T06:24:14.000Z", "validFrom": 0, "validUntil": 0, "velocityLimits": [ { "action": "DEBIT", "aggExpressionCode": "string", "aggExpressionID": 0, "categoryCode": "string", "dailyLimit": 0, "errorCode": "string", "id": 0, "monthlyLimit": 0, "policyVersionID": 0, "quarterlyLimit": 0, "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ], "violationAction": "DECLINE, NOTIFY, DECLINE_AND_NOTIFY", "volumeLimits": [ { "action": "DEBIT", "aggExpressionCode": "string", "aggExpressionID": 0, "categoryCode": "string", "dailyLimit": 0, "errorCode": "string", "id": 0, "monthlyLimit": 0, "policyVersionID": 0, "quarterlyLimit": 0, "type": "VELOCITY", "weeklyLimit": 0, "yearlyLimit": 0 } ] }
- No labels