Pricery.io | Docs
Search
⌃K

3b. Plug your website (API)

Using the Pricery API directly allows you to customize
Get direct access to your pricings as well as your visitor's detailed localization information by having your users call the API directly from you application.

From the client-side (GET)

Getting the details of your pricing from the client-side is as easy as a GET call to the pricery API. The response will take for reference the IP address from which the call is made.
  • Endpoint: /api/v1/pricings
  • Method: GET
  • Authorization: Use your Pricery public API key
fetch("https://www.pricery.io/api/v1/pricings", {
method: "GET",
headers: {
"Authorization": `Basic ${API_KEY}`,
}
})
.then(response => response.json())

From the server-side (POST)

To load pricing information from the server-side, make a POST call, and pass the visitors' ipAddress as a parameter. Pricery will use the given IP Address to localize the pricing. If no argument is passed, it will default to the IP address from which the request is made.
  • Endpoint: /api/v1/pricings
  • Method: POST
  • Authorization: Use your Pricery private API key (ask support for more info)
fetch("https://www.pricery.io/api/v1/pricings", {
method: "POST",
headers: {
"Authorization": `Basic ${API_KEY}`,
},
body: JSON.stringify({
"ipAddress": "VISITOR_IP", // Replace with visitor's IP address
})
})
.then(response => response.json())

API Response

The Pricing response returns the price informations matching the given IP address location.. Plus a little extra (visitor's info, local currency info, etc.)
Sample response
{
"data": {
"account_name": "Pricery.io",
"default_recurrence": "month",
"default_volume": 0,
"default_graduated": 0,
"redirect_url_pattern": "https://www.pricery.io/checkout?price={stripe_price_id}",
"pricing_is_default": true,
"visitor": {
"uses_vpn": false,
"country": {
"name": "Canada",
"flag": "🇨🇦"
},
"currency": {
"name": "Canadian dollar",
"code": "CAD",
"symbol": "$",
"exchange_rate_to_usd": "1.3595457",
"zero_decimal": false
}
},
"products": [
{
"name": "Agency",
"stripe_id": "prod_M5Rho3DW4JiKGI",
"default_variant": "month",
"tiers_mode": "",
"prices": [
{
"price_id": "price_1M0VrMCXz3Ph9GEIhQJsnQ2V",
"interval": "month",
"amount": "129.00",
"currency": {
"name": "United States dollar",
"code": "USD",
"symbol": "$",
"exchange_rate_to_usd": 1,
"zero_decimal": false
}
},
{
"price_id": "price_1M0VrkCXz3Ph9GEI6oL5OQBj",
"interval": "year",
"amount": "1290.00",
"currency": {
"name": "United States dollar",
"code": "USD",
"symbol": "$",
"exchange_rate_to_usd": 1,
"zero_decimal": false
}
}
]
},
// Other products selected in your default pricing...
]
}
}