Cancel a Purchase
A purchase can be canceled as long as it is not confirmed; this is in the state reserved
. After the cancelation period passes, the purchase transitions to confirmed
. Confirmed purchases go to the batch settlement.
POST /v2/purchases/{id}/cancel
curl \
-X POST https://api.sandbox.squake.earth/v2/purchases/{id}/cancel \
-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 (400)
# 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 (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
SQUAKE-Request-Id: req_70394c00-728e-4d70-90bc-2b589c9ebdf8
# Payload
[
{
"code": "field_validation_error",
"detail": "string",
"source": {
"id": "string",
"attribute": "string",
"model": "string"
}
}
]