> Solana Developer Platform docs, served as Markdown. The [docs index](https://platform.solana.com/docs.md) lists every page and [llms.txt](https://platform.solana.com/docs/ai/llms.txt) the key ones; [SKILL.md](https://platform.solana.com/SKILL.md) has the rules for building on SDP.

# Create subscription plan

Creates a recurring-payment subscription plan record.

`POST /v1/payments/subscription-plans`

This stores SDP backend state and Solana subscriptions program identifiers; it does not by itself create the on-chain plan.

Requires an [API key](/docs/developing-with-sdp/authentication) with the `recurring.manage` action.

## Headers

- **`x-project-id`** · `string` · min length 1 · example `prj_example`

  Required for dashboard sessions. API keys use their assigned project.

- **`Idempotency-Key`** · `string`

  Use a unique 1–255 printable ASCII key per operation. Reuse it with the same request on retries. An in-flight attempt returns `409`; a changed request returns `422`. [Retry and recovery rules](/docs/developing-with-sdp/idempotency).

## Request body

`application/json` · required

Creates an SDP subscription plan record. Prepare the on-chain Solana subscriptions program transaction separately with the plan prepare endpoint.

- **`ownerWalletId`** · `string` · required · min length 1 · example `wal_merchant`

  Custody wallet that owns the Solana subscription plan.

- **`token`** · `string` · required · example `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`

  Token mint address. Native SOL is not expected for program-backed subscriptions.

- **`amount`** · `string` · required · example `25.00`

  Recurring charge amount in UI units.

- **`periodHours`** · `integer` · required · greater than 0 · max 8760 · example `720`

  Billing period length in hours.

- **`programPlanId`** · `string` · pattern `^\d+$` · example `17014118346046923173`

  Unsigned 64-bit decimal program plan identifier used in the Solana subscriptions PDA seed. Defaults to a generated nonzero value.

- **`planPda`** · `string` · example `7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU`

  On-chain plan PDA once created.

- **`destinationAddress`** · `string` · example `7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU`

  Optional destination owner address allowed by the on-chain plan.

- **`pullerWalletId`** · `string` · min length 1 · example `wal_collector`

  Optional SDP custody wallet allowed to pull subscription payments.

- **`metadataUri`** · `string` · format `uri` · max length 128 · example `https://example.com/subscriptions/monthly-usdc.json`

  Optional plan metadata URI.

- **`status`** · `string` · one of `draft`, `active`, `archived` · example `active`

  Subscription plan status.

## Responses

- **`201`** Subscription plan created

  - **`data`** · `object` · required

    Subscription plan response payload.

    - **`subscriptionPlan`** · `object` · required

      Recurring payment subscription plan record.

      - **`id`** · `string` · required · example `psp_example`

        SDP subscription plan ID.

      - **`organizationId`** · `string` · required · min length 1 · example `org_example`

        Organization identifier.

      - **`projectId`** · `string` · required · min length 1 · example `prj_example`

        Project identifier.

      - **`ownerWalletId`** · `string` · required · min length 1 · example `privy_wallet_123`

        Provider wallet ID — the `walletId` field returned by GET /v1/wallets.

      - **`ownerAddress`** · `string` · required · min length 32 · max length 44 · example `So11111111111111111111111111111111111111112`

        Base58-encoded Solana address.

      - **`token`** · `string` · required

        Token mint or normalized token identifier.

      - **`amount`** · `string` · required · example `100.00`

        Token amount in UI units (decimal string).

      - **`periodHours`** · `integer` · required · greater than 0 · example `720`

      - **`programPlanId`** · `string` · required · example `17014118346046923173`

        Unsigned 64-bit decimal program plan identifier used in PDA derivation.

      - **`planPda`** · `string | null` · required · min length 32 · max length 44 · example `So11111111111111111111111111111111111111112`

        On-chain plan PDA.

      - **`destinationAddress`** · `string | null` · required · min length 32 · max length 44 · example `So11111111111111111111111111111111111111112`

        Allowed destination owner address.

      - **`pullerWalletId`** · `string | null` · required · min length 1 · example `privy_wallet_123`

        Collector wallet ID.

      - **`pullerAddress`** · `string | null` · required · min length 32 · max length 44 · example `So11111111111111111111111111111111111111112`

        Collector wallet address.

      - **`metadataUri`** · `string | null` · required

        Optional plan metadata URI.

      - **`status`** · `string` · required · one of `draft`, `active`, `archived` · example `active`

        Subscription plan status.

      - **`createdBy`** · `string | null` · required

        Creator user ID or API key ID.

      - **`createdAt`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

        ISO 8601 timestamp.

      - **`updatedAt`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

        ISO 8601 timestamp.

  - **`meta`** · `object` · required

    Response metadata.

    - **`requestId`** · `string` · required · min length 1 · example `req_example`

      Request identifier for tracing.

    - **`timestamp`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

      ISO 8601 timestamp.

- **`400`** Bad Request

  - **`error`** · `object` · required

    Standard error payload.

    - **`code`** · `string` · required

      Machine-readable error code.

    - **`message`** · `string` · required

      Human-readable error message.

    - **`details`** · `object`

      Optional error details for debugging.

      - **`*`** · `any`

  - **`meta`** · `object`

    - **`requestId`** · `string` · min length 1 · example `req_example`

      Request identifier for tracing.

- **`401`** Unauthorized

  Same fields as `400`.

- **`403`** Forbidden. Requires the `recurring.manage` action: an API key must hold it (a module's `manage` or `execute` also covers its `read`), and a signed-in member's organization role must include it. Without it the error is INSUFFICIENT_PERMISSIONS and `error.details.action` names the action. Any other 403 names its own reason.

  Same fields as `400`.

- **`404`** Not Found

  Same fields as `400`.

- **`409`** Conflict

  Same fields as `400`.

- **`422`** Unprocessable Entity

  Same fields as `400`.

- **`500`** Internal Server Error

  Same fields as `400`.

## Example request

```bash tab="cURL"
curl -X POST 'https://api.solana.com/v1/payments/subscription-plans' \
  -H "Authorization: Bearer $SDP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "ownerWalletId": "wal_merchant",
    "token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "amount": "25.00",
    "periodHours": 720,
    "programPlanId": "17014118346046923173",
    "planPda": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "destinationAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "pullerWalletId": "wal_collector",
    "metadataUri": "https://example.com/subscriptions/monthly-usdc.json",
    "status": "active"
  }'
```

```ts tab="TypeScript"
const res = await fetch("https://api.solana.com/v1/payments/subscription-plans", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SDP_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "ownerWalletId": "wal_merchant",
    "token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "amount": "25.00",
    "periodHours": 720,
    "programPlanId": "17014118346046923173",
    "planPda": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "destinationAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "pullerWalletId": "wal_collector",
    "metadataUri": "https://example.com/subscriptions/monthly-usdc.json",
    "status": "active"
  })
});
```

```python tab="Python"
import os, requests, uuid

r = requests.post("https://api.solana.com/v1/payments/subscription-plans",
  headers={"Authorization": f"Bearer {os.environ['SDP_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
  json={
    "ownerWalletId": "wal_merchant",
    "token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "amount": "25.00",
    "periodHours": 720,
    "programPlanId": "17014118346046923173",
    "planPda": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "destinationAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "pullerWalletId": "wal_collector",
    "metadataUri": "https://example.com/subscriptions/monthly-usdc.json",
    "status": "active"
  })
```

## Example responses

```json tab="201"
{
  "data": {
    "subscriptionPlan": {
      "id": "psp_example",
      "organizationId": "org_example",
      "projectId": "prj_example",
      "ownerWalletId": "privy_wallet_123",
      "ownerAddress": "So11111111111111111111111111111111111111112",
      "token": "example",
      "amount": "100.00",
      "periodHours": 720,
      "programPlanId": "17014118346046923173",
      "planPda": "So11111111111111111111111111111111111111112",
      "destinationAddress": "So11111111111111111111111111111111111111112",
      "pullerWalletId": "privy_wallet_123",
      "pullerAddress": "So11111111111111111111111111111111111111112",
      "metadataUri": "example",
      "status": "active",
      "createdBy": "example",
      "createdAt": "2025-01-01T00:00:00.000Z",
      "updatedAt": "2025-01-01T00:00:00.000Z"
    }
  },
  "meta": {
    "requestId": "req_example",
    "timestamp": "2025-01-01T00:00:00.000Z"
  }
}
```

```json tab="403"
{
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "Missing action: recurring.manage",
    "details": {
      "action": "recurring.manage"
    }
  },
  "meta": {
    "requestId": "req_example"
  }
}
```

Error responses use the [standard error shape](/docs/reference/conventions/errors).
