# Directing to Checkout

When the user is ready to checkout, you can fetch the current basket and direct the user to its `links.checkout` URL. Here, the user will enter their payment information and complete checkout.

If you'd like the user to stay on your site during checkout, use [Tebex.js](https://docs.tebex.io/developers/tebex.js) alongside the Headless API.

{% hint style="warning" %}
For most stores, authorizing the user against the basket is required before checkout. You can do this by directing the user to the appropriate link provided by the **/baskets/auth** endpoint. [Read more here](https://docs.tebex.io/developers/headless-api/creating-a-basket).
{% endhint %}

{% openapi src="<https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2F7Z5I0T5QbbgoGzyObgml%2Fheadless-api.yaml?alt=media&token=62e71089-ed13-428f-828e-d0f3eeee20b9>" path="/accounts/{token}/baskets/{basketIdent}" method="get" %}
[headless-api.yaml](https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2F7Z5I0T5QbbgoGzyObgml%2Fheadless-api.yaml?alt=media\&token=62e71089-ed13-428f-828e-d0f3eeee20b9)
{% 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.tebex.io/developers/headless-api/directing-to-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.
