Collapse Menu
Docs Home
Developer Tools
Contact Support

Limit Product Availability by Country

Overview

Prevent purchases of certain products by consumers in specific regions.

Situations such as contractual distribution rights, export restrictions, or risk concerns may motivate you to prevent consumers of specific countries from purchasing some of your products. You can do this by excluding the countries using custom Product Attributes. The excluded products do not appear on your Web Storefront in the countries where they are excluded. If the customer changes the Order Country to an excluded country after selecting such a product, FastSpring automatically removes the product from the order.

Customer Experience Examples

Suppose Example Product 1 has a product attribute that excludes the United Kingdom (UK). This does not affect consumers outside of the UK, however consumers within the UK are unable to see or select the product. Instead, this is what they would see for a Web Storefront:


If your page uses a Popup Storefront, and a customer changes the order country to one you have excluded for the product, the checkout window would appear similar to this:

Configure Country Exclusions via the FastSpring App

  1. In the FastSpring App, navigate to the Products menu and select the Product, Bundle, or Subscription for which you want to limit product availability. 
  2. In the product's details, click Options > Custom Attributes at the top right-hand corner.

  3. In the Custom Attributes (Advanced) dialog, type conditions in the Key field.
  4. In the corresponding Value field, enter a JSON object that specifies the countries to include or exclude. The contents of the object must consist of either the word exclude or include, followed by the word countries and ISO two-character country codes of each excluded or included country. The entire object must be correctly formed JSON, or else your Store ignores it and does not enforce any limitations.
    • Exclude - To allow customers to purchase the product in all locations except for the named countries, exclude the countries where you do not want to sell the product.
    • Include - If you want to allow the product to be purchased only in certain countries, include the countries where the product can be sold.
    • If you pass both include and exclude values for the same country, the country is automatically included in product availability.

      Example 1: Valid JSON to exclude two specific countries

      {exclude:{countries:['AT','GB']}}

      Example 2: Valid JSON to only include the United States

      {"include":{"countries":["US"]}}

  5. Click Save to save your changes. 

Configure Country Exclusions via the /products API Endpoint

When creating or updating a product via the /products endpoint of the FastSpring API, use the product-level attributes field to pass the exclusion data.

  1. For the first key string, pass conditions.
  2. For the corresponding value string, pass a JSON object that specifies the countries you want to include or exclude. To do this, the JSON contents must say either “exclude countries” or “include countries” followed by a list of countries specified by their ISO two-character country codes. The entire object must be correctly formed JSON, or else your Store does not enforce any limitations.
    • Exclude - If you want the product to be available in all locations except for the named countries, exclude the countries where you do not want to sell the product. 
    • Include - To allow the product to be purchased only in specified countries, include the countries where the product can be sold.
    • If you pass both include and exclude values for the same country, that country is automatically included.  
      Example 1: Updating a product to exclude two specific countries
      {
          "products": [
      	    {
      		    "product": "falcon",
      			"attributes": {
      			    "conditions":"{exclude:{countries:['AT','GB']}}"
      			}
          	}
      	]
      }
          
       
      Example 2: Updating a product to exclude all countries except one
      {
          "products": [
      	    {
      		    "product": "falcon",
      			"attributes": {
      			    "conditions":"{include:{countries:['US']}}"
      			}
          	}
      	]
      }  
      
        
  3. Click Save to save your changes.