Quote a price

Get a price and a pricing ID for a carbon quantity or a fixed amount of money.

Returns the price of a product for a carbon quantity, or the carbon quantity a fixed amount of money buys. The response holds a pricing ID that you pass to Create a purchase. With the payment method stripe, it also holds a payment_link to the SQUAKE checkout page.

This endpoint is fast and creates no obligation, so you can use it to show a price before anyone buys.

Request

GET /v2/pricing

Send either carbon_quantity with carbon_unit, or fixed_total.

productstring

The ID of the product to price, such as product_2rsg35sfsdf.

carbon_quantitynumber

The quantity of carbon to price.

carbon_unitstring

Unit of carbon_quantity: tonne, kilogram or gram.

fixed_totalinteger

A fixed amount of money to spend, in the smallest unit of currency: 1234 with EUR means 12.34 EUR.

currencystring

Three-letter ISO 4217 currency code.

expand[]array

product or price to receive the full object instead of its ID.

payment_methodstring

batch_settlement to buy through the API, or stripe to receive a payment_link to the checkout page.

payment_link_return_urlstring

Where the checkout page sends your customer after a successful payment, if they're still in the browser.

See every field of GET /v2/pricing in the API reference
curl -G "https://api.sandbox.squake.earth/v2/pricing" \
  --header "Authorization: Bearer $SQUAKE_API_KEY" \
  --data-urlencode "product=product_2rsg35sfsdf" \
  --data-urlencode "carbon_quantity=0.123" \
  --data-urlencode "carbon_unit=tonne" \
  --data-urlencode "expand[]=price"

Response

The response to the carbon quantity request, with the price expanded:

200 OKapplication/json
{
  "id": "eyJhbGciOiJIUzI1NiJ9.eyJwIjoicHJpY2VfMU1Ncm9MMmVaIn0...",
  "price": {
    "id": "price_1MMroL2eZvKYlo2CxbxAACvb",
    "product": "product_2rsg35sfsdf",
    "unit_amount": 15000,
    "carbon_unit": "tonne",
    "currency": "EUR"
  },
  "product": "product_2rsg35sfsdf",
  "valid_until": "2026-11-24",
  "carbon_quantity": 0.123,
  "carbon_unit": "tonne",
  "currency": "EUR",
  "total": 1845
}
FieldTypeDescription
idstringThe pricing token. Pass it as pricing to create a purchase.
payment_linkstringA link to the SQUAKE checkout page. Returned with the payment method stripe.
pricestring or objectThe price used, as an ID or, with expand[]=price, as an object.
productstring or objectThe product, as an ID or, with expand[]=product, as an object.
valid_untilstring (date)The last day the pricing is valid.
carbon_quantitynumberThe carbon quantity the pricing covers.
carbon_unitstringUnit of carbon_quantity.
currencystringCurrency of total.
totalintegerThe total price in the smallest unit of the currency. 1845 is 18.45 EUR.

Here, 0.123 tonnes at 150.00 EUR per tonne cost 18.45 EUR.

With payment_method=stripe, the response includes a payment_link:

200 OKapplication/json
{
  "id": "eyJhbGciOiJIUzI1NiJ9.eyJwIjoicHJpY2VfMU1Ncm9MMmVaIn0...",
  "payment_link": "https://checkout.squake.earth/?t=eyJhbGciOiJIUzI1NiJ9.eyJwIjoicHJpY2VfMU1Ncm9MMmVaIn0...",
  "price": "price_1MMroL2eZvKYlo2CxbxAACvb",
  "product": "product_2rsg35sfsdf",
  "valid_until": "2026-11-24",
  "carbon_quantity": 0.123,
  "carbon_unit": "tonne",
  "currency": "EUR",
  "total": 1845
}

Send your customer to the link to pay on the SQUAKE checkout page. You can append parameters to it:

  • locale, a two-letter ISO 639-1 language code such as &locale=de, sets the language of the checkout page.
  • Any utm_* tracking parameter, such as &utm_medium=email.
  • external_reference, which SQUAKE sends back to you in the order webhook. See Webhooks.

The same link works for repeated purchases.

Validity

A pricing is valid for two weeks from the moment you request it, until valid_until. After that, you can still use it as long as the underlying price hasn't changed. One pricing can back many purchases, so you can fetch one pricing per product and quantity and show it to every customer while it's valid.

Errors

StatusMeaning
400The request is invalid, for example because it has neither carbon_quantity with carbon_unit nor fixed_total.
401The API key is missing or invalid.

On this page

GET/v2/pricing

Run this request against the sandbox with your test key.

Open in API reference