latestOpenAPI 3.0.32026-08-20146131.7 MB

672b1916ba61

Payments

Prepare subscription plan creation

Prepares an unsigned Solana subscriptions program create-plan transaction from an SDP subscription plan. This derives and stores the plan PDA but does not submit the transaction.

post/v1/payments/subscription-plans/{planId}/prepare-create

Path parameters

planIdstring required

SDP subscription plan record ID.

Example:psp_example

SDP subscription plan record ID.

Headers

x-project-idstring

Selects the active project for this request. Required for session/dashboard callers. Ignored when authenticating with an API key, whose scope is fixed to the key's project.

Example:prj_example

Selects the active project for this request. Required for session/dashboard callers. Ignored when authenticating with an API key, whose scope is fixed to the key's project.

Request body

destinationsstring[]

Allowed destination addresses for the on-chain plan. Defaults to the stored plan destination.

pullersstring[]

Allowed puller addresses for the on-chain plan. Defaults to the stored puller or owner address.

endTsstring

Optional unsigned 64-bit Unix timestamp when the on-chain plan ends.

metadataUristring uri

Optional metadata URI to embed in the on-chain plan.

Example request

{
  "endTs": "1770000000",
  "metadataUri": "https://example.com/subscriptions/monthly-usdc.json"
}

Response

Subscription plan creation prepared

Example response

{
  "data": {
    "subscriptionPlan": {
      "id": "psp_example",
      "organizationId": "org_example",
      "projectId": "prj_example",
      "ownerWalletId": "privy_wallet_123",
      "ownerAddress": "So11111111111111111111111111111111111111112",
      "amount": "100.00",
      "periodHours": 720,
      "programPlanId": "17014118346046923173",
      "planPda": "So11111111111111111111111111111111111111112",
      "destinationAddress": "So11111111111111111111111111111111111111112",
      "pullerWalletId": "privy_wallet_123",
      "pullerAddress": "So11111111111111111111111111111111111111112",
      "status": "active",
      "createdAt": "2025-01-01T00:00:00.000Z",
      "updatedAt": "2025-01-01T00:00:00.000Z"
    },
    "planPda": "So11111111111111111111111111111111111111112",
    "preparedTransaction": {
      "serialized": "AQID",
      "blockhash": "blockhash_example",
      "lastValidBlockHeight": "123456",
      "requiredSigners": [
        "So11111111111111111111111111111111111111112"
      ]
    }
  },
  "meta": {
    "requestId": "req_example",
    "timestamp": "2025-01-01T00:00:00.000Z"
  }
}