• Credit

    US flag
  • Credit

    US flag

Create Policies


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

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 with attrVal parameter. Example: super-card.txn-type for grouping transactions based on transaction type.

  • attrVal : Value according to the key mentioned in attrKey. 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.

cURL Sample
Switch Theme
Expand More
Copy
curl --location --request POST 'https://fusion.preprod.zeta.in/api/v1/ifi/140827/accountHolders/a327ef7c-79f2-49d2-b931-d5c5a559a6bf/transactionCategories' \
--header 'Content-Type: application/json' \
--header 'X-Zeta-AuthToken: {{token}}' \
--data-raw '{
    "ifi": 140827,
    "code": "POS_1112",
    "description": "POS Group for 1112",
    "transactionAttributes": [
        {
            "attrKey": "super-card.txn-type",
            "attrVal": "POS",
            "txnCategoryComparator": "EQUALS"
        },
        {
            "attrKey": "super-card.card-id",
            "attrVal": "1112",
            "txnCategoryComparator": "CONTAINS"
        }
    ]
}'
Code Copied
JSON Sample
Switch Theme
Expand More
Copy
{
  "attrs": [
    {
      "attrKey": "string",
      "attrVal": "string",
      "code": "string",
      "id": 0,
      "txnCategoryComparator": "EQUALS"
    }
  ],
  "code": "string",
  "desc": "string",
  "headers": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  }
}
Code Copied

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.

The response returns a unique identifier for the policy created, id.

cURL Sample
Switch Theme
Expand More
Copy
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”
}
Code Copied
JSON Sample
Switch Theme
Expand More
Copy
{
"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
}
]
}
Code Copied

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.

cURL Sample
Switch Theme
Expand More
Copy
curl -X GET \
'https://{{fusionbaseurl}}/api/v1/ifi/140827/accountHolders/d43d7095-c6f5-4ab8-a708-c2b1f62bd42c/transactionPolicies/653567603216923887' \
Code Copied
JSON Sample
Switch Theme
Expand More
Copy
{
"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": {}
}
Code Copied

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:

cURL Sample
Switch Theme
Expand More
Copy
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"
}
]
}'
Code Copied
JSON Sample
Switch Theme
Expand More
Copy
{
"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
}
]
}
Code Copied

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:

cURL Sample
Switch Theme
Expand More
Copy
curl -X PATCH \
'https://{{fusionbaseurl}}/api/v1/ifi/140827/accountHolders/d43d7095-c6f5-4ab8-a708-c2b1f62bd42c/transactionPolicies/653567603216923887/DISABLED' \
Code Copied
JSON Sample
Switch Theme
Expand More
Copy
{
  "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
    }
  ]
}
Code Copied


Related articles