Pricing and purchases

Quote a price for carbon credits, buy them through the API or the SQUAKE checkout page, and track each purchase.

These endpoints turn an emissions figure into a compensation: you quote a price for a product, buy it, and follow the purchase until the certificates are retired.

How a purchase works

  1. Know the emissions to compensate. Calculate them with the Calculations API, or use any carbon quantity you have.
  2. Pick a product.
  3. Quote a price with Quote a price, or calculate and quote in one request with Calculate and price in one request.
  4. Buy the credits, in one of two ways:
    • Through the API, with the payment method batch_settlement. You create the purchase with the pricing ID, and SQUAKE invoices you regularly for a batch of purchases.
    • Through the SQUAKE checkout page, with the payment method stripe. Your customer pays on the page behind the payment_link, and SQUAKE is the merchant of record. See Fulfillment with self-checkout.
  5. Track the purchase with Retrieve a purchase, or let SQUAKE notify you with webhooks.
  6. Download the confirmation and certificate documents with Retrieve a file.

Pricing tokens

A pricing is a token that encodes a product, a carbon quantity or fixed amount, and a price.

  • A pricing is valid for two weeks from the moment you request it. An expired pricing still works as long as the underlying price hasn't changed.
  • You can use one pricing for many purchases. Requests for the same product and quantity can return the same pricing ID.
  • To make retries safe, send an external_reference with each purchase. A retried call with the same external_reference doesn't register a second purchase.

Purchase states

Purchases made through the API go through these states:

StateMeaning
reservedSQUAKE registered the purchase and reserved the carbon credits. You can cancel it for 14 days.
canceledThe purchase was canceled while it was reserved. Final state.
confirmedThe cancellation period has passed. The API can no longer cancel the purchase.
invoicedSQUAKE invoiced the purchase after the grace period.

Purchases made on the checkout page go through these states:

StateMeaning
payment_initiatedThe customer started the payment flow on the checkout page.
payment_abortedThe payment failed for good, for example because the customer left the page and didn't come back before the pricing expired. Final state.
confirmedThe payment provider reported a successful payment. The purchase moves on to settled right away.

Both kinds of purchase can reach these states:

StateMeaning
settledSQUAKE received the payment.
refundedA refund was processed. Final state.
certificates_confirmedAll project partners confirmed the certificates for the purchase's carbon credits.
certificates_retiredAll certificates were retired in their registries. Final state.

The state field can also be voided.

Guides

TaskEndpointGuide
Quote a price for a quantity or an amountGET /v2/pricingQuote a price
Calculate emissions and quote a price togetherPOST /v2/calculations-with-pricingCalculate and price in one request
Buy creditsPOST /v2/purchasesCreate a purchase
Check a purchaseGET /v2/purchases/{id}Retrieve a purchase
Change document details or metadataPATCH /v2/purchases/{id}Update a purchase
Cancel a reserved purchasePOST /v2/purchases/{id}/cancelCancel a purchase
Download a confirmation or certificateGET /v2/files/{id}Retrieve a file

On this page