Recurring payments

Exchange a signature for a charge capability

Validates the customer's signature against the terms and returns the p2s2 capability that charges this subscription. Contract wallets are supported (ERC-1271).

Store the capability. It is bearer authorization bound to one subscription's signed terms - keep it server-side, encrypted at rest, and never send it to a browser. Losing it means you cannot charge; leaking it means somebody else can, though only ever to the recipient the customer signed for.

post/v1/subscriptions/finalize

Request

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

Request body

setup_tokenstring 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.

payerstring required

An EVM address.

signaturestring required

An EIP-712 signature. Contract wallets (ERC-1271) are supported.

Example request

{
  "payer": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9"
}

Response

The capability and the subscription identity.

subscriptionstring

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.

subscription_idstring

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

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.

periodinteger
endinteger

Example response

{
  "subscription_id": "0x2d6bbc112885a6976289e599f71003f7d310e7152ebd662c6221dffd3e0da708",
  "amount": "10.00"
}

Changes

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