# Purchases ## Create a Purchase - [POST /v2/purchases](https://docs-v2.squake.earth/docs/openapi/purchases/post-purchases.md): You can register a purchase programmatically to compensate for carbon emissions on this endpoint. You must quote for pricing beforehand and pass the returned pricing ID as a parameter. Alternatively, you can use the from the pricing endpoint to finalize the purchase using SQUAKE's provided checkout page. ### Lifecycle #### When purchasing via API (this endpoint) * : A successful purchase starts in the state "reserved"; SQUAKE registered your purchase and reserved carbon credits accordingly. * : SQUAKE offers 14 days to cancel a purchase worry-free. This is a terminal state. * : The refundable period has passed. If you need to cancel the purchase beyond this point, please request a refund on the refunds endpoint. * : Without further action, a purchase is invoiced after the grace period and transitions to "invoiced". #### When purchasing via the checkout page * : the end customer entered the payment flow on the checkout page * : the payment failed permanently, for example, because the customer exited the page without finalizing the payment and didn''t return before the pricing''s validity ended. This is a terminal state. * : the payment provider informed SQUAKE about the successful payment. In this flow, this state exists only for a short time; the purchase immediately continues to "settled". #### Both * : SQUAKE has received the payment. * : a refund request was successfully processed. This is a terminal state. * : all certificates for the carbon credits have been confirmed from all project partners related to the purchase. * : all certificates have been retired in the corresponding registries. This is a terminal state. ## Retrieve a Purchase - [GET /v2/purchases/{id}](https://docs-v2.squake.earth/docs/openapi/purchases/get-purchases-id.md): 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 as ID as well for the lookup; i.e. your unique identifier. ## Update a Purchase - [PATCH /v2/purchases/{id}](https://docs-v2.squake.earth/docs/openapi/purchases/patch-purchases-id.md): Update a purchase placed earlier. You can use the 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 . ## Cancel a Purchase - [POST /v2/purchases/{id}/cancel](https://docs-v2.squake.earth/docs/openapi/purchases/post-purchases-id-cancel.md): A purchase can be canceled as long as it is not confirmed; this is in the state . After the cancelation period passes, the purchase transitions to . Confirmed purchases go to the batch settlement.