Payments

rent.dev sandboxes draw on one prepaid balance in US dollars. A person funds it by card through Stripe Checkout; an agent funds it in USDC over x402. Both add credit to the same balance.

POSThttps://api.rent.dev/v1/credits/checkout

View as Markdown

Checkout

POST /v1/credits/checkout creates a Stripe Checkout Session for the credits you name. Open checkout_url in a browser to pay by card, Link, US bank account or stablecoin.

Shell
curl -sX POST https://api.rent.dev/v1/credits/checkout -H "Authorization: Bearer $RENT_KEY" -H "Content-Type: application/json" -d '{"amount_usd":"20.00"}'
Answer fieldTypeDescription
checkout_urlstringRequired.
session_idstringRequired.
expires_atstringRequired. RFC 3339 date-time.
credit_microsinteger, at least 0Required. Integer micro-USD, zero or more.
fee_microsinteger, at least 0Required. Integer micro-USD, zero or more.

The fee is its own line at Checkout, and so is tax where it applies. The credit shows in the balance once the payment succeeds. After paying, Checkout returns to the confirmation page.

A pay link lets an agent ask a person to pay without sharing its key. Every 402 that names a shortfall carries one as topup.checkout_url, for that shortfall rounded up to a cent.

  • The link is GET /pay/{token}. Opening it redirects to a fresh Checkout Session.
  • It needs no key and works for 24 hours. After that it answers 410 gone.
  • Over MCP, rent_topup with method: "card" answers a pay link for any amount.

Auto-recharge

Auto-recharge charges a saved card or Link method when the available balance falls below a threshold you set.

  1. Save a method: POST /v1/credits/payment-method answers a Checkout page that stores a card or Link method without charging it.
  2. Find its id with GET /v1/billing/payment-methods.
  3. Turn it on with PUT /v1/billing/auto-recharge.
Shell
curl -sX PUT https://api.rent.dev/v1/billing/auto-recharge -H "Authorization: Bearer $RENT_KEY" -H "Content-Type: application/json" \
  -d '{"enabled":true,"threshold_usd":"5.00","amount_usd":"20.00","payment_method_id":"pm_…"}'
Body fieldTypeDescription
enabledbooleanRequired.
threshold_usdstring or numberRecharge when available balance falls below this. Required to enable.
amount_usdstring or numberCredits bought per recharge; the fee is added. Required to enable.
payment_method_idstringA saved card or Link method. Required to enable.

Each recharge buys amount_usd of credits and adds the Checkout fee. A decline, or a bank asking the cardholder to confirm, turns auto-recharge off and records why in disabled_reason; the next 402 then carries a pay link. A processing error is tried again after 1 min, 10 min and 1 h.

A sandbox call that would answer 402 asks for one recharge first when auto-recharge is on, and goes ahead if it succeeds.

x402: USDC from an agent

POSThttps://api.rent.dev/v1/credits/x402?amount_usd=5

x402 lets an agent with a wallet pay over HTTP. The amount can be anything from 0.000001 USD up, with at most six decimal places.

  1. Call the route without a payment. It answers 402 with a PAYMENT-REQUIRED header: x402 v2, scheme exact, the network, the USDC contract and the amount, which is the credits plus the fee.
  2. Sign that requirement within 120 seconds and send the same request again with the payment in a PAYMENT-SIGNATURE header.
  3. The answer is 200 with the receipt in PAYMENT-RESPONSE once the payment has settled and its transfer is confirmed on-chain.

Production settles in USDC on Base. A payment that was broadcast but is not confirmed yet answers 202 with an Operation; poll it until it is done. Sending the same signed payment twice credits it once.

StatusMeaning
200Settled and credited. Also the answer to a repeat of a settled payment.
201Settled, and the payment created the wallet's account.
202Broadcast, not confirmed yet. Poll the Operation.
402No payment yet (payment_required), or it was refused (payment_failed).
409The same payment is being settled by another request.

Wallet-first signup

An x402 payment sent with no API key credits the account of the paying wallet. If the wallet has no account, the payment creates one and the answer carries its first API key, shown once. An agent with a funded wallet needs no signup call at all.

To get a new key later, sign in with the wallet: fetch a nonce (valid 5 min), put its 32 bytes as 64 hex characters in the Nonce of a Sign-In with Ethereum message, sign it and send it to POST /v1/accounts/wallet-login.

JSON
{
  "message": "<the EIP-4361 message>",
  "signature": "0x…"
}

Fees

How you payFee
Checkout, pay links, auto-recharge5.5% of the credits, and at least $0.80.
x4025.5% of the credits, with no minimum.
Usage a vendor bills on your own keyNone.

The fee is added to what you pay. The credits you asked for land whole.

CreditsCard feeCard totalx402 feex402 total
$5.00$0.80$5.800.275 USDC5.275 USDC
$20.00$1.10$21.101.1 USDC21.1 USDC
$100.00$5.50$105.505.5 USDC105.5 USDC

Balance and ledger

GET /v1/balance answers the balance in micro-USD: total_micros, held_micros (reserved by running sandboxes) and available_micros, the difference. frozen is true while the balance is below zero; new holds are refused until it is topped up.

GET /v1/ledger lists every credit and charge, newest first: top-ups, fees, tax and the captures of each sandbox.

Shell
curl -s https://api.rent.dev/v1/balance -H "Authorization: Bearer $RENT_KEY"