@rozoai/checkout 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/llms.txt +38 -2
- package/package.json +1 -1
- package/scripts/dist/cli.js +1073 -70
- package/scripts/dist/create-order.js +106 -34
- package/scripts/dist/quote.js +100 -33
- package/scripts/dist/receipt.js +100 -33
- package/scripts/dist/resume.js +100 -33
- package/scripts/dist/send-evm.js +100 -33
- package/scripts/dist/send-sol.js +100 -33
- package/scripts/dist/status.js +119 -35
package/README.md
CHANGED
|
@@ -388,6 +388,14 @@ keypair or an encrypted keystore, and supports EVM chains and Solana only —
|
|
|
388
388
|
Stellar and Lightning are Mode A only.
|
|
389
389
|
</details>
|
|
390
390
|
|
|
391
|
+
## Bulk and automated use
|
|
392
|
+
|
|
393
|
+
Buying credits regularly, reselling them, or building an agent that tops up
|
|
394
|
+
OpenRouter for its users? The [Bulk Purchases and Agents](https://docs.rozo.ai/products/checkout/bulk-and-agents)
|
|
395
|
+
guide covers the CLI, the MCP server and the raw HTTP flow side by side, plus
|
|
396
|
+
fees, rate limits, idempotency, error codes and what each final status means.
|
|
397
|
+
The batch script below is the CLI half of it.
|
|
398
|
+
|
|
391
399
|
## Paying many invoices (batch / resellers)
|
|
392
400
|
|
|
393
401
|
Each OpenRouter top-up is its own Coinbase link, so paying many is a loop: one
|
|
@@ -418,7 +426,8 @@ done < links.txt
|
|
|
418
426
|
- `--yes` is required when stdin is not a terminal, `--json` prints exactly one
|
|
419
427
|
JSON object, and `--no-watch` returns as soon as the deposit details exist.
|
|
420
428
|
Without `--no-watch`, `pay --json` first waits for settlement (up to
|
|
421
|
-
`--timeout`, default 900 s
|
|
429
|
+
`--timeout`, default 900 s; for Lightning, the invoice's remaining validity,
|
|
430
|
+
at most 60 minutes) and prints nothing until then, invoice included.
|
|
422
431
|
- Without `--send` (the loop above), a successful `pay --no-watch` means the
|
|
423
432
|
order and its deposit details exist. **No money has moved yet**, which is
|
|
424
433
|
why the log says `pending`. With `--send`, the CLI may already have
|
|
@@ -511,7 +520,11 @@ a link again, run `status` on its `rozoPaymentId`:
|
|
|
511
520
|
- `RATE_LIMITED`: order creation is capped per IP per hour (currently 30
|
|
512
521
|
requests, and each `pay` makes two), so plan on about 15 links per hour from
|
|
513
522
|
one IP. Wait for the next hour and resume with the links not yet `settled`.
|
|
514
|
-
Need more? Email us.
|
|
523
|
+
Need more? Email us. The CLI retries a 429 by itself, up to 3 times, when
|
|
524
|
+
the server's `Retry-After` (or `retryAfterSeconds`) fits in 2 minutes of
|
|
525
|
+
total waiting. A longer wait fails at once: read
|
|
526
|
+
`error.details.retryAfterSeconds`, and `error.details.rateLimit` (limit,
|
|
527
|
+
remaining, tier, scope) when the server sends it.
|
|
515
528
|
|
|
516
529
|
Questions about a batch? Email hi@rozo.ai, or reach us on
|
|
517
530
|
[X](https://x.com/ROZOai) or [Discord](https://discord.gg/EfWejgTbuU).
|
package/llms.txt
CHANGED
|
@@ -86,7 +86,8 @@ override; larger invoices go through the keyless path.
|
|
|
86
86
|
|
|
87
87
|
Other flags: --yes (skip the interactive confirm; required when stdin is not a
|
|
88
88
|
TTY), --dry-run, --json (exactly one JSON object on stdout), --no-watch,
|
|
89
|
-
--timeout <s
|
|
89
|
+
--timeout <s> (default 900; Lightning: the invoice's remaining validity, max 60
|
|
90
|
+
min). Exit codes: 0 success, 1 refused/failed (read error.code),
|
|
90
91
|
2 usage, 3 submitted but unconfirmed.
|
|
91
92
|
|
|
92
93
|
`pay` withholds the full deposit address until you confirm, then prints it as a
|
|
@@ -147,6 +148,39 @@ private key (EVM and Solana only); every other path is keyless.
|
|
|
147
148
|
only when the router reports paid / coinbase.settled — an intents status of
|
|
148
149
|
payment_completed alone is the bridge lifecycle, not final settlement.
|
|
149
150
|
|
|
151
|
+
## x402: pay any x402 API from a prepaid balance
|
|
152
|
+
|
|
153
|
+
For endpoints that answer HTTP 402 with x402 payment requirements. Fund a Rozo
|
|
154
|
+
balance once with the coin you hold, then pay many small x402 calls from it.
|
|
155
|
+
|
|
156
|
+
npx @rozoai/checkout x402 topup 20 --with usdt-solana # one-time deposit address
|
|
157
|
+
npx @rozoai/checkout x402 pay <url> [--method POST] [--body '...'] [--header 'K: V'] [--max-usd 1.00]
|
|
158
|
+
npx @rozoai/checkout x402 balance
|
|
159
|
+
|
|
160
|
+
Payment leg (what the seller receives): USDC on Base (eip155:8453) only,
|
|
161
|
+
scheme "exact". Solana payment leg is coming later. Topup leg: every --with coin above, plus native
|
|
162
|
+
ETH (Ethereum, Base, Arbitrum), BNB and SOL in beta. Native coins never pay a
|
|
163
|
+
seller directly.
|
|
164
|
+
|
|
165
|
+
Raw HTTP (Authorization: Bearer <agent key ak_...>):
|
|
166
|
+
POST https://apiserver.mpprouter.dev/v1/x402/topup {"amount":"20","token":"USDT","chain":"900"}
|
|
167
|
+
-> one-time deposit address/order; balance is credited after it confirms
|
|
168
|
+
POST https://apiserver.mpprouter.dev/v1/x402/sign {"accepts":[<one entry from the 402>],"budget":"1.00","idempotencyKey":"<uuid>"}
|
|
169
|
+
-> the value for the PAYMENT-SIGNATURE header; replay your request with it
|
|
170
|
+
POST /v1/x402/keys creates the agent key (returned once). GET /v1/x402/balance.
|
|
171
|
+
|
|
172
|
+
x402 safety rules:
|
|
173
|
+
- Send the paid request yourself. Never send Rozo your request body, headers or
|
|
174
|
+
the API keys of the service you are paying; /sign needs only the accepts entry.
|
|
175
|
+
- Generate one idempotencyKey per payment and reuse it on every retry of /sign.
|
|
176
|
+
A new key on retry can charge twice.
|
|
177
|
+
- Refuse a payment above what the user approved; refuse a payTo on a
|
|
178
|
+
compromised-wallet list.
|
|
179
|
+
- 503 X402_RETRY, X402_PAYER_MODE_CHANGED or X402_LEDGER_UNAVAILABLE: retry
|
|
180
|
+
with the same idempotencyKey. Any other 503 from /v1/x402 = "x402 payer not
|
|
181
|
+
enabled" for this key. Nothing was charged; stop.
|
|
182
|
+
- The agent key owns the balance. Store it 0600, never print or log it.
|
|
183
|
+
|
|
150
184
|
## Safety rules (encode these, they prevent fund loss)
|
|
151
185
|
|
|
152
186
|
- Before paying, require: status == "payment_unpaid" AND source.txHash == null AND
|
|
@@ -176,7 +210,9 @@ private key (EVM and Solana only); every other path is keyless.
|
|
|
176
210
|
|
|
177
211
|
409 = link already used · 410 = link expired · UNSUPPORTED_SOURCE = the response's
|
|
178
212
|
"supported" object lists valid (chainId, tokenSymbol) pairs (Lightning is supported
|
|
179
|
-
but omitted from that list) · RATE_LIMITED = per-IP creation cap, retry later
|
|
213
|
+
but omitted from that list) · RATE_LIMITED = per-IP creation cap, retry later (the CLI itself retries a 429 up
|
|
214
|
+
to 3 times within 2 minutes of total waiting, per Retry-After; a longer wait
|
|
215
|
+
fails at once with error.details.retryAfterSeconds and rateLimit) ·
|
|
180
216
|
INVALID_EMAIL = the optional email is malformed; fix it or omit it.
|
|
181
217
|
|
|
182
218
|
## Support
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozoai/checkout",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pay OpenRouter, or any Coinbase invoice, with the crypto you already hold: USDT/USDC on Solana, BNB Chain, Ethereum or Polygon, USDC on Base or Stellar, or BTC over Lightning. No Coinbase account.",
|
|
6
6
|
"license": "MIT",
|