Calculate price
Calculate a localized or optimized price for your service or product based on the customer’s location and other characteristics.
Usage
The first time that you call this endpoint for a given IP address and user ID, Corrily calculates the price. On subsequent calls (with the same IP address and user ID), Corrily returns the original calculated price.
See Calculate price API examples for examples of how this endpoint is commonly used.
Price localization
If you’re only using Corrily for price localization (i.e. you are not doing price optimization), this is the endpoint that you call in order to get localized prices.
Price optimization
If you’re also doing price optimization, this is the endpoint you call to get optimized prices.
As explained in Price optimization overview, Corrily either returns an experimental price or a control price which will be used to benchmark the experimental prices.
Experimental prices are affected by the following factors:
- The (potential) customer’s location, which is inferred from their IP address
- Any user features that you have provided
- The outcomes of previous price experiments
- The upper and lower bounds that you defined in the Corrily Dashboard
Body Params
The product IDs that you want to calculate prices for. In general, you
probably want to include the product IDs for all the product offerings that
you intend to show your visitor. The response from Corrily will contain the
display price for each product. For example, if you provide ["monthly", "annual"]
, Corrily returns price data for your monthly
and annual
products. Product IDs are created by Corrily when you set up your Corrily
account. Email support@corrily.com if you don’t know yours.
If packaging segmentation is enabled, package id can be passed to get the products for a package. That way the products shown themselves will be based on the package segmentation. When package segmentation is enabled, the products parameter is optional. If there is no pacakge segmentation defined for given country, audience, and no package_id, products are specified in request, an error will be returned.
An IPv4 or IPv6 address. Corrily uses this as the user ID if no user_id is
provided. ip is only required if no user_id is provided and
get_ip_from_request
is false. Examples: 187.106.3.73
(IPv4),
2804:14d:ac91:8286:efcb:851f:b59f:fffc
(IPv6).
If true
, Corrily sources the user’s IP from this request.
get_ip_from_request
therefore only works correctly when the Corrily API
request is made from a client device.
A two-letter (Alpha-2) ISO 3166 country
code.
Example: US
An object containing key-value pairs of arbitrary strings that represent features of this user which may affect their optimal price. See User features. Example: {"platform": "ios"}
The payment gateways to return integration objects for. Accepted values:
stripe
, paypal
, chargebee
A currency you wish the price to be tied to. Currencies do not need to match the passed country. For example, it is possible to return a price in EUR for someone based in the Unites Sates. Note that the country-adjusted price will be returned, regardless of the currency set.
With this flag you can run a complete recomputation of what should be shown for a user: country, currency, experiment and arm. For example, if a user was attached to country A and now you want to attach him to country B, and recompute products and prices for him, then you can use this flag. After recomputation, all previously saved for this user data will be overrided.
Will override the currency of any previously saved price and instead return
the price in the currency provided. If set to true
, a currency
param must
be passed. Unlike override
the price amount will not be recomputed.
If set to false, will make sure no experiment is run.
Optional product id to coupon id mapping to explicitly specify the coupon to be applied in the pricing. Coupons feature needs to be enabled for this. example {"product_id_1": "coupon_id_1"}
. Multiple coupons can be applied by a comma-delimited string, for example: {"product_id_1": "coupon_id_1,coupon_id2"}
Response
Whether or not the request completed successfully.
The user ID that you provided when you called calculate price, or the user’s IP address (if you did not provide a user ID).
The country that the price data is associated to. If you did not specify a
country when calling calculate price, the country
value provided here in the
response is inferred from the user’s IP address.
The currency that the price data is associated to. Tip: check if products. {id}.display.price
meets your needs before manually constructing a display price
with this field.
The currency symbol that the price data is associated to. Tip: check if
products.{id}.display.price
meets your needs before manually constructing a
display price with this field.
The package ID that was used to get the products.
The price data for each of the products that you specified when you called calculate price. The placeholder {id}
below represents your product ID(s). See Setup to learn how to create product IDs.
Price experimentation metadata. If you are not doing price experimentation, you can ignore this object.
The first audience user matches.
All audiences user matches, sorted by name.