latestOpenAPI 3.0.32026-08-20146131.7 MB

672b1916ba61

Payments

Update recurring payment

Updates an SDP-custody recurring payment. Pending records are updated directly. Active metadata and due-date edits are applied in place, while active term, source, destination, or token edits create a replacement Solana subscription, authorize it, cancel the old subscription, and then swap the recurring payment to the replacement records.

patch/v1/payments/recurring-payments/{id}

Path parameters

idstring required

SDP recurring payment record ID.

Example:prp_example

SDP recurring payment 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

sourceWalletIdstring

Optional replacement SDP custody wallet — the walletId field returned by GET /v1/wallets. The wallet record id and the public key are not accepted. Active replacements require write access to both the old and new source wallets.

counterpartyIdstring

Optional replacement counterparty. When provided, counterpartyAccountId is also required.

counterpartyAccountIdstring

Optional replacement counterparty account. Without counterpartyId, this changes the account for the current counterparty.

tokenstring

Optional replacement token. Must be a USD stablecoin (e.g. USDC) or a token issued in this project; native SOL is not supported.

amountstring

Optional replacement amount in UI units.

periodHoursinteger

Optional replacement billing period length in hours. Active term changes create a replacement on-chain subscription.

firstCollectionAtstring date-time nullable

Pending-only first collection timestamp. Use null to clear the pending first collection override.

nextCollectionDueAtstring date-time nullable

Active-only next due timestamp. Use null to reset to the earliest eligible collection time.

metadataUristring uri nullable

Optional plan metadata URI. Use null to clear it. Active metadata-only edits update the existing on-chain plan in place.

Example request

{
  "sourceWalletId": "privy_wallet_123",
  "counterpartyId": "cp_example",
  "counterpartyAccountId": "cpa_example",
  "token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "amount": "25.00",
  "periodHours": 720,
  "firstCollectionAt": "2099-01-01T00:00:00.000Z",
  "nextCollectionDueAt": "2099-02-01T00:00:00.000Z",
  "metadataUri": "https://example.com/subscriptions/monthly-usdc.json"
}

Response

Recurring payment updated

Example response

{
  "data": {
    "recurringPayment": {
      "id": "prp_example",
      "organizationId": "org_example",
      "projectId": "prj_example",
      "sourceWalletId": "privy_wallet_123",
      "sourceAddress": "So11111111111111111111111111111111111111112",
      "counterpartyId": "cp_example",
      "counterpartyAccountId": "cpa_example",
      "destinationAddress": "So11111111111111111111111111111111111111112",
      "destinationTokenAccount": "So11111111111111111111111111111111111111112",
      "amount": "100.00",
      "periodHours": 720,
      "firstCollectionAt": "2025-01-01T00:00:00.000Z",
      "nextCollectionDueAt": "2025-01-01T00:00:00.000Z",
      "planPda": "So11111111111111111111111111111111111111112",
      "subscriptionPda": "So11111111111111111111111111111111111111112",
      "subscriptionAuthorityAddress": "So11111111111111111111111111111111111111112",
      "status": "active",
      "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"
  }
}