API Reference

Calculate price response

Reference documentation on the object that Corrily returns after you call calculate price.

Fields

Field (Data type)Data typeDescription
successBooleanWhether or not the request completed successfully.
user_idStringThe user ID that you provided when you called calculate price, or the user's IP address (if you did not provide a user ID).
countryStringThe 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.
currencyStringThe 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.
currency_symbolStringThe 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.
productsObjectThe 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.
products.<id>.priceFloatA float version of your price, in case you want to do some custom formatting of the price. Tip: check if products.<id>.display.price meets your needs before manually constructing a display price with this field.
products.<id>.price_usdFloatThe current value of products.<id>.price in United States dollars.
products.<id>.intervalStringThe billing interval of this product. Possible values: day, week, month, year, one_time
products.<id>.interval_countInteger
products.<id>.displayObjectThe price data, formatted in various ways for display to your user.
products.<id>.display.priceStringThe price data, formatted in a way that your user will quickly understand. This is usually a combination of currency, currency_symbol, and products.<id>.price. products.<id>.price will use commas or periods as separators if that is the local custom. Example: JP¥2,200
products.<id>.display.reference_interval_priceStringThe default price for the product. You can set this default price in your Corrily Dashboard.
products.<id>.display.price_with_baseline_strikeStringIf products.<id>.price is an experimental price, this field contains the baseline price striked out, followed by the experimental price. You may want to present this to your user to help them see that they would be paying less than normal customers. Example: $̶3̶4̶ $19
products.<id>.display.discount_to_baselineFloatIf products.<id>.price is an experimental price, this field contains the percentage discount of the experimental price compared to the baseline price. For example, if the baseline price is 34 and the experimental price is 19, the discount is about 44%: 1 - (19 ÷ 34)) × 100
products.<id>.integrationsObjectThe price data, formatted for payment gateway integration.
products.<id>.integrations.<gateway>.currencyStringThe currency that products.<id>.integrations.<gateway>.amount is priced in. If this currency is not the same as the top-level currency value in this response (the "local currency"), it means that the payment gateway does not accept the local currency.
products.<id>.integrations.<gateway>.amountFloat or IntegerThe amount that you should pass to the payment gateway when creating the subscription or charge. Many payment gateways use smallest-unit currency format in which case this value will be an integer.
products.<id>.integrations.<gateway>.formattedStringAs mentioned in products.<id>.integrations.<gateway>.currency, sometimes a payment gateway doesn't support your user's local currency. If that's the case, then products.<id>.integrations.<gateway>.formatted provides the equivalent price in a currency that the payment gateway does support. This field is similar to products.<id>.display.price in that it will be formatted in a way that your user will quickly understand.
products.<id>.couponObjectOptionally include coupon details if the given request matches any segment for which an active campaign is running
products.<id>.coupon.idStringcoupon id
products.<id>.coupon.typeStringindicates if a coupon is percentage discount coupon or absolute amount discount coupon
products.<id>.coupon.valueFloatThe value or percentage or absolute amount of discount for the coupon
products.<id>.coupon.coupon_sourceStringIndicates the source of the coupon if the coupon maps to an external source
products.<id>.coupon.external_coupon_idStringCoupon id from the external source if that coupon maps to an external source
products.<id>.coupon.currency_codeStringIndicates currency code if it is configured for the coupon
products.<id>.coupon.valid_tillDatetime in YYYY-MM-DD HH:MM:SS formatIndicates the time the coupon is valid for in UTC
products.<id>.coupon.displayObjectSame as product level display object but indicates the price related values after the coupon is applied
variantsObjectPrice experimentation metadata. If you are not doing price experimentation, you can ignore this object.
variants.experimented_onBooleanWhether or not this response contains experimental prices.

Example

{
  "success": true,
  "user_id": "193.37.32.232",
  "country": "SG",
  "currency": "SGD",
  "currency_symbol": "S$",
  "products": {
    "monthly": {
      "price": 27,
      "price_usd": 20.059360849328197,
      "interval": "month",
      "interval_count": 1,
      "display": {
        "price": "S$ 27",
        "reference_interval_price": "S$ 27",
        "price_with_baseline_strike": "S$ 27",
        "discount_to_baseline": 0
      },
      "integrations": {
        "stripe": {
          "currency": "SGD",
          "amount": 2700,
          "formatted": "S$ 27"
        }
      }
    },
    "annual": {
      "price": 144,
      "price_usd": 106.98325786308372,
      "interval": "year",
      "interval_count": 1,
      "display": {
        "price": "S$ 144",
        "reference_interval_price": "S$ 12",
        "price_with_baseline_strike": "S$ 12",
        "discount_to_baseline": 0
      },
      "integrations": {
        "stripe": {
          "currency": "SGD",
          "amount": 14400,
          "formatted": "S$ 144"
        }
      },
      "coupon":{
        "id":"coupon_id_392",
        "type":"percentage",
        "value":10,
        "coupon_source":"chargebee",
        "external_coupon_id":"chargebee_coupon_392",
        "currency_code":"USD",
        "valid_till":"2022-02-07 15:49:49",
        "display":{
           "local_currency_symbol":"€",
           "interval_local_price_formatted":"9 €",
           "local_price_formatted":"9 €",
           "usd_price_formatted":"$11",
           "local_price_formatted_with_baseline_strike":"9 €",
           "pct_discount_to_baseline":0.0
         }
	    }
    }
  },
  "variants": {
    "experimented_on": true
  }
}