Recurring payments

Create subscription terms and a setup token

Terms for a recurring authorization the customer signs once. P2Flux has no scheduler and no database: your application owns the subscription lifecycle and decides when a renewal is due; the contract enforces one charge per period against the terms that were signed.

post/v1/subscriptions

Request

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

Request body

recipientstring required

An EVM address.

amountstring required

A USDC amount as a decimal string, up to 6 decimal places. Never a JSON number: binary floating point cannot represent most decimal prices exactly, and this is money.

periodinteger required

Billing period in seconds. Minimum 3600 in production.

endinteger

Unix seconds, or 0 for no end date.

Example request

{
  "recipient": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
  "amount": "10.00"
}

Response

A setup token to hand to the checkout.

setup_tokenstring

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.

expires_atinteger
chain_idinteger
contractstring

An EVM address.

amountstring

A USDC amount as a decimal string, up to 6 decimal places. Never a JSON number: binary floating point cannot represent most decimal prices exactly, and this is money.

saltstring

Example response

{
  "contract": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
  "amount": "10.00"
}

Changes

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