# Checkout

The checkout endpoints provide ways of performing a checkout process against an Order. The Storefront API supports two ways of checking out an order, one using hosted checkout pages, and a more advanced option for inline payment processing.

## Hosted

With the hosted checkout flow it is required that before redirecting to the payment gateway a checkout token should be generated. This token is passed to the pay endpoint to ensure that only the given order can be processed in response to the checkout request. The pay endpoint should be launched in a WebView/iframe with this token which will redirect to the given Orders payment gateway for payment capture. To determine the outcome of the payment developers should monitor the WebView/iframes URL. They will be redirected to the same pay endpoint URL with either a `/completed`, `/canceled` or `/errored` suffix.

{% openapi src="<https://4119392862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLSLlTQTRr58JSwooVHuf%2Fuploads%2Fgit-blob-cd213f363dbcf83d61472d3225087cad32bcf2b7%2Fstorefront_swagger.json?alt=media&token=49e9e5a7-6d0e-4286-8d60-dec1fca526be>" path="/umbraco/commerce/storefront/api/v1/checkout/{orderId}/token" method="get" %}
[storefront\_swagger.json](https://4119392862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLSLlTQTRr58JSwooVHuf%2Fuploads%2Fgit-blob-cd213f363dbcf83d61472d3225087cad32bcf2b7%2Fstorefront_swagger.json?alt=media\&token=49e9e5a7-6d0e-4286-8d60-dec1fca526be)
{% endopenapi %}

{% openapi src="<https://4119392862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLSLlTQTRr58JSwooVHuf%2Fuploads%2Fgit-blob-cd213f363dbcf83d61472d3225087cad32bcf2b7%2Fstorefront_swagger.json?alt=media&token=49e9e5a7-6d0e-4286-8d60-dec1fca526be>" path="/umbraco/commerce/storefront/api/v1/checkout/{orderId}/pay/{token}" method="get" %}
[storefront\_swagger.json](https://4119392862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLSLlTQTRr58JSwooVHuf%2Fuploads%2Fgit-blob-cd213f363dbcf83d61472d3225087cad32bcf2b7%2Fstorefront_swagger.json?alt=media\&token=49e9e5a7-6d0e-4286-8d60-dec1fca526be)
{% endopenapi %}

## Inline

With the inline checkout flow, it is left to the implementing developer to perform payment capture. Before a capture can begin, the order should be initialized using the `initialize` endpoint which prepares the Order for capture. The `initialize` endpoint will return the settings of the Orders selected payment method, along with details of expected metadata needed by the payment provider. Developers can use this data to perform an inline capture and call the `confirm` endpoint when the capture is successful, passing back any metadata captured.

{% openapi src="<https://4119392862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLSLlTQTRr58JSwooVHuf%2Fuploads%2Fgit-blob-cd213f363dbcf83d61472d3225087cad32bcf2b7%2Fstorefront_swagger.json?alt=media&token=49e9e5a7-6d0e-4286-8d60-dec1fca526be>" path="/umbraco/commerce/storefront/api/v1/checkout/{orderId}/initialize" method="get" %}
[storefront\_swagger.json](https://4119392862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLSLlTQTRr58JSwooVHuf%2Fuploads%2Fgit-blob-cd213f363dbcf83d61472d3225087cad32bcf2b7%2Fstorefront_swagger.json?alt=media\&token=49e9e5a7-6d0e-4286-8d60-dec1fca526be)
{% endopenapi %}

{% openapi src="<https://4119392862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLSLlTQTRr58JSwooVHuf%2Fuploads%2Fgit-blob-cd213f363dbcf83d61472d3225087cad32bcf2b7%2Fstorefront_swagger.json?alt=media&token=49e9e5a7-6d0e-4286-8d60-dec1fca526be>" path="/umbraco/commerce/storefront/api/v1/checkout/{orderId}/confirm" method="post" %}
[storefront\_swagger.json](https://4119392862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLSLlTQTRr58JSwooVHuf%2Fuploads%2Fgit-blob-cd213f363dbcf83d61472d3225087cad32bcf2b7%2Fstorefront_swagger.json?alt=media\&token=49e9e5a7-6d0e-4286-8d60-dec1fca526be)
{% endopenapi %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.umbraco.com/umbraco-commerce/13.latest/reference/storefront-api/endpoints/checkout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
