---
title: "Complete a succeeded SetupIntent checkout into an active subscription"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.hostedez.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Hosted EZ REST API

`POST /v1/billing/checkout/complete`

## Authentication

- `sessionCookie`, apiKey, in cookie

## Request body

_Required._

- `completeBillingCheckout.setupIntentId` (string, required)
  - pattern `^seti_`
- `completeBillingCheckout.fp` (object | null, optional)
- `completeBillingCheckout.turnstileToken` (string, optional)
  - maxLength 2048

## Example request

```json
{
  "fp": {},
  "setupIntentId": "string",
  "turnstileToken": "string"
}
```

## Code samples

### cURL

```curl
curl --request POST \
  --url https://api.hostedez.com/v1/billing/checkout/complete \
  --header 'Content-Type: application/json' \
  --header '__Secure-better-auth.session_token: <value>' \
  --data '
{
  "fp": {},
  "setupIntentId": "string",
  "turnstileToken": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.hostedez.com/v1/billing/checkout/complete';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    '__Secure-better-auth.session_token': '<value>'
  },
  body: JSON.stringify({fp: {}, setupIntentId: 'string', turnstileToken: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.hostedez.com/v1/billing/checkout/complete"

payload = {
    "fp": {},
    "setupIntentId": "string",
    "turnstileToken": "string"
}
headers = {
    "Content-Type": "application/json",
    "__Secure-better-auth.session_token": "<value>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Subscription creation result

### 400

Invalid request

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `completeBillingCheckout.response.400.error` (object, required)
  - `completeBillingCheckout.response.400.error.code` (string, required)
  - `completeBillingCheckout.response.400.error.message` (string, required)
  - `completeBillingCheckout.response.400.error.issues` (array<object>, optional)
    - `completeBillingCheckout.response.400.error.issues.message` (string, required)
    - `completeBillingCheckout.response.400.error.issues.path` (string, required)

### 401

Unauthenticated

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `completeBillingCheckout.response.401.error` (object, required)
  - `completeBillingCheckout.response.401.error.code` (string, required)
  - `completeBillingCheckout.response.401.error.message` (string, required)
  - `completeBillingCheckout.response.401.error.issues` (array<object>, optional)
    - `completeBillingCheckout.response.401.error.issues.message` (string, required)
    - `completeBillingCheckout.response.401.error.issues.path` (string, required)

### 403

Forbidden origin or Turnstile verification failed

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `completeBillingCheckout.response.403.error` (object, required)
  - `completeBillingCheckout.response.403.error.code` (string, required)
  - `completeBillingCheckout.response.403.error.message` (string, required)
  - `completeBillingCheckout.response.403.error.issues` (array<object>, optional)
    - `completeBillingCheckout.response.403.error.issues.message` (string, required)
    - `completeBillingCheckout.response.403.error.issues.path` (string, required)


Source: https://docs.hostedez.com/api/completeBillingCheckout/index.md
