billing.pay
Settle an x402 or MPP payment and get its credits and API key.
Details
- Endpoint
- POST /v1/billing/pay
- Credits
- Free
- Rate class
- Light. Counts against your light requests per second.
Send a payment for an offer from /v1/billing/offers (or from any 402) in the PAYMENT-SIGNATURE / X-PAYMENT header (x402) or Authorization: Payment (MPP). tide verifies it, submits it if needed, waits for its checkpoint and credits the payer. Returns the digest, the credits and the API key that holds them (derived from the payer address: the same key every time). Use the key for later calls.
Parameters
This method takes no parameters.
Request
Send your key in the x-api-key header, or leave it out to use the keyless tier.
curl
curl -X POST "https://api.tide.ad/v1/billing/pay" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{}'TypeScript
const res = await fetch("https://api.tide.ad/v1/billing/pay", {
method: "POST",
headers: {
"x-api-key": process.env.TIDE_API_KEY!,
"content-type": "application/json",
},
body: JSON.stringify({}),
});
const data = await res.json();Response
JSON
{
"digest": "5ajkuHAnivMiKRne6EYS2bzvHpCHWYx849cmoSHN89Vm",
"payer": "0x7d20dcdb2bca4f508ea9613994683eb4e76e9c4ed371169677c1be02aaf0b58e",
"credits": 333333,
"apiKey": "tide_..."
}