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

# Custom Checkout API

> Create a Stripe checkout session for a custom plan

Called when a user builds a custom plan by selecting individual features.

## Endpoint

```
POST /api/stripe/checkout/custom
```

## Body

<ParamField body="shareId" type="string" required>
  Your project's Share ID
</ParamField>

<ParamField body="selectedFeatures" type="string[]" required>
  Array of feature names the user selected
</ParamField>

<ParamField body="email" type="string">
  Customer email
</ParamField>

<ParamField body="subscriptionDuration" type="string">
  `"monthly"`, `"3months"`, `"6months"`, `"9months"`, or `"12months"`
</ParamField>

<ParamField body="userCount" type="number">
  Number of users (for per-user pricing)
</ParamField>

<ParamField body="featureUsageAmounts" type="object">
  Usage amounts per feature. Keys are feature names, values are quantities.
</ParamField>

## Example request

```json theme={null}
{
  "shareId": "nTZ7axXQHU",
  "selectedFeatures": ["AI Prompt", "Dashboard"],
  "email": "user@example.com",
  "subscriptionDuration": "monthly",
  "userCount": 1,
  "featureUsageAmounts": {
    "API Calls": 500
  }
}
```

## Response

```json theme={null}
{
  "url": "https://checkout.stripe.com/c/pay/cs_live_..."
}
```

## Metadata stored

The checkout session stores feature details in metadata for later retrieval via the Receipt API:

```json theme={null}
{
  "customPlan": "true",
  "projectId": "203",
  "featureDetails_0": "[{\"name\":\"AI Prompt\",\"price\":10,...}]"
}
```
