payment_qr | A scannable code for a payment request, so nobody retypes an address.
Pass the `payment_uri` from `prepare_escrow_payment`. Returns a QR a phone wallet can scan,
with the token, network, destination and amount already in it.
Or pass its `share_with_payer.pay_link`, for a code that opens the payment on the site
instead — what to hand someone who is being asked to pay, as the site's own requests do.
⚠️ A SEPARATE TOOL RATHER THAN PART OF `prepare`, because the two have different audiences.
`prepare` answers a machine and has to stay parseable; an image in its result would make
the structured fields something a client has to dig for. A person who needs the code asks
for it.
⚠️ AND IT ENCODES THE URI, NOT THE BARE ADDRESS. A QR holding only an address leaves the
amount and the token to be entered by hand, which is the part worth removing — a payment contract
funded with the wrong figure is not the payment contract these terms derive to, and the money sits
at an address nothing can deploy to. |
prepare_escrow_payment | Work out where a payment must go, before anybody signs or sends anything.
`seller` and `nominal_buyer` may each be a wallet address OR AN EMAIL ADDRESS — an email is
converted to the wallet that person owns, so you never need to know a wallet to use this.
The parties are checked against the sanctions lists before an address is given. If any of
them is listed the answer is `error: sanctioned_party` with no address, and the payment
cannot be made through this service.
Returns the payment address these terms produce, and TWO ways to fund it. Both end at the
same address holding the same money; they differ only in who sends the transaction.
**Transfer it yourself.** Send the tokens to the address from any wallet — a browser
wallet, a hardware wallet, an exchange withdrawal. Nothing to sign for us, and no `payer`
needed, because the payment contract never asks who paid: it reads its own balance. Then call
`settle_escrow_payment` with no signature and we create the payment contract around what is there.
**Or let us relay it.** Pass `payer` and this returns an EIP-3009 authorization for them to
sign. We broadcast it and pay the gas, so **the payer needs no gas at all**. This is the
only one an agent can complete unattended, and the only one that needs a key anywhere.
Either way the address is the same, because it is a pure function of the terms. That is
also what makes the relayed form safe: the payer signs `to` as part of the authorization,
committing to every term at once — alter any of them afterwards and the address moves and
the signature stops matching.
`amount` is in the TOKEN's base units (1 USDC = 1000000), because that exact figure is one
of the terms the address derives from.
`expiry_timestamp` is an absolute Unix time — when the dispute window closes. `0` settles
instantly with no recourse. There is no default: "instant, deliberately" and "nobody said"
are different, and a caller must not discover afterwards which one they got.
`nominal_buyer` is who may dispute and receives a refund. For an agentic payment this should
be the PERSON, not the agent — they are the one who will later read a report and decide
whether to object.
**`seller` and `nominal_buyer` may each be a wallet address OR an email address.** An email
resolves to the wallet Privy holds for that person — made for them if they have never
logged in — and the same email always resolves to the same wallet, so the address derived
here is the one `settle_escrow_payment` derives too. The resolved wallets come back under
`parties`. A seller given by email is paid into that wallet; they sign in with the email to
reach it.
`external_id` keeps two otherwise-identical payments apart, and is one of the terms the
address derives from. **Leave it out and a unique one is generated.** That is the right
default: two payments matching in seller, amount, maturity and buyer would otherwise derive
to the SAME address, and funding the second sends money into the first payment contract — recoverable
only after that one is claimed, and only to ITS buyer.
⚠️ PASS BACK THE `external_id` THIS RETURNS, not the one you sent. A generated one is only
knowable from the result, and settle derives the address again from whatever it is given:
a different id is a different address, and the money is at this one.
Supply your own for the opposite behaviour — a checkout hash gives "one checkout, one
payment contract", so re-presenting the same purchase returns the same address rather than a second.
`description` is what the payment is FOR, in the buyer's own words — ask them for it rather
than defaulting. It is what they will be looking at in the dashboard weeks later deciding
whether to dispute, and "Protected payment" tells them nothing about which one this was. It
does not affect the address, so it can be set freely here.
`brand` is the white-label partner the payment is being made under, if any (the `?b=` id,
e.g. `escrow-me`). It is recorded on the contract for attribution only: it does not affect
the address, and a malformed one is ignored rather than refused.
`product_name` is what is being bought, shown on both parties' dashboards. Display only, like
`brand`. A seller or nominal buyer given by email is recorded with that email as well, so the
payment contract shows to them the way a request made on the site does.
⚠️ 1 to 160 characters. Longer is refused HERE rather than at the chain, where the check
happens after the money has already moved.
`arbiter` is who decides a dispute. Leave it out for the default arbiter, which is almost
always right. It is one of the terms the address derives from, so pass the same value to
`settle_escrow_payment`. |
read_published_page | Read one of the published pages, for answering questions about how any of this works.
Use it rather than guessing. What the fees are, how a dispute is decided and who decides it,
what a buyer is agreeing to — all of it is written down, and none of it is safe to invent.
how-it-works How an protected payment works, start to finish
faq Common questions about protected payments, fees, disputes and timing
arbitration-policy How a dispute is decided, by whom, and on what evidence
terms-of-service The terms a buyer and seller are agreeing to
privacy-policy What is collected and why
plugins The WordPress and Shopify integrations
home What the product is and who it is for |
settle_escrow_payment | Create the payment contract around the money and return a signed receipt.
`seller` and `nominal_buyer` may be wallet addresses OR EMAIL ADDRESSES, exactly as in
`prepare_escrow_payment`; an email converts to the same wallet it did there.
Works both ways, and which one runs is decided by whether you pass a signature:
**Already transferred it yourself** — omit `authorization` and `signature`. We check the
address holds the amount and build the payment contract around what is there. If the transfer has not
arrived it says so, and nothing is spent finding out.
**Want us to relay it** — pass the payer's `authorization` and `signature`. We broadcast it
and pay the gas, so the payer needs none. This process holds no key and signs nothing; it
is handed a signature and carries it.
Pass the terms exactly as they were prepared. They ARE the payment contract's address, so a single
altered figure moves it — and with a signature, stops matching what the payer signed.
`seller` and `nominal_buyer` may be wallet addresses or email addresses, as in
`prepare_escrow_payment`; an email resolves to the same wallet it did there.
⚠️ `external_id` MUST BE THE ONE `prepare_escrow_payment` RETURNED. It generates one when
you leave it out, and that generated value is only knowable from its result — send a
different one and this derives a different address, while the money is at the first.
⚠️ The receipt reports what the seller will actually RECEIVE in `token_amount`, with the
platform fee named beside it. That is less than the amount authorised, and the two
reconcile: token_amount + creator_fee = amount.
`brand` is the white-label partner, as in `prepare_escrow_payment`: attribution only, and
ignored when malformed.
`arbiter`, when one was passed to `prepare_escrow_payment`, must be passed here too: it is a
term, and leaving it out derives the default arbiter's address instead. |