Set Merchant Category Spend Rule
The POST /api/spendRules/merchantCategory endpoint allows you to set or update merchant category-based spend rules for a specific payment card. You can define which merchant categories are permitted or explicitly blocked, giving you granular control over where and how a card can be used. This is useful for enforcing corporate spending policies, parental controls, or targeted budget management.
Endpoint
POST /api/spendRules/merchantCategory
Authentication
Bearer token required. Obtain via:
POST https://api.banking.netevia.dev/api/auth/v2
Include in header: Authorization: Bearer {token}
Token lifetime: 10 minutes. Refresh via POST /api/auth/refresh.
When to use
Use this endpoint when you need to restrict or allow card spending based on merchant category codes (MCCs). For example, a business may want to allow only fuel and dining categories on a fleet card, or block gambling and entertainment categories on an employee card. Rules apply at the card level and take effect immediately upon creation.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
paymentCardId | string | Yes | The unique identifier of the payment card to which the merchant category rule will be applied. Minimum length: 1 character. |
allowed | array of string (enum) | No | List of merchant categories that are explicitly allowed for this card. Each value must be a valid merchantCategory enum value. If null, no explicit allowlist is applied. |
blocked | array of string (enum) | No | List of merchant categories that are explicitly blocked for this card. Each value must be a valid merchantCategory enum value. If null, no explicit blocklist is applied. |
{
"paymentCardId": "card_a1b2c3d4e5f6",
"allowed": [
"SERVICE_STATIONS",
"EATING_PLACES_RESTAURANTS",
"FAST_FOOD_RESTAURANTS",
"GROCERY_STORES_SUPERMARKETS"
],
"blocked": [
"BETTING_CASINO_GAMBLING",
"PACKAGE_STORES_BEER_WINE_AND_LIQUOR",
"GOVERNMENT_LICENSED_ON_LINE_CASINO"
]
}Merchant Category Enum Values (partial list)
The allowed and blocked arrays accept string values from the merchantCategory enum. Common values include:
| Category | Description |
|---|---|
GROCERY_STORES_SUPERMARKETS | Grocery and supermarket stores |
EATING_PLACES_RESTAURANTS | Restaurants and dining establishments |
FAST_FOOD_RESTAURANTS | Fast food chains and quick-service restaurants |
SERVICE_STATIONS | Gas stations and fuel service |
AUTOMATED_FUEL_DISPENSERS | Pay-at-pump fuel stations |
DRUG_STORES_AND_PHARMACIES | Pharmacies and drugstores |
AIRLINES_AIR_CARRIERS | Commercial air travel |
HOTELS_MOTELS_AND_RESORTS | Lodging and accommodation |
CAR_RENTAL | Car rental agencies |
TAXI_CABS_LIMOUSINES | Taxi and limousine services |
BETTING_CASINO_GAMBLING | Casinos and gambling establishments |
DIGITAL_GOODS_GAMES | Online and digital game purchases |
PACKAGE_STORES_BEER_WINE_AND_LIQUOR | Liquor stores and alcohol retailers |
ELECTRONICS_STORES | Electronics and technology retailers |
WHOLESALE_CLUBS | Wholesale membership clubs |
ONLINE_MARKETPLACES | E-commerce and online marketplaces |
HEALTH_AND_BEAUTY_SPAS | Spas and wellness centers |
SPORTING_GOODS_STORES | Sports equipment and apparel |
DOCTORS | Medical doctors and physicians |
HOSPITALS | Hospital services |
For the complete list of supported enum values, refer to the bank.client.common.merchantcategory schema in the OpenAPI definition.
Response
200 OK
A 200 OK response indicates the merchant category spend rule was successfully created or updated on the specified payment card. The response body is empty on success.
{}Error Codes
| Code | When it happens |
|---|---|
| 400 | paymentCardId is missing or empty, or one or more category values in allowed or blocked are not valid enum entries |
| 401 | Bearer token is missing, expired, or invalid |
| 403 | The authenticated user does not have permission to modify spend rules for the specified card |
| 404 | The specified paymentCardId does not exist or is not accessible to the caller |
| 500 | Internal server error |
Common Mistakes
- Providing both
allowedandblockedwith overlapping merchant categories — a category should not appear in both arrays simultaneously, as this creates conflicting rules. - Using free-text merchant names instead of the exact enum string values (e.g., using
"McDonald's"instead of"FAST_FOOD_RESTAURANTS"). - Omitting
paymentCardId— this is a required field and the request will fail with a 400 error without it. - Sending an empty
allowedarray ([]) expecting it to allow all categories — usenullinstead if you do not want an explicit allowlist. - Attempting to apply spend rules to a card that has already been deactivated or cancelled.
Related Endpoints
POST /api/spendRules/merchantCategory— Set or update merchant category spend rules on a cardPOST /api/spendRules/velocityLimit— Set transaction velocity (frequency and amount) limits on a cardGET /api/spendRules/{paymentCardId}— Retrieve all active spend rules for a payment cardDELETE /api/spendRules/{spendRuleId}— Remove a specific spend rule from a cardPOST /api/paymentCards— Create a new payment card (Physical, Virtual, or Burner)
Example
curl -X POST https://api.banking.netevia.dev/api/spendRules/merchantCategory \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"paymentCardId": "card_a1b2c3d4e5f6",
"allowed": [
"SERVICE_STATIONS",
"EATING_PLACES_RESTAURANTS",
"FAST_FOOD_RESTAURANTS",
"GROCERY_STORES_SUPERMARKETS"
],
"blocked": [
"BETTING_CASINO_GAMBLING",
"PACKAGE_STORES_BEER_WINE_AND_LIQUOR",
"GOVERNMENT_LICENSED_ON_LINE_CASINO"
]
}' 200Success
