Retrieve a Purchase
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.
Query parameters
-
expand[] string
Include e.g. "files" to retrieve files as a full object (defaults to just their IDs)
GET /v2/purchases/{id}
curl \
-X GET https://api.sandbox.squake.earth/v2/purchases/{id} \
-H "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
# Headers
# Payload
{
"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": 42.0,
"carbon_unit": "tonne",
"total": 42,
"currency": "EUR",
"external_reference": "string"
}
Response examples (401)
# Headers
SQUAKE-Request-Id: req_70394c00-728e-4d70-90bc-2b589c9ebdf8
# Payload
[
{
"code": "field_validation_error",
"detail": "string",
"source": {
"id": "string",
"attribute": "string",
"model": "string"
}
}
]
Response examples (404)
# Headers
# Payload
[
{
"code": "field_validation_error",
"detail": "string",
"source": {
"id": "string",
"attribute": "string",
"model": "string"
}
}
]