Update a Purchase
Update a purchase placed earlier.
You can use the external_reference
as ID as well for the lookup; i.e. your unique identifier.
Omitted keys will not affect any present data.
To remove optional data you must explicitly set the value to null
Body
-
confirmation_document object
Additional properties are allowed.
-
certificate_document object
Additional properties are allowed.
-
expand array
Receive either the file-id, or the file-object of a requested document. If omitted, only IDs are returned.
Value is
files
. -
metadata object
A set of key-value pairs of yours that helps you link this record in your system. Never displayed to users.
Additional properties are allowed.
-
external_reference string
PATCH
/v2/purchases/{id}
curl \
--request PATCH https://api.squake.earth/v2/purchases/{id} \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"confirmation_document":{"full_name":"string","address":{"city":"string","country":"DE","line1":"string","line2":"string","postal_code":"string","state":"string"},"email":"hello@example.com","on_behalf_of":{"full_name":"string","address":{"city":"string","country":"DE","line1":"string","line2":"string","postal_code":"string","state":"string"}},"locale":"en"},"certificate_document":{"full_name":"string","address":{"city":"string","country":"DE","line1":"string","line2":"string","postal_code":"string","state":"string"},"email":"hello@example.com","flags":["with_attribution"],"locale":"en"},"expand":["files"],"metadata":{},"external_reference":"string"}'
Request examples
{
"confirmation_document": {
"full_name": "string",
"address": {
"city": "string",
"country": "DE",
"line1": "string",
"line2": "string",
"postal_code": "string",
"state": "string"
},
"email": "hello@example.com",
"on_behalf_of": {
"full_name": "string",
"address": {
"city": "string",
"country": "DE",
"line1": "string",
"line2": "string",
"postal_code": "string",
"state": "string"
}
},
"locale": "en"
},
"certificate_document": {
"full_name": "string",
"address": {
"city": "string",
"country": "DE",
"line1": "string",
"line2": "string",
"postal_code": "string",
"state": "string"
},
"email": "hello@example.com",
"flags": [
"with_attribution"
],
"locale": "en"
},
"expand": [
"files"
],
"metadata": {},
"external_reference": "string"
}
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",
"cancellable_until": "2025-01-01T15:00:00+00:00"
}
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"
}
}
]