---
title: "Buy credits"
method: POST
path: "/api/v2/checkout"
tags: ["Account"]
---

# Buy credits

`POST /api/v2/checkout`

## Request

- Base URL: `https://azurade.com`
- URL: `https://azurade.com/api/v2/checkout`
- Auth: one of:
  - HTTP bearer
  - API key in header `Authorization`

Starts a card checkout for a credit pack (100 or 1000 credits) on this account and returns its link and price. Send the account holder's country for what they will pay: subtotal, the sales tax or VAT as tax, and total, in that country's currency, or in currency when sent. The checkout opens with the same country and currency, and does not let them change the country. Without a country only the subtotal comes back, before tax: the checkout adds the tax, and may switch to the local currency, of the country they pick there. They open the link and pay, and the credits are added the moment the payment goes through. Credits never expire. Each call is a new single-use checkout. Prices before tax: 3.99 USD for 100 credits, 29.99 USD for 1000 credits.

## Request body

- CheckoutRequest
  - `country` string: The account holder's country as an ISO 3166-1 alpha-2 code, such as DE. A code the checkout does not take, or a country payments are not available in, answers 400 invalid_billing
  - `currency` string: ISO 4217 code, such as EUR, to price in instead of the country's own currency. A code the checkout does not take answers 400 invalid_billing
  - `pack` '100' | '1000', required: Credits in the pack

## Response `201`

Created

- Checkout
  - `checkout_url` string, uri: Single-use card checkout for the account holder to open
  - `country` string: ISO 3166-1 alpha-2 code of the country priced for, which the checkout opens with and does not let the account holder change. Absent when none was sent
  - `credits` number: Credits added when the payment goes through
  - `currency` string: ISO 4217 code of the amounts
  - `pack` string
  - `subtotal` number: The price before tax, in currency
  - `tax` number: Sales tax or VAT in country, in currency. Absent when no country was sent: the checkout then adds the tax of the country the account holder picks
  - `total` number: What the account holder pays, tax included, in currency. Absent when no country was sent

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid credentials
- `502`: checkout_failed: the payment provider did not answer; retry in a moment
- `503`: billing_unavailable: buying credits is switched off

---

[API](https://skmtc.dev/azurade/apis/azurade-ai-api.md) · [All operations](https://skmtc.dev/azurade/apis/azurade-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/azurade/apis/azurade-ai-api/revisions/0530fd2c8b63?raw)
