Skip to content

Payments · For your bots

Pay for an API call with x402

Call an API that charges per request with x402: set the most it is worth, let the app plan and simulate the payment, pay inside the rules, and report the receipt with the answer.

In Lobstack: Skills › Library › Add

Download Lobstack

When to use it

The job needs one answer from a service that charges per request over x402, and the bot has a wallet (wallet_status says so).

What your bot will do

  1. 01

    Read wallet_status first: the balance, today's spend, the rules. If the call would not fit, say so before trying it.

  2. 02

    Decide what the answer is worth and call paid_fetch with that as max_usdc, and a why the person can read on an approval card. Never set max_usdc higher to get past a refusal.

  3. 03

    The app reads the seller's price from its 402 answer, simulates the payment and checks the rules. Inside the allowance it pays; above it the person approves the plan they are shown.

  4. 04

    Report the answer, then the receipt: the price paid, verified or not, and the transaction link. Only "verified" means it was paid as planned.

  5. 05

    A refusal or a mismatch is reported as one, with the reason. Never retry a call the rules refused, and never invent a transaction hash.

One call per question: cache what came back rather than paying twice.

The file

x402-paid-call/SKILL.md30 lines
---name: x402-paid-calldescription: "Call an API that charges per request with x402: set the most it is worth, let the app plan and simulate the payment, pay inside the rules, and report the receipt with the answer."metadata:  title: "Pay for an API call with x402"  category: payments  tags: [x402, payments]--- ## When to use this The job needs one answer from a service that charges per request over x402,and the bot has a wallet (wallet_status says so). ## How 1. Read wallet_status first: the balance, today's spend, the rules. If the   call would not fit, say so before trying it.2. Decide what the answer is worth and call paid_fetch with that as   max_usdc, and a why the person can read on an approval card. Never set   max_usdc higher to get past a refusal.3. The app reads the seller's price from its 402 answer, simulates the   payment and checks the rules. Inside the allowance it pays; above it the   person approves the plan they are shown.4. Report the answer, then the receipt: the price paid, verified or not,   and the transaction link. Only "verified" means it was paid as planned.5. A refusal or a mismatch is reported as one, with the reason. Never retry   a call the rules refused, and never invent a transaction hash. One call per question: cache what came back rather than paying twice.

Get Lobstack.