Payments

Prepare subscription authorization

Changed on

Prepares the subscriber-signed Solana transaction that initializes the subscription authority and subscribes to the plan. The transaction must still be signed and submitted by the client. A subscriber that is one of the organization's SDP wallets answers 409: pay from an SDP wallet through a recurring payment.

post/v1/payments/subscriptions/{subscriptionId}/prepare-authorization

Request

  • Base URL
    http://localhost:8787
  • URL
    http://localhost:8787/v1/payments/subscriptions/{subscriptionId}/prepare-authorization
  • Auth
    HTTP bearer

Path parameters

subscriptionIdstring required

SDP subscription record ID.

Example:psub_example

Headers

x-project-idstring

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

Example:prj_example

Request body

subscriberTokenAccountstring required

Subscriber token account that authorizes the subscription authority delegation.

expectedPlanCreatedAtstring required

Unsigned 64-bit created-at timestamp from the on-chain plan terms that the subscriber consents to.

expectedSubscriptionAuthorityInitIdstring required

Signed 64-bit init id from the on-chain subscription authority that the subscriber consents to.

Example request

{
  "subscriberTokenAccount": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
  "expectedPlanCreatedAt": "0",
  "expectedSubscriptionAuthorityInitId": "0"
}

Response

Subscription authorization prepared

Example response

{
  "data": {
    "subscription": {
      "id": "psub_example",
      "organizationId": "org_example",
      "projectId": "prj_example",
      "subscriberAddress": "So11111111111111111111111111111111111111112",
      "subscriberTokenAccount": "So11111111111111111111111111111111111111112",
      "subscriptionPda": "So11111111111111111111111111111111111111112",
      "subscriptionAuthorityAddress": "So11111111111111111111111111111111111111112",
      "status": "active",
      "currentPeriodStartAt": "2025-01-01T00:00:00.000Z",
      "nextCollectionDueAt": "2025-01-01T00:00:00.000Z",
      "cancelAt": "2025-01-01T00:00:00.000Z",
      "canceledAt": "2025-01-01T00:00:00.000Z",
      "createdAt": "2025-01-01T00:00:00.000Z",
      "updatedAt": "2025-01-01T00:00:00.000Z"
    },
    "subscriptionPda": "So11111111111111111111111111111111111111112",
    "subscriptionAuthorityAddress": "So11111111111111111111111111111111111111112",
    "preparedTransaction": {
      "serialized": "AQID",
      "blockhash": "blockhash_example",
      "lastValidBlockHeight": "123456",
      "requiredSigners": [
        "So11111111111111111111111111111111111111112"
      ]
    }
  },
  "meta": {
    "requestId": "req_example",
    "timestamp": "2025-01-01T00:00:00.000Z"
  }
}

Changes

    • warning

      added the new CUSTODY_POLICY_REFUSED enum value to the / response property for the response status

    • warning

      added the new CUSTODY_POLICY_REFUSED enum value to the / response property for the response status

    • warning

      added the new CUSTODY_POLICY_REFUSED enum value to the / response property for the response status

    • warning

      added the new CUSTODY_POLICY_REFUSED enum value to the / response property for the response status

    • warning

      added the new CUSTODY_POLICY_REFUSED enum value to the / response property for the response status

    • info

      added the non-success response with the status

    • warning

      added the new RPC_UNAVAILABLE enum value to the / response property for the response status

    • warning

      added the new RPC_UNAVAILABLE enum value to the / response property for the response status

    • warning

      added the new RPC_UNAVAILABLE enum value to the / response property for the response status

    • warning

      added the new RPC_UNAVAILABLE enum value to the / response property for the response status

    • warning

      added the new RPC_UNAVAILABLE enum value to the / response property for the response status

    • warning

      added the new SPONSORED_RENT_OVER_CAP enum value to the / response property for the response status

    • warning

      added the new SPONSORED_RENT_OVER_CAP enum value to the / response property for the response status

    • warning

      added the new SPONSORED_RENT_OVER_CAP enum value to the / response property for the response status

    • warning

      added the new SPONSORED_RENT_OVER_CAP enum value to the / response property for the response status

    • warning

      added the new SPONSORED_RENT_OVER_CAP enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_DESTINATION_CHANGED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_DESTINATION_CHANGED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_DESTINATION_CHANGED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_DESTINATION_CHANGED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_DESTINATION_CHANGED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_NOTHING_TO_RETRY enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_NOTHING_TO_RETRY enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_NOTHING_TO_RETRY enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_NOTHING_TO_RETRY enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_NOTHING_TO_RETRY enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RETRY_CLAIMED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RETRY_CLAIMED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RETRY_CLAIMED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RETRY_CLAIMED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RETRY_CLAIMED enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RUN_EXISTS enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RUN_EXISTS enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RUN_EXISTS enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RUN_EXISTS enum value to the / response property for the response status

    • warning

      added the new TRANSFER_BATCH_RUN_EXISTS enum value to the / response property for the response status