TheWavlyDocs
DocsGet started

How TheWavly works

TheWavly sits between an AI agent's decision to buy and the payment. It records what the user approved, checks each purchase against it, and keeps a signed record that the user, the merchant, the payment provider and a reviewer can all verify. TheWavly never holds or moves money.

The lifecycle

StepWhoObjectWhat happens
1. ApproveThe user, through your appMandateTheir instruction and the rules a purchase must meet are recorded and signed.
2. CheckThe agent, just before payingCheckThe purchase is compared with the mandate: proceed, ask or stop, with a signed receipt.
3. AskThe userApprovalWhen a purchase goes beyond the mandate, the user approves or declines that exact purchase.
4. PayThe store or payment providerPayment tokenThe charge uses a single-use token for at most the checked amount, to the checked payee.
5. ReconcileYou or the providerPaymentReal debits are matched to the checks that allowed them.
6. SettleThe parties and a reviewerDisputeIf something went wrong, the records decide who carries it.

Mandates

A mandate is what the user approved, in their words and as rules. instruction keeps their words verbatim. rules is what a check enforces:

RuleWhat it limits
itemsWhat may be bought. "*" allows any item. Matching ignores case and extra spaces.
max_amount_paiseThe most for one purchase. Above it, the check asks.
budget_paiseThe total across purchases. Paid plus held plus this purchase above it, and the check asks.
max_purchasesHow many purchases. More, and the check asks.
payees, merchantsWho may be paid. A UPI payee is compared as the payment network reads it, so look-alike characters do not match.
deliver_toThe recipient, when the mandate names one.
conditionsTerms the seller must meet, such as refundable or free_cancellation_hours of at least 24. A failed condition stops; a missing one asks.
require_agent_signatureRefuse checks that are not signed by a registered agent key.

A mandate expires after 30 days unless you set expires_at or expires_in_seconds. To change one, create a new version with previous: both versions stay provable. Revoking a mandate makes every later check stop.

Checks and decisions

A check compares one purchase with one mandate. Each field gets a result of match, ask or stop, and the decision follows the strictest:

FieldIf it fails
Mandate active (not revoked, expired or superseded)stop
Item, UPI payee, merchant, deliver to, currencystop
A condition the seller's terms breakstop
Amount above the per-purchase limitask
Paid plus held plus this purchase above the budgetask
More purchases than allowedask
A condition the agent did not reportask

On proceed the amount is held against the budget for 30 minutes, so two agents cannot spend the same budget at once. The hold is released when you report a failed or cancelled outcome, or when it expires.

Tip: Send the terms the seller showed in purchase.terms, exactly as shown. Conditions are checked against them, and they become evidence if the purchase is disputed.

Approvals

When a check answers ask, it carries an approval with a url for the user, valid for 15 minutes by default (approval_ttl_seconds on the mandate). approval.share has ready links to send it by WhatsApp or SMS, and a Hindi version. The page shows the user exactly what is being bought and why it needs their answer. Once they approve, the check can proceed and a fresh payment token is issued. Listen for the approval.approved and approval.declined webhooks.

Receipts and verification

Every check has a receipt: a compact signed token naming the check, the mandate version, the decision and a hash of the purchase. It holds no personal data. Anyone can verify it with your organisation's public keys at /v1/orgs/{org}/jwks, in the browser at verify_url, or offline with the open verifier. The full evidence pack for a check (the mandate chain, the receipt, the approval and the audit trail, signed as one document) is at GET /v1/checks/{id}/evidence.

Payment tokens

A check that may proceed carries payment_token: permission to charge at most the checked amount, to the checked payee, until the hold ends. The agent hands it to the store or payment provider, which redeems it once, just before charging, with no TheWavly key. A second use, a higher amount or another payee is refused. Redemption returns a release_key, which gives the approval back if the charge then fails. See For payment providers.

Agents, keys and the registry

Pass agent on mandates and checks to build each agent's track record and TheWavly Score. An agent can sign each check with its own key (agent_signature), so a check proves which agent asked. Agents in the public registry are registered by the company that runs them, which proves it controls the agent's website. A store can then verify the agent and its payment in one call.

Disputes

A dispute is opened on a check with one of seven reasons. TheWavly suggests a finding from the records, the parties add evidence, and a named reviewer records a signed finding and remedy. One appeal to a different reviewer is allowed within 14 days. See Disputes and findings.

Test and live mode

Test and live data never mix. Test keys (sk_test_…) only see test data and are free. Live keys (sk_live_…) need a confirmed email, and their checks are billed. See Test mode and sandbox.