Recurring payments

Read an allowance-restore session back

For the browser holding the session: the terms of the approval to ask for. Terms only - the transaction is the customer's own standard ERC-20 approve(), which their wallet builds and sends.

The spender is P2Flux's recurring contract, taken from the signed session. A screen that accepted a spender from its own input would be a phishing page.

post/v1/allowances/restore/resolve

Request

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

Request body

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

gas_payment_mode'native' | 'payment_token'

With payment_token the response also carries a price and the two messages the customer signs, and P2Flux sends the transaction. Without it the response describes the customer's own approve(), as before.

allowance_units'0'

Only "0" is accepted, and it prices a REMOVAL of the allowance instead of a restore. The quote returned is bound to that operation: a removal quote is refused on a restore submit and vice versa. Absent means "restore what this subscription needs".

Response

What to approve, and who must approve it.

chain_idinteger
tokenstring

An EVM address.

spenderstring

An EVM address.

payerstring

An EVM address.

subscription_idstring

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

required_unitsstring

An integer count of micro-USDC (6 decimals), as a string. 2500000 is 2.50 USDC. Used wherever a decimal would invite a rounding error - notably refund amounts.

expires_atinteger
approve_unitsstring nullable

What to approve, in base units; null means unlimited. The subscription's own setup mode, so a bounded allowance is not widened on repair.

recipientstring

An EVM address.

Example response

{
  "token": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
  "spender": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
  "payer": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
  "subscription_id": "0x2d6bbc112885a6976289e599f71003f7d310e7152ebd662c6221dffd3e0da708",
  "required_units": "2500000",
  "recipient": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9"
}

Changes

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