--- title: "Manage network tokens" description: "Learn how to manage network tokens for cards added to digital wallets." url: "https://docs.adyen.com/issuing/manage-network-tokens" source_url: "https://docs.adyen.com/issuing/manage-network-tokens.md" canonical: "https://docs.adyen.com/issuing/manage-network-tokens" last_modified: "2026-05-24T12:54:31+02:00" language: "en" --- # Manage network tokens Learn how to manage network tokens for cards added to digital wallets. [View source](/issuing/manage-network-tokens.md) When your cardholder [adds their Adyen-issued card to the digital wallet](/issuing/digital-wallets), the card scheme (Visa or Mastercard) creates a network token for it. A network token is a 16-digit Primary Account Number (PAN) alternative that is unique for each card-device-wallet pairing. The benefits of using network tokens are: * Reduced user friction and declined payments because network tokens are maintained by card schemes. * Higher authorisation rates compared to payments made without network tokens. * Better payment security because each transaction is protected with a one-time use cryptogram. With Adyen Issuing, you can manage network tokens separately from the cards. For example, you might want to temporarily suspend a network token or deactivate a network token, if the card has been lost or stolen. ## Requirements Before you begin, make sure that you fulfill the following requirements: | Requirement | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | You must have an integration that supports Issuing. | | **API credentials** | You need an API credential for the Configuration API that has the following role:- **Gives the user permissions to read and patch the NetworkTokens that are linked to the accounts they are able to access** | ## Get all network tokens To get all network tokens that are linked to the Adyen-issued card: 1. Make a GET [/paymentInstruments/{id}/networkTokens](https://docs.adyen.com/api-explorer/balanceplatform/latest/get/paymentInstruments/\(id\)/networkTokens) request and specify the following parameter in the path: | Path parameter | Description | | -------------- | ----------------------------------------------------------------------------------------------------- | | `id` | The identifier of the payment instrument created when [issuing a card](/issuing/create-cards#create). | **Get all network tokens of a card** #### curl ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/paymentInstruments/PI3227C223222B5BPCMFXD2XG/networkTokens \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X GET \ -d '' ``` #### Java ```java // Adyen Java API Library v25.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.service.balancePlatform.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Make the API call PaymentInstrumentsApi service = new PaymentInstrumentsApi(client); ListNetworkTokensResponse response = service.listNetworkTokens("id", null); ``` #### PHP ```php // Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Service\BalancePlatform\PaymentInstrumentsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Make the API call $service = new PaymentInstrumentsApi($client); $response = $service->listNetworkTokens('id'); ``` #### C\# ```cs // Adyen .net API Library v14.4.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Service.BalancePlatform; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Make the API call var service = new PaymentInstrumentsService(client); var response = service.ListNetworkTokens("id"); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use const { Client, BalancePlatformAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.PaymentInstrumentsApi.listNetworkTokens("id"); ``` #### Go ```go // Adyen Go API Library v9.3.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/balancePlatform" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Make the API call service := client.BalancePlatform() req := service.PaymentInstrumentsApi.ListNetworkTokensInput("id") res, httpRes, err := service.PaymentInstrumentsApi.ListNetworkTokens(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Make the API call result = adyen.balancePlatform.payment_instruments_api.list_network_tokens(id="id") ``` #### Ruby ```rb # Adyen Ruby API Library v9.3.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment # Make the API call result = adyen.balancePlatform.payment_instruments_api.list_network_tokens('id') ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, BalancePlatformAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.PaymentInstrumentsApi.listNetworkTokens("id"); ``` 2. Verify that you receive an **HTTP 200 — OK** response that returns all network tokens associated with the payment instrument, regardless of the network token status. For each network token, note the parameters in the following table: | Parameter | Description | Possible values | | --------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------- | | `type` | The type of wallet the network token is associated with. | **applePay**, **googlePay** | | `id` | The unique identifier of the network token. | **NWTK00000000000000000000000001** | | `paymentInstrumentId` | The unique identifier of the payment instrument. | **PI3227C223222B5BPCMFXD2XG** | | `creationDate` | Date and time when the network token was created. | **2021-01-01T01:00:00+01:00** | | `status` | The status of the network token. | **active**, **inactive**, **suspended**, **closed**. | | `brandVariant` | The card brand variant of the payment instrument associated with the network token. | **mcmaestro**, **mc\_prepaid\_mrw**, etc. | | `tokenLastFour` | The last four digits of the network token `id`. | **0001** | | `device.osName` | The operating system of the device the network token is stored on. | **android**, **ios**, **other**. | | `device.formFactor` | The form factor of the device the network token is stored on. | **phone**, **watch**, **tablet**, **other**. | **Response** ```json { "data": [ { "type": "applePay", "id": "NWTK00000000000000000000000001", "paymentInstrumentId": "PI3227C223222B5BPCMFXD2XG", "creationDate": "2020-01-01T01:00:00+01:00", "status": "active", "brandVariant": "mcmaestro", "tokenLastFour": "0001", "device": { "osName": "ios", "formFactor": "phone" } }, { "type": "googlePay", "id": "NWTK00000000000000000000000002", "paymentInstrumentId": "PI3227C223222B5BPCMFXD2XG", "creationDate": "2021-01-01T01:00:00+01:00", "status": "suspended", "brandVariant": "mc_prepaid_mrw", "tokenLastFour": "0002", "device": { "osName": "android", "formFactor": "watch" } } ] } ``` ## Get a single network token To get the details of a single network token that is linked to the Adyen-issued card: 1. Make a GET [/networkTokens/{networkTokenId}](https://docs.adyen.com/api-explorer/balanceplatform/latest/get/networkTokens/\(networkTokenId\)) request and specify the following parameter in the path: | Path parameter | Description | | ---------------- | ------------------------------------------------------------- | | `networkTokenId` | The identifier of the network token associated with the card. | **Get a single network token of a card** ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/paymentInstruments/PI3227C223222B5BPCMFXD2XG/networkTokens/NWTK00000000000000000000000001 \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X GET \ -d '' ``` 2. Verify that you receive an **HTTP 200 — OK** response that contains the details for the network token associated with the payment instrument. Note the parameters in the following table: | Parameter | Description | Possible values | | --------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | `type` | The type of wallet the network token is associated with. | **wallet**, **cof** | | `id` | The unique identifier of the network token. | An alphanumeric string. | | `paymentInstrumentId` | The unique identifier of the payment instrument. | An alphanumeric string. | | `creationDate` | The date and time when the network token was created. | Date in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format. | | `status` | The status of the network token. | **active**, **inactive**, **suspended**, **closed** | | `brandVariant` | The card brand variant of the payment instrument associated with the network token. | **mcmaestro**, **mc\_prepaid\_mrw** | | `tokenLastFour` | The last four digits of the network token `id`. | A string of four numbers. | | `tokenRequestor.id` | The unique identifier of the entity that requested the network token. | A string of numbers. | | `tokenRequestor.name` | The name of the entity that requested the network token. | **googlePay**, **applePay** | | `device.osName` | The operating system of the device the network token is stored on. | **android**, **ios**, or **other** | | `device.formFactor` | The type of device used to provision the network token. | **phone**, **watch**, **tablet**, or **other** | **Response** ```json { "type": "wallet", "id": "NWTK00000000000000000000000001", "paymentInstrumentId": "PI00000000000000000000001", "creationDate": "2020-01-01T01:00:00+01:00", "status": "active", "brandVariant": "mcmaestro", "tokenLastFour": "0001", "tokenRequestor": { "id": "40012345678", "name": "googlePay" }, "device": { "osName": "ios", "formFactor": "phone" } } ``` ## Update the status of a network token You can update the [status](/issuing/network-tokens#lifecycle-of-a-network-token) of a network token to: * Manually activate a network token after completing [phone call authentication](/issuing/tokens-digital-wallet?tab=phone_call_authentication_required_2_3): You change the status from **inactive** to **active**. * Temporarily suspend a network token: You change the status from **active** to **suspended**. * Reactivate a suspended token: You change the status from **suspended** to **active**. * Permanently close a network token: You change the status from **active** or **suspended** to **closed**. To update the status of a network token: 1. Make a PATCH [/networkTokens/{networkTokenId}](https://docs.adyen.com/api-explorer/balanceplatform/latest/patch/networkTokens/\(networkTokenId\)) request and specify the following parameter in the path: | Path parameter | Description | | ---------------- | ------------------------------------------------------------- | | `networkTokenId` | The identifier of the network token associated with the card. | Provide the following parameters in the request body: | Parameter | Required | Description | | --------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `status` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The status of the network token. Possible values: **active**, **suspended**, **closed**. The **closed** status is final and cannot be changed. | Here's an example of how to change the `status` of the network token to **suspended**. **Update the status of a network token** ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/paymentInstruments/PI3227C223222B5BPCMFXD2XG/networkTokens/NWTK00000000000000000000000001 \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X PATCH \ -d '{ "status": "suspended" }' ``` 2. Verify that you receive an **HTTP 202 — Accepted** response with no content. This response means that the request has been accepted, but will be processed asynchronously. 3. Listen to webhooks to receive the final result of this request. ## Limit the usage of a network token In some cases, you might need to limit the number of network tokens per card or set limits for transactions that use network tokens. You can do so by using the `/transactionRules` endpoint. ### Limit the number of active network tokens To limit the number of active network tokens allowed for a single card: 1. Send a POST [/transactionRules](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules) request and specify the following parameters: | Parameter | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | [description](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-description) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your description for the rule. Maximum length: 300 characters. This description is shown in the [Customer Area](https://ca-test.adyen.com/). | | [entityKey](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-entityKey) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Contains the ID and type of resource to which the rule is applied. | | [interval](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-interval) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The time period or duration when the rule applies. | | [reference](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-reference) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your reference for the rule. Maximum length: 150 characters. | | [type](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-type) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **blockList**, **maxUsage**, or **velocity**. | | [ruleRestrictions](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Object that contains key-value objects with the key as the condition and the value containing values and operations. | | [status](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-status) | | Set to **active** if you want to start evaluating the rule. When you set the status to active, we automatically set the `startDate` to the current time. | The following example shows how to limit the number of active network tokens to only **one per card**. **Limit the number of active network tokens for a card** #### curl ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "interval": { "type": "perTransaction" }, "type": "blockList", "description": "Set the maximum number of active network tokens to one for this card", "reference": "myRule123", "entityKey": { "entityType": "paymentInstrument", "entityReference": "PI3227C223222B5FN65FN5NS9" }, "ruleRestrictions": { "activeNetworkTokens": { "operation": "greaterThanOrEqualTo", "value": 1 } }, "status": "active", "requestType": "authorization", "outcomeType": "hardBlock" }' ``` #### Java ```java // Adyen Java API Library v25.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.balancePlatform.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.service.balancePlatform.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) ActiveNetworkTokensRestriction activeNetworkTokensRestriction = new ActiveNetworkTokensRestriction() .operation("greaterThanOrEqualTo") .value(1); TransactionRuleEntityKey transactionRuleEntityKey = new TransactionRuleEntityKey() .entityType("paymentInstrument") .entityReference("PI3227C223222B5FN65FN5NS9"); TransactionRuleInterval transactionRuleInterval = new TransactionRuleInterval() .type(TransactionRuleInterval.TypeEnum.PERTRANSACTION); TransactionRuleRestrictions transactionRuleRestrictions = new TransactionRuleRestrictions() .activeNetworkTokens(activeNetworkTokensRestriction); TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo() .reference("myRule123") .outcomeType(TransactionRuleInfo.OutcomeTypeEnum.HARDBLOCK) .requestType(TransactionRuleInfo.RequestTypeEnum.AUTHORIZATION) .entityKey(transactionRuleEntityKey) .description("Set the maximum number of active network tokens to one for this card") .interval(transactionRuleInterval) .ruleRestrictions(transactionRuleRestrictions) .type(TransactionRuleInfo.TypeEnum.BLOCKLIST) .status(TransactionRuleInfo.StatusEnum.ACTIVE); // Make the API call TransactionRulesApi service = new TransactionRulesApi(client); TransactionRule response = service.createTransactionRule(transactionRuleInfo, null); ``` #### PHP ```php // Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\BalancePlatform\TransactionRuleEntityKey; use Adyen\Model\BalancePlatform\TransactionRuleInterval; use Adyen\Model\BalancePlatform\TransactionRuleRestrictions; use Adyen\Model\BalancePlatform\ActiveNetworkTokensRestriction; use Adyen\Model\BalancePlatform\TransactionRuleInfo; use Adyen\Service\BalancePlatform\TransactionRulesApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Create the request object(s) $activeNetworkTokensRestriction = new ActiveNetworkTokensRestriction(); $activeNetworkTokensRestriction ->setOperation("greaterThanOrEqualTo") ->setValue(1); $transactionRuleEntityKey = new TransactionRuleEntityKey(); $transactionRuleEntityKey ->setEntityType("paymentInstrument") ->setEntityReference("PI3227C223222B5FN65FN5NS9"); $transactionRuleInterval = new TransactionRuleInterval(); $transactionRuleInterval ->setType("perTransaction"); $transactionRuleRestrictions = new TransactionRuleRestrictions(); $transactionRuleRestrictions ->setActiveNetworkTokens($activeNetworkTokensRestriction); $transactionRuleInfo = new TransactionRuleInfo(); $transactionRuleInfo ->setReference("myRule123") ->setOutcomeType("hardBlock") ->setRequestType("authorization") ->setEntityKey($transactionRuleEntityKey) ->setDescription("Set the maximum number of active network tokens to one for this card") ->setInterval($transactionRuleInterval) ->setRuleRestrictions($transactionRuleRestrictions) ->setType("blockList") ->setStatus("active"); // Make the API call $service = new TransactionRulesApi($client); $response = $service->createTransactionRule($transactionRuleInfo); ``` #### C\# ```cs // Adyen .net API Library v14.4.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.BalancePlatform; using Adyen.Service.BalancePlatform; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) ActiveNetworkTokensRestriction activeNetworkTokensRestriction = new ActiveNetworkTokensRestriction { Operation = "greaterThanOrEqualTo", Value = 1 }; TransactionRuleEntityKey transactionRuleEntityKey = new TransactionRuleEntityKey { EntityType = "paymentInstrument", EntityReference = "PI3227C223222B5FN65FN5NS9" }; TransactionRuleInterval transactionRuleInterval = new TransactionRuleInterval { Type = TransactionRuleInterval.TypeEnum.PerTransaction }; TransactionRuleRestrictions transactionRuleRestrictions = new TransactionRuleRestrictions { ActiveNetworkTokens = activeNetworkTokensRestriction }; TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo { Reference = "myRule123", OutcomeType = TransactionRuleInfo.OutcomeTypeEnum.HardBlock, RequestType = TransactionRuleInfo.RequestTypeEnum.Authorization, EntityKey = transactionRuleEntityKey, Description = "Set the maximum number of active network tokens to one for this card", Interval = transactionRuleInterval, RuleRestrictions = transactionRuleRestrictions, Type = TransactionRuleInfo.TypeEnum.BlockList, Status = TransactionRuleInfo.StatusEnum.Active }; // Make the API call var service = new TransactionRulesService(client); var response = service.CreateTransactionRule(transactionRuleInfo); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use const { Client, BalancePlatformAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const transactionRuleInfo = { interval: { type: "perTransaction" }, type: "blockList", description: "Set the maximum number of active network tokens to one for this card", reference: "myRule123", entityKey: { entityType: "paymentInstrument", entityReference: "PI3227C223222B5FN65FN5NS9" }, ruleRestrictions: { activeNetworkTokens: { operation: "greaterThanOrEqualTo", value: 1 } }, status: "active", requestType: "authorization", outcomeType: "hardBlock" } // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.createTransactionRule(transactionRuleInfo); ``` #### Go ```go // Adyen Go API Library v9.3.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/balancePlatform" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) activeNetworkTokensRestriction := balancePlatform.ActiveNetworkTokensRestriction{ Operation: "greaterThanOrEqualTo", Value: common.PtrInt32(1), } transactionRuleEntityKey := balancePlatform.TransactionRuleEntityKey{ EntityType: common.PtrString("paymentInstrument"), EntityReference: common.PtrString("PI3227C223222B5FN65FN5NS9"), } transactionRuleInterval := balancePlatform.TransactionRuleInterval{ Type: "perTransaction", } transactionRuleRestrictions := balancePlatform.TransactionRuleRestrictions{ ActiveNetworkTokens: &activeNetworkTokensRestriction, } transactionRuleInfo := balancePlatform.TransactionRuleInfo{ Reference: "myRule123", OutcomeType: common.PtrString("hardBlock"), RequestType: common.PtrString("authorization"), EntityKey: transactionRuleEntityKey, Description: "Set the maximum number of active network tokens to one for this card", Interval: transactionRuleInterval, RuleRestrictions: transactionRuleRestrictions, Type: "blockList", Status: common.PtrString("active"), } // Make the API call service := client.BalancePlatform() req := service.TransactionRulesApi.CreateTransactionRuleInput().TransactionRuleInfo(transactionRuleInfo) res, httpRes, err := service.TransactionRulesApi.CreateTransactionRule(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "interval": { "type": "perTransaction" }, "type": "blockList", "description": "Set the maximum number of active network tokens to one for this card", "reference": "myRule123", "entityKey": { "entityType": "paymentInstrument", "entityReference": "PI3227C223222B5FN65FN5NS9" }, "ruleRestrictions": { "activeNetworkTokens": { "operation": "greaterThanOrEqualTo", "value": 1 } }, "status": "active", "requestType": "authorization", "outcomeType": "hardBlock" } # Make the API call result = adyen.balancePlatform.transaction_rules_api.create_transaction_rule(request=json_request) ``` #### Ruby ```rb # Adyen Ruby API Library v9.3.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :interval => { :type => 'perTransaction' }, :type => 'blockList', :description => 'Set the maximum number of active network tokens to one for this card', :reference => 'myRule123', :entityKey => { :entityType => 'paymentInstrument', :entityReference => 'PI3227C223222B5FN65FN5NS9' }, :ruleRestrictions => { :activeNetworkTokens => { :operation => 'greaterThanOrEqualTo', :value => 1 } }, :status => 'active', :requestType => 'authorization', :outcomeType => 'hardBlock' } # Make the API call result = adyen.balancePlatform.transaction_rules_api.create_transaction_rule(request_body) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, BalancePlatformAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const activeNetworkTokensRestriction: Types.balancePlatform.ActiveNetworkTokensRestriction = { operation: "greaterThanOrEqualTo", value: 1 }; const transactionRuleEntityKey: Types.balancePlatform.TransactionRuleEntityKey = { entityType: "paymentInstrument", entityReference: "PI3227C223222B5FN65FN5NS9" }; const transactionRuleInterval: Types.balancePlatform.TransactionRuleInterval = { type: Types.balancePlatform.TransactionRuleInterval.TypeEnum.PerTransaction }; const transactionRuleRestrictions: Types.balancePlatform.TransactionRuleRestrictions = { activeNetworkTokens: activeNetworkTokensRestriction }; const transactionRuleInfo: Types.balancePlatform.TransactionRuleInfo = { reference: "myRule123", outcomeType: Types.balancePlatform.TransactionRuleInfo.OutcomeTypeEnum.HardBlock, requestType: Types.balancePlatform.TransactionRuleInfo.RequestTypeEnum.Authorization, entityKey: transactionRuleEntityKey, description: "Set the maximum number of active network tokens to one for this card", interval: transactionRuleInterval, ruleRestrictions: transactionRuleRestrictions, type: Types.balancePlatform.TransactionRuleInfo.TypeEnum.BlockList, status: Types.balancePlatform.TransactionRuleInfo.StatusEnum.Active }; // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.createTransactionRule(transactionRuleInfo); ``` 2. Verify that you receive an **HTTP 200 — OK** response that returns the `id` of the transaction rule that can be used to further [update](https://docs.adyen.com/api-explorer/balanceplatform/latest/patch/transactionRules/_transactionRuleId_) or [delete](https://docs.adyen.com/api-explorer/balanceplatform/latest/delete/transactionRules/_transactionRuleId_) this rule. **Response—Transaction rule successfully created** ```json { "description": "Set the maximum number of active network tokens to one for this card", "entityKey": { "entityReference": "PI3227C223222B5FN65FN5NS9", "entityType": "paymentInstrument" }, "interval": { "timeZone": "UTC", "type": "perTransaction" }, "outcomeType": "hardBlock", "reference": "myRule123", "requestType": "authorization", "ruleRestrictions": { "activeNetworkTokens": { "operation": "greaterThanOrEqualTo", "value": 1 } }, "startDate": "2022-10-05T10:44:15.608698+02:00", "status": "active", "type": "blockList", "id": "TR32272223222C5GP4S4K5NZG" } ``` ### Limit transactions using network tokens To limit the transactions using network tokens for a card: 1. Make a POST [/transactionRules](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules) request and specify the following parameters: | Parameter | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | [description](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-description) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your description for the rule. Maximum length: 300 characters. This description is shown in the [Customer Area](https://ca-test.adyen.com/). | | [entityKey](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-entityKey) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Contains the ID and type of resource to which the rule is applied. | | [interval](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-interval) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The time period or duration when the rule applies. | | [reference](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-reference) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your reference for the rule. Maximum length: 150 characters. | | [type](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-type) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **blockList**, **maxUsage**, or **velocity**. | | [ruleRestrictions](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Object that contains key-value objects with the key as the condition and the value containing values and operations. | | [status](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-status) | | Set to **active** if you want to start evaluating the rule. When you set the status to active, we automatically set the `startDate` to the current time. | The following example shows how to block transactions that are **greater than EUR 50** and use network tokens. **Block the transactions using network tokens** #### curl ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "description": "Block network token transactions above EUR 50", "reference": "myRule123", "entityKey": { "entityType": "paymentInstrument", "entityReference": "PI3227C223222B5FN65FN5NS9" }, "interval": { "type": "perTransaction" }, "ruleRestrictions": { "processingTypes": { "operation": "anyMatch", "value": [ "token" ] }, "totalAmount": { "operation": "greaterThan", "value": { "currency": "EUR", "value": 5000 } } }, "status": "active", "outcomeType": "hardBlock", "type": "velocity" }' ``` #### Java ```java // Adyen Java API Library v25.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.balancePlatform.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.service.balancePlatform.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("EUR") .value(5000L); TotalAmountRestriction totalAmountRestriction = new TotalAmountRestriction() .operation("greaterThan") .value(amount); ProcessingTypesRestriction processingTypesRestriction = new ProcessingTypesRestriction() .operation("anyMatch") .value(Arrays.asList(ProcessingTypesRestriction.ValueEnum.TOKEN)); TransactionRuleEntityKey transactionRuleEntityKey = new TransactionRuleEntityKey() .entityType("paymentInstrument") .entityReference("PI3227C223222B5FN65FN5NS9"); TransactionRuleInterval transactionRuleInterval = new TransactionRuleInterval() .type(TransactionRuleInterval.TypeEnum.PERTRANSACTION); TransactionRuleRestrictions transactionRuleRestrictions = new TransactionRuleRestrictions() .totalAmount(totalAmountRestriction) .processingTypes(processingTypesRestriction); TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo() .reference("myRule123") .outcomeType(TransactionRuleInfo.OutcomeTypeEnum.HARDBLOCK) .entityKey(transactionRuleEntityKey) .description("Block network token transactions above EUR 50") .interval(transactionRuleInterval) .ruleRestrictions(transactionRuleRestrictions) .type(TransactionRuleInfo.TypeEnum.VELOCITY) .status(TransactionRuleInfo.StatusEnum.ACTIVE); // Make the API call TransactionRulesApi service = new TransactionRulesApi(client); TransactionRule response = service.createTransactionRule(transactionRuleInfo, null); ``` #### PHP ```php // Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\BalancePlatform\TransactionRuleEntityKey; use Adyen\Model\BalancePlatform\TransactionRuleInterval; use Adyen\Model\BalancePlatform\TransactionRuleRestrictions; use Adyen\Model\BalancePlatform\Amount; use Adyen\Model\BalancePlatform\TotalAmountRestriction; use Adyen\Model\BalancePlatform\ProcessingTypesRestriction; use Adyen\Model\BalancePlatform\TransactionRuleInfo; use Adyen\Service\BalancePlatform\TransactionRulesApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(5000); $totalAmountRestriction = new TotalAmountRestriction(); $totalAmountRestriction ->setOperation("greaterThan") ->setValue($amount); $processingTypesRestriction = new ProcessingTypesRestriction(); $processingTypesRestriction ->setOperation("anyMatch") ->setValue(array("token")); $transactionRuleEntityKey = new TransactionRuleEntityKey(); $transactionRuleEntityKey ->setEntityType("paymentInstrument") ->setEntityReference("PI3227C223222B5FN65FN5NS9"); $transactionRuleInterval = new TransactionRuleInterval(); $transactionRuleInterval ->setType("perTransaction"); $transactionRuleRestrictions = new TransactionRuleRestrictions(); $transactionRuleRestrictions ->setTotalAmount($totalAmountRestriction) ->setProcessingTypes($processingTypesRestriction); $transactionRuleInfo = new TransactionRuleInfo(); $transactionRuleInfo ->setReference("myRule123") ->setOutcomeType("hardBlock") ->setEntityKey($transactionRuleEntityKey) ->setDescription("Block network token transactions above EUR 50") ->setInterval($transactionRuleInterval) ->setRuleRestrictions($transactionRuleRestrictions) ->setType("velocity") ->setStatus("active"); // Make the API call $service = new TransactionRulesApi($client); $response = $service->createTransactionRule($transactionRuleInfo); ``` #### C\# ```cs // Adyen .net API Library v14.4.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.BalancePlatform; using Adyen.Service.BalancePlatform; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "EUR", Value = 5000 }; TotalAmountRestriction totalAmountRestriction = new TotalAmountRestriction { Operation = "greaterThan", Value = amount }; ProcessingTypesRestriction processingTypesRestriction = new ProcessingTypesRestriction { Operation = "anyMatch", Value = { ProcessingTypesRestriction.ValueEnum.Token } }; TransactionRuleEntityKey transactionRuleEntityKey = new TransactionRuleEntityKey { EntityType = "paymentInstrument", EntityReference = "PI3227C223222B5FN65FN5NS9" }; TransactionRuleInterval transactionRuleInterval = new TransactionRuleInterval { Type = TransactionRuleInterval.TypeEnum.PerTransaction }; TransactionRuleRestrictions transactionRuleRestrictions = new TransactionRuleRestrictions { TotalAmount = totalAmountRestriction, ProcessingTypes = processingTypesRestriction }; TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo { Reference = "myRule123", OutcomeType = TransactionRuleInfo.OutcomeTypeEnum.HardBlock, EntityKey = transactionRuleEntityKey, Description = "Block network token transactions above EUR 50", Interval = transactionRuleInterval, RuleRestrictions = transactionRuleRestrictions, Type = TransactionRuleInfo.TypeEnum.Velocity, Status = TransactionRuleInfo.StatusEnum.Active }; // Make the API call var service = new TransactionRulesService(client); var response = service.CreateTransactionRule(transactionRuleInfo); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use const { Client, BalancePlatformAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const transactionRuleInfo = { description: "Block network token transactions above EUR 50", reference: "myRule123", entityKey: { entityType: "paymentInstrument", entityReference: "PI3227C223222B5FN65FN5NS9" }, interval: { type: "perTransaction" }, ruleRestrictions: { processingTypes: { operation: "anyMatch", value: [ "token" ] }, totalAmount: { operation: "greaterThan", value: { currency: "EUR", value: 5000 } } }, status: "active", outcomeType: "hardBlock", type: "velocity" } // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.createTransactionRule(transactionRuleInfo); ``` #### Go ```go // Adyen Go API Library v9.3.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/balancePlatform" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := balancePlatform.Amount{ Currency: "EUR", Value: 5000, } totalAmountRestriction := balancePlatform.TotalAmountRestriction{ Operation: "greaterThan", Value: &amount, } processingTypesRestriction := balancePlatform.ProcessingTypesRestriction{ Operation: "anyMatch", Value: []string{ "token", }, } transactionRuleEntityKey := balancePlatform.TransactionRuleEntityKey{ EntityType: common.PtrString("paymentInstrument"), EntityReference: common.PtrString("PI3227C223222B5FN65FN5NS9"), } transactionRuleInterval := balancePlatform.TransactionRuleInterval{ Type: "perTransaction", } transactionRuleRestrictions := balancePlatform.TransactionRuleRestrictions{ TotalAmount: &totalAmountRestriction, ProcessingTypes: &processingTypesRestriction, } transactionRuleInfo := balancePlatform.TransactionRuleInfo{ Reference: "myRule123", OutcomeType: common.PtrString("hardBlock"), EntityKey: transactionRuleEntityKey, Description: "Block network token transactions above EUR 50", Interval: transactionRuleInterval, RuleRestrictions: transactionRuleRestrictions, Type: "velocity", Status: common.PtrString("active"), } // Make the API call service := client.BalancePlatform() req := service.TransactionRulesApi.CreateTransactionRuleInput().TransactionRuleInfo(transactionRuleInfo) res, httpRes, err := service.TransactionRulesApi.CreateTransactionRule(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "description": "Block network token transactions above EUR 50", "reference": "myRule123", "entityKey": { "entityType": "paymentInstrument", "entityReference": "PI3227C223222B5FN65FN5NS9" }, "interval": { "type": "perTransaction" }, "ruleRestrictions": { "processingTypes": { "operation": "anyMatch", "value": [ "token" ] }, "totalAmount": { "operation": "greaterThan", "value": { "currency": "EUR", "value": 5000 } } }, "status": "active", "outcomeType": "hardBlock", "type": "velocity" } # Make the API call result = adyen.balancePlatform.transaction_rules_api.create_transaction_rule(request=json_request) ``` #### Ruby ```rb # Adyen Ruby API Library v9.3.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :description => 'Block network token transactions above EUR 50', :reference => 'myRule123', :entityKey => { :entityType => 'paymentInstrument', :entityReference => 'PI3227C223222B5FN65FN5NS9' }, :interval => { :type => 'perTransaction' }, :ruleRestrictions => { :processingTypes => { :operation => 'anyMatch', :value => [ 'token' ] }, :totalAmount => { :operation => 'greaterThan', :value => { :currency => 'EUR', :value => 5000 } } }, :status => 'active', :outcomeType => 'hardBlock', :type => 'velocity' } # Make the API call result = adyen.balancePlatform.transaction_rules_api.create_transaction_rule(request_body) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, BalancePlatformAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const amount: Types.balancePlatform.Amount = { currency: "EUR", value: 5000 }; const totalAmountRestriction: Types.balancePlatform.TotalAmountRestriction = { operation: "greaterThan", value: amount }; const processingTypesRestriction: Types.balancePlatform.ProcessingTypesRestriction = { operation: "anyMatch", value: [ Types.balancePlatform.ProcessingTypesRestriction.ValueEnum.Token ] }; const transactionRuleEntityKey: Types.balancePlatform.TransactionRuleEntityKey = { entityType: "paymentInstrument", entityReference: "PI3227C223222B5FN65FN5NS9" }; const transactionRuleInterval: Types.balancePlatform.TransactionRuleInterval = { type: Types.balancePlatform.TransactionRuleInterval.TypeEnum.PerTransaction }; const transactionRuleRestrictions: Types.balancePlatform.TransactionRuleRestrictions = { totalAmount: totalAmountRestriction, processingTypes: processingTypesRestriction }; const transactionRuleInfo: Types.balancePlatform.TransactionRuleInfo = { reference: "myRule123", outcomeType: Types.balancePlatform.TransactionRuleInfo.OutcomeTypeEnum.HardBlock, entityKey: transactionRuleEntityKey, description: "Block network token transactions above EUR 50", interval: transactionRuleInterval, ruleRestrictions: transactionRuleRestrictions, type: Types.balancePlatform.TransactionRuleInfo.TypeEnum.Velocity, status: Types.balancePlatform.TransactionRuleInfo.StatusEnum.Active }; // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.createTransactionRule(transactionRuleInfo); ``` 2. Verify that you receive an **HTTP 200 — OK** response that returns the `id` of the transaction rule that can be used to further [update](https://docs.adyen.com/api-explorer/balanceplatform/latest/patch/transactionRules/_transactionRuleId_) or [delete](https://docs.adyen.com/api-explorer/balanceplatform/latest/delete/transactionRules/_transactionRuleId_) this rule. **Response** ```json { "description": "Block network token transactions above EUR 50", "entityKey": { "entityReference": "PI3227C223222B5FN65FN5NS9", "entityType": "paymentInstrument" }, "interval": { "timeZone": "UTC", "type": "perTransaction" }, "outcomeType": "hardBlock", "reference": "myRule123", "requestType": "authorization", "ruleRestrictions": { "processingTypes": { "operation": "anyMatch", "value": [ "token" ] }, "totalAmount": { "operation": "greaterThan", "value": { "currency": "EUR", "value": 5000 } } }, "startDate": "2022-10-05T10:34:31.911273+02:00", "status": "active", "type": "velocity", "id": "TR32272223222C5GP4S4K5NZG" } ```