Payment links

Join a subscription link with its first payment (buyer)

What the buyer's checkout calls after the ordinary signup (/v1/links/open setup token, then /v1/subscriptions/finalize, unchanged): the subscription capability just signed, and the link. P2Flux charges the first period at once and keeps the subscription for automatic collection ONLY when that charge landed or is on its way - nothing is kept for a signup that is not paid. The signed terms must be exactly the link's, freshly opened (start within the setup's 15 minutes). One live subscription per wallet per link: a different one answers ALREADY_SUBSCRIBED; repeating the same capability is harmless and answers its current state. While the first charge is confirming, or a USDC approval sent with the signup is still confirming (INSUFFICIENT_ALLOWANCE), ask again.

post/v1/links/subscribe

Request

  • Base URL: https://api.p2flux.com
  • URL: https://api.p2flux.com/v1/links/subscribe
  • Auth: none required

Request body

linkstring required

A signed P2Flux capability: payment intent (p2f1.), setup token (p2setup2.), subscription capability (p2s2.), cancel token (p2cancel1.) or refund token (p2refund1.). Opaque to the caller and unforgeable - the signature is what authorises the call. Treat it as a bearer secret: keep it server-side, never in a URL query or a log.

subscriptionstring required

A signed P2Flux capability: payment intent (p2f1.), setup token (p2setup2.), subscription capability (p2s2.), cancel token (p2cancel1.) or refund token (p2refund1.). Opaque to the caller and unforgeable - the signature is what authorises the call. Treat it as a bearer secret: keep it server-side, never in a URL query or a log.

Response

The first charge, and who collects the renewals.

status'CHARGED' | 'ALREADY_CHARGED' | 'CONFIRMING'
period_indexinteger
tx_hashstring

A 32-byte hex value, lowercase. Transaction hashes and references.

next_period_atstring
subscription_idstring

A 32-byte hex value, lowercase. Transaction hashes and references.

collected_by'p2flux' | 'merchant'

merchant while automatic collection is switched off: the merchant collects with Collect now.

Example response

{
  "tx_hash": "0x2d6bbc112885a6976289e599f71003f7d310e7152ebd662c6221dffd3e0da708",
  "subscription_id": "0x2d6bbc112885a6976289e599f71003f7d310e7152ebd662c6221dffd3e0da708"
}

Changes

No recorded changes to this operation across all 1 revision of this API.