> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.videogen.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.videogen.io/_mcp/server.

# Complete approved credit purchase

POST https://api.videogen.io/v1/billing/orders/{orderId}/complete
Content-Type: application/json

Sensitive write. Complete only this quoted order after the user approves its exact terms. Deliver the scoped one-time card token through the secure header, never model-visible text. Reuse the same order, revision, client idempotency key and credential on an identical retry. A different token cannot replace an existing claim. Payment and credit fulfillment are separate states.

Reference: https://docs.videogen.io/rest-api-reference/billing/complete-billing-order

## Authentication

- `Authorization` header (bearer token, required) — API key from [app.videogen.io/api](https://app.videogen.io/api). The full key is only shown once when you create it.

## Request

### Path parameters

- `orderId` (string, required)

### Headers

- `Stripe-Shared-Payment-Token` (string, required) — Scoped card-backed Stripe Shared Payment Token for this exact one-time total. Must be non-empty. Transport securely; never put it in prompts, URLs, logs or tool content. This native header is not an MPP payment challenge.

### Body (application/json)

This endpoint expects a CompleteBillingOrderRequest.

- `revision` (integer, required)
- `idempotencyKey` (string, required)

## Response

### 200

Current account or order state.

- `orderId` (string, required)
- `state` (enum, required)
  - Allowed values: `requires_approval`, `requires_action`, `processing`, `paid_pending_fulfillment`, `fulfilled`, `failed`, `canceled`, `expired`
- `revision` (integer, required)
- `teamId` (string, required)
- `teamName` (string, required)
- `seller` (enum, required)
  - Allowed values: `VideoGen`
- `product` (enum, required)
  - Allowed values: `credits`
- `credits` (integer, required)
- `currency` (string, required)
- `subtotalMinor` (integer, required)
- `discountMinor` (integer, required)
- `taxMinor` (integer, required)
- `feesMinor` (integer, required)
- `totalMinor` (integer, required)
- `expiresAt` (integer, required) — Unix seconds when this quote expires.
- `termsVersion` (string, required)
- `refundTerms` (string, required)
- `refundStatus` (enum, required)
  - Allowed values: `none`, `requested`, `processing`, `succeeded`, `failed`
- `receiptUrl` (string, required, nullable)
- `retryGuidance` (string, required)
- `paymentHandler` (map from string to any, required) — Seller payment handler and merchant identity for a compatible native wallet. This does not attest to host acceptance.
- `verificationUrl` (string, optional, nullable) — Secure VideoGen verification continuation when required. Sign in as the purchaser on the same team. This is not a checkout link.

## Examples

**Request**

```json
{
  "revision": 1,
  "idempotencyKey": "string"
}
```

**Response**

```json
{
  "orderId": "string",
  "state": "requires_approval",
  "revision": 1,
  "teamId": "string",
  "teamName": "string",
  "seller": "VideoGen",
  "product": "credits",
  "credits": 1,
  "currency": "string",
  "subtotalMinor": 1,
  "discountMinor": 1,
  "taxMinor": 1,
  "feesMinor": 1,
  "totalMinor": 1,
  "expiresAt": 1,
  "termsVersion": "string",
  "refundTerms": "string",
  "refundStatus": "none",
  "receiptUrl": "string",
  "retryGuidance": "string",
  "paymentHandler": {},
  "verificationUrl": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.videogen.io/v1/billing/orders/orderId/complete"

payload = {
    "revision": 1,
    "idempotencyKey": "string"
}
headers = {
    "Stripe-Shared-Payment-Token": "Stripe-Shared-Payment-Token",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```