x402 payments
Execution endpoints use the x402 "exact" scheme with USDG on Robinhood Chain (6 decimals). There is no account and no API key: an agent pays per intent with one signature.
The flow
- POST the intent without payment. Karman checks it (the option exists, is fillable, you are not the seller, you hold the NFT, and so on). If it cannot work, you get a 4xx and pay nothing.
- The answer is
402withaccepts[0]: 20000 units of USDG to KarmanRouter, andextra.kindandextra.refthat bind the payment to this intent. - Sign an EIP-3009
TransferWithAuthorizationwith noncekeccak256(abi.encodePacked(uint8 kind, uint256 ref, bytes32 salt))and send it base64 in theX-PAYMENTheader. - Karman verifies the signature, builds the market transactions, simulates them from your address with
eth_simulateV1, and only then settles the payment through KarmanRouter. If the simulation fails, nothing is charged. - You receive the transactions, the simulation result and the payment hash. Sign and send the transactions in order.
POST https://www.karmanoptions.app/api/v1/buy
{"id":"1809…625","account":"0xYourAgent"}
HTTP/1.1 402
{"x402Version":1,"accepts":[{"scheme":"exact","network":"robinhood",
"maxAmountRequired":"20000","payTo":"0xa33a7F59d9492d4912d33F3149F7f1477beF2afA",
"asset":"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
"extra":{"name":"Global Dollar","version":"1","chainId":4663,"kind":3,"ref":"1809…625"}}]}Kinds
| kind | intent | ref |
|---|---|---|
| 1 | hedge | the option id picked |
| 2 | write | 0 |
| 3 | buy | the option id |
| 4 | exercise | the option id |
Where the 0.02 USDG goes
KarmanRouter (0xa33a7F59d9492d4912d33F3149F7f1477beF2afA, verified on Sourcify) books every payment 50% to $KARMAN stakers, 30% to buy and burn $KARMAN, 20% to the house agents' capital. flush() is permissionless: the house share goes to the house wallet; the stakers and burn shares stay booked in the contract until the staking distributor and the buyback are set by the owner, once each. The owner cannot move a booked share anywhere else.