Retrieve a Purchase

GET
/v2/purchases/{id}

Retrieve a purchase placed earlier. Useful to check for its state. To avoid short polling, you can register a webhook to stay informed about all your purchases automatically.

You can use the external_reference as ID as well for the lookup; i.e. your unique identifier.

Authorization

Bearer-Auth
headerAuthorizationBearer <token>

Path Parameters

id*string

Query Parameters

expand[]?string

Include e.g. "files" to retrieve files as a full object (defaults to just their IDs)

Response Body

OK

application/json
  1. response
id*string
Matchpurchase_[a-zA-Z0-9]*
files?array<|>

Contains for example the certificate document if it was requested during the purchase.

payment_method*Payment-Method

Mode of payment. The batch settlement means SQUAKE will invoice you regularly for a batch of purchases. The checkout page is SQUAKEs self-fulfillment solution where end-customers can purchase a product directly from SQUAKE as the merchant of record.

Default"batch_settlement"
Value in"batch_settlement""stripe"
state*Purchase State
Value in"reserved""confirmed""invoiced""settled""certificates_confirmed""certificates_retired""payment_initiated""canceled""voided""refunded""payment_aborted"
metadata?

A set of key-value pairs of yours that helps you link this record in your system. Never displayed to users.

checkout_page?

Present if the payment method is stripe, meaning self-fulfillment by the customer on SQUAKEs payment page.

carbon_quantity*number
carbon_unit*Carbon Unit

SQUAKE uses The International System of Units (SI), commonly referred to as "metric system".

Value in"tonne""kilogram""gram"
total*integer
currency*Currency

3-letter ISO 4217 alpha code of the currency.

Match^[A-Z]{3}$
Length3 <= length <= 3
Default"EUR"
Value in"AED""AMD""ARS""AUD""AZN""BAM""BGN""BHD""BRL""CAD""CHF""CLP""CNY""COP""CRC""CZK""DKK""DZD""EGP""ETB""EUR""GBP""GEL""HKD""HUF""IDR""INR""ISK""JMD""JOD""JPY""KES""KRW""KWD""KZT""LKR""LYD""MAD""MUR""MXN""MYR""NOK""NZD""OMR""PHP""PKR""PLN""QAR""RSD""RUB""SAR""SEK""SGD""SYP""THB""TND""TRY""TTD""TWD""UAH""USD""VND""XAF""XOF""ZAR"
external_reference?string

Unique identifier from your system; used as idempotency when creating this resource.

cancellable_until?string

The date until which purchase can be cancelled

Formatdate-time
Example Request
curl -X GET 'https://api.sandbox.squake.earth/v2/purchases/string'
Example Response
{  "id": "purchase_sd234asdfl23",  "files": [    "file_34sdfgJH9df4g35"  ],  "payment_method": "batch_settlement",  "state": "reserved",  "metadata": {},  "checkout_page": {    "url": "https://checkout.squake.earth",    "return_url": "https://example.com"  },  "carbon_quantity": 0,  "carbon_unit": "tonne",  "total": 0,  "currency": "EUR",  "external_reference": "string",  "cancellable_until": "2019-08-24T14:15:22Z"}