Limit product availability by country
Learn how to use custom attributes to include or exclude specific countries from viewing and purchasing your items.
Use product custom attributes to restrict who can see and buy your products based on country. This is useful for handling distribution agreements, export controls, or regional risk policies.
Configure country exclusions
In the FastSpring app, follow these steps:
-
Go to Catalog > choose Products, Bundles, or Subscriptions.
-
Select the item you want to restrict. The details page opens.
-
Click the Manage Product menu (top-right) and choose Custom Attributes. The Custom Attributes modal opens.
-
In the Key field, enter
conditions
(all lowercase). -
In the corresponding Value field, enter a valid JSON object string using two-letter ISO 3166-1 alpha-2 country codes. For example:
{"exclude":{"countries":["AT","GB"]}}
{"include":{"countries":["AT","GB"]}}
-
Click Save. Customers in excluded countries will no longer be able to see or purchase the item.
Format rules (UI)
- Key is case-sensitive: Must be exactly
conditions
in lowercase. - Include vs. exclude: Use
{"include":{...}}
to whitelist or{"exclude":{...}}
to blacklist. - Valid JSON only: Double-quote all keys and strings, no trailing commas, matching braces.
- ISO codes required: Only two-letter ISO 3166-1 alpha-2 codes (e.g.
US
,AT
,GB
) are accepted; invalid codes are ignored.
Automate via API
You can also configure country restrictions programmatically using our products API:
Endpoint
POST
https://api.fastspring.com/products
Request body
Replace your-product-ID
with your product's ID and set the conditions
attribute string:
{
"products": [
{
"product": "your-product-ID",
"attributes": {
"conditions": "{exclude:{countries:['AT','GB']}}"
}
}
]
}
Format rules (API)
- Array container: Wrap entries inside the top-level
"products"
array. - Product path:
"product"
must match your product's unique ID. - Stringified JSON:
conditions
remains a JSON string (no escaping its internal quotes). - Include vs. exclude: Use
{include:{...}}
to whitelist or{exclude:{...}}
to blacklist. - Error handling: Malformed JSON or invalid ISO codes are ignored; inspect API responses for warnings.
Updated about 15 hours ago