> For the complete documentation index, see [llms.txt](https://docs.alternativepayments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alternativepayments.io/api-reference/checkout-auth.md).

# Checkout Auth

## Generate a token for checkout flow

> Generate a token for checkout flow

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["checkout:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"GenerateTokenResponse":{"properties":{"expires_at":{"type":"integer"},"token":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"GenerateTokenInput":{"properties":{"customer_id":{"type":"string"},"invoice_id":{"type":"string"}},"required":["customer_id","invoice_id"],"type":"object"}}},"paths":{"/checkout-auth/init":{"post":{"description":"Generate a token for checkout flow","operationId":"initCheckoutAuth","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateTokenResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Generate a token for checkout flow","tags":["CheckoutAuth"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateTokenInput"}}},"description":"Customer and invoice the checkout token is scoped to","required":true}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.alternativepayments.io/api-reference/checkout-auth.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
