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.
Bearer-AuthAuthorizationBearer <token>id*stringexpand[]?stringInclude e.g. "files" to retrieve files as a full object (defaults to just their IDs)
OK
application/json- response
id*stringpurchase_[a-zA-Z0-9]*files?array<|>Contains for example the certificate document if it was requested during the purchase.
payment_method*Payment-MethodMode 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.
"batch_settlement""batch_settlement""stripe"state*Purchase State"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*numbercarbon_unit*Carbon UnitSQUAKE uses The International System of Units (SI), commonly referred to as "metric system".
"tonne""kilogram""gram"total*integercurrency*Currency3-letter ISO 4217 alpha code of the currency.
^[A-Z]{3}$3 <= length <= 3"EUR""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?stringUnique identifier from your system; used as idempotency when creating this resource.
cancellable_until?stringThe date until which purchase can be cancelled
date-timecurl -X GET 'https://api.sandbox.squake.earth/v2/purchases/string'{ "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"}Quote a Pricing
Returns pricing for a given product and carbon quantity (or a fixed total amount in any supported currency). <br><br> By default, requested pricing is valid for two weeks starting the moment you request it. Expired pricings can still be used as long as the underlying price hasn''t changed for your convenience. <br><br> Repeated purchases using the same pricing are possible via API and the checkout page using the pricing id or `payment_link`, respectively. <br><br> You can append additional parameters to the `payment_link`; SQUAKE's checkout page supports the following: * **localization**: Please use a two-letter ISO 639-1 code, for example: `&locale=en` for English. * **utm_***: any valid UTM tracking parameters, e.g., `&utm_medium=email`. <br><br> This is a low-latency endpoint, useful for previewing pricing before making a purchase either via API or on the SQUAKE checkout page via the returned `payment_link`.'
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`.