Recurring payments

Session for restoring the allowance one subscription needs

INSUFFICIENT_ALLOWANCE is not a dead subscription. The authorization the customer signed is intact and the seller can still collect; what ran short is the ERC-20 allowance, and the fix is one approve() from the customer's own wallet - no new signature, no new subscription.

This exchanges the capability for the narrowest browser-facing token P2Flux issues: the payer, the spender (the recurring contract), the token and how much the next charge will pull. It carries no authorization struct and no signature, so it cannot be turned into a capability, cannot build revoke() and cannot prepare a refund. Hand it to the customer at <checkout>/#/approve/<approve_token>.

Short-lived by design - it only has to survive the walk from your account page to a wallet confirmation.

post/v1/allowances/restore/session

Request

  • Base URL: https://api.p2flux.com
  • URL: https://api.p2flux.com/v1/allowances/restore/session
  • Auth: none required

Request body

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 session, and who must send the approval.

approve_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

Unix seconds.

payerstring

An EVM address.

subscription_idstring

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

Example response

{
  "payer": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
  "subscription_id": "0x2d6bbc112885a6976289e599f71003f7d310e7152ebd662c6221dffd3e0da708"
}

Changes

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