Payment flow
Steps
1
x402 request
The client calls a protected endpoint. Middleware looks for a payment proof; if there isn’t one, the server returns 402 with payment instructions (currency, encryption scheme, proof system, verify and settle endpoints).
2
ZK proof generation (client-side)
Takes 5–10 seconds. The proof shows the sender has enough funds without revealing the amount. The amount is ElGamal-encrypted and accompanied by a range proof.
3
Proof verification
The Numpay verifier checks the proof, its public signals and the phone-to-wallet mapping, then returns a short-lived JWT payment token.
4
Payment settlement
The client submits the token. The relayer decrypts the amount server-side, signs and executes the settlement through a smart contract. The user pays no gas.
5
On-chain confirmation
An escrow balance is updated atomically, or a direct wallet-to-wallet transfer is made. The phone mapping stays encrypted.
6
Resource delivery
The API server validates the payment token, grants access and returns
200 OK.
