Stay organized with collections Save and categorize content based on your preferences.

View, add, and remove rule metadata values

This page describes how you can add and remove metadata values in rules. Rules allow you to prevent - or block - the processing of transactions that meet specified criteria. For example, you can use rules to block debit transactions originating from a specified mobile number.

Rule metadata allows you to specify the values that a rule accepts as criteria to block specific transactions. You can't create or modify rules or rule metadata, but you can add or remove metadata values for a rule.

When you add a set of metadata values to a rule, the rule blocks transactions that meet those criteria. For example, if you specify a list of mobile numbers as the metadata value for the BlockedMobNumReqPayDebitRule rule, then all debit transactions that originate from any of those mobile numbers are blocked.

When you remove a set of metadata values from a rule, the rule no longer blocks transactions that meet those criteria. So, if you remove a set of mobile numbers from the metadata value for the BlockedMobNumReqPayDebitRule rule, then all debit transactions that originate from any of those mobile numbers are no longer blocked.

Add rule metadata values

To add metadata values to a rule using the issuer switch API, use the BatchCreateRuleMetadataValues method [REST, gRPC]. In the request, specify the CreateRuleMetadataValueRequest object. This object allows you to specify the RuleMetadataValue object, which contains the specific values that you want the rule to consider as criteria for blocking transactions. If you want to add a single metadata value, provide a single value in RuleMetadataValue.

Metadata values can be of different types, such as bank account, mobile number, VPA, and so on. The length of the metadata value varies depending on the value type. For example, a mobile number is expected to be of length 12, while for a bank account number, the length can vary between 3 and 255.

Note: The issuer switch validates that the length of the metadata value is appropriate for the specified metadata value type. However, the issuer switch does not perform any additional validation on the values you provide in the request to add values to rule metadata. Any values you provide are compared as-is against incoming UPI requests and transactions are processed or blocked accordingly.

The following curl command adds the foo@okgoog and bar@okgoog values to the metadata of the BlockedVPAReqPayCreditRule rule:

  curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json; charset=utf-8" -d '
    {
      "requests": [
        {
          "ruleMetadataValue": {
            "value": "foo@okgoog",
          }
        },
        {
          "ruleMetadataValue": {
            "value": "bar@okgoog",
          }
        }
      ],
      "parent": "projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf"
    }
    ' "https://ISSUER_SWITCH_API_ENDPOINT/v1/projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values:batchCreate"

In this example:

  • PROJECT_ID is the ID of your Google Cloud project.
  • $TOKEN is your OAuth 2.0 access token.
  • ISSUER_SWITCH_API_ENDPOINT is your issuer switch API endpoint. For example, api.129a0b1a-bb73-4906-a5b7-a6e0bfe7860e.issuerswitch.goog.

Replace these with values specific to your environment.

When you run the command on a terminal, you see a response similar to the following:

  {
    "ruleMetadataValue": [
      {
        "name": "projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values/foo@okgoog",
        "value": "foo@okgoog"
      },
      {
        "name": "projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values/bar@okgoog",
        "value": "bar@okgoog"
      }
    ]
  }

View rule metadata values

To view the metadata values for a specified rule using the issuer switch API, use the ListRuleMetadataValues method [REST, gRPC].

The following curl command gets the rule metadata values of the BlockedVPAReqPayCreditRule rule:

  curl -X GET -H "Authorization: Bearer $TOKEN" "https://ISSUER_SWITCH_API_ENDPOINT/v1/projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values"

In this example:

  • PROJECT_ID is the ID of your Google Cloud project.
  • $TOKEN is your OAuth 2.0 access token.
  • ISSUER_SWITCH_API_ENDPOINT is your issuer switch's API endpoint. For example, api.129a0b1a-bb73-4906-a5b7-a6e0bfe7860e.issuerswitch.goog.

Replace these with values specific to your environment.

When you run this command, you see a response similar to the following:

  {
    "ruleMetadataValues": [
      {
        "name": "projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values/bar@okgoog",
        "value": "bar@okgoog"
      },
      {
        "name": "projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values/foo@okgoog",
        "value": "foo@okgoog"
      }
    ],
    "nextPageToken": ""
  }

In this example, the 7e2514ec-5080-46d1-a313-eaa2c3198ddf metadata of the BlockedVPAReqPayCreditRule rule has two values: bar@okgoog and foo@okgoog.

Remove rule metadata values

To remove metadata values from a rule using the issuer switch API, use the BatchDeleteRuleMetadataValues method [REST, gRPC]. In the request, specify the names of the RuleMetadataValue objects that you want to delete. If you want to remove a single metadata value, provide the name of a single RuleMetadataValue.

The following curl command deletes the foo@okgoog and bar@okgoog values form the metadata of the BlockedVPAReqPayCreditRule rule:

  curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json; charset=utf-8" \
    -d '
    {
      "names": [
        "projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values/foo@okgoog",
        "projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values/bar@okgoog"
      ],
      "parent": "projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf"
    }
    ' "https://ISSUER_SWITCH_API_ENDPOINT/v1/projects/PROJECT_ID/rules/BlockedVPAReqPayCreditRule/metadata/7e2514ec-5080-46d1-a313-eaa2c3198ddf/values:batchDelete"

In this example:

  • PROJECT_ID is the ID of your Google Cloud project.
  • $TOKEN is your OAuth 2.0 access token.
  • ISSUER_SWITCH_API_ENDPOINT is your issuer switch API endpoint. For example, api.129a0b1a-bb73-4906-a5b7-a6e0bfe7860e.issuerswitch.goog.

Replace these with values specific to your environment.

This API does not have any response body.

Note: To update metadata values, use a combination of the BatchCreateRuleMetadataValues method and the BatchDeleteRuleMetadataValues method based on your requirement.