Merchant middleware
Set an exact USDG price for a read-only endpoint. Release the response after the payment service confirms settlement.
Merchant integrationCharge for API requests in USDG on Robinhood Chain. Deliver after payment confirms, and let buyers recover the same response without paying again.
Charge for an endpoint with merchant middleware, or pay for a request with the buyer client. Both use x402 and USDG on Robinhood Chain.
Set an exact USDG price for a read-only endpoint. Release the response after the payment service confirms settlement.
Merchant integrationCheck the merchant and set a spending cap before signing. Save the purchase so your app can recover the result later.
Buyer integrationimport { protect, PaymentServiceClient } from 'paidbeam/merchant';
const client = new PaymentServiceClient(serviceUrl, merchantKey);
export const GET = protect({
client,
endpointId: 'transaction-report',
publicOrigin: 'https://api.example.com',
}, async request => {
const report = await generateReport(request);
return Response.json(report);
});
Register the endpoint and price with your operator. Keep the merchant credential on your server.
import {
createPaymentClient, robinhoodUsdgPolicy,
} from 'paidbeam/buyer';
const payments = createPaymentClient({
merchantOrigin: 'https://api.example.com',
signer, // Your connected wallet
policy: robinhoodUsdgPolicy({
payTo: merchantAddress, maxAmount: 1_000_000n,
}),
savePurchase: purchase => privateStore.save(purchase),
});
const result = await payments.purchase(endpoint);
// If pending or interrupted, recover the saved purchase.
const recovered = await payments.recover(savedPurchase);
Your application supplies the connected wallet and private purchase storage. Recover an existing purchase instead of starting another.
See what a buyer gets back when they recover a report.
The buyer asks for a report. The API returns the price and payment terms.
The buyer saves the signed authorization and purchase record before submitting payment.
The USDG transfer confirms on Robinhood Chain before the paid report is released.
The buyer gets the report, and Paidbeam retains the response for recovery.
The buyer sends the original purchase record and gets back the same saved response.
Simulation
{
"x402Version": 2,
"accepts": [
{ "amount": "1000000" }
]
}
Authorization received. Payment is pending.
The transfer is confirmed. The report is ready to deliver.
{
"transaction": {
"status": "success",
"gasUsed": "21000"
}
}
Available after delivery.
{
"transaction": {
"status": "success",
"gasUsed": "21000"
}
}
Identical response body
Look up a Robinhood Chain transaction and get its receipt status, network fees, and decoded ERC-20 transfers.
GET /api/transaction-report
api.paidbeam.xyz
If the connection drops after checkout, the saved purchase can retrieve the same report without a second signature or charge.
Read the recovery guideUSDG moves directly from the buyer's wallet to the merchant's configured receiving wallet on Robinhood Chain. The service verifies settlement before releasing the paid response.
The buyer SDK saves a purchase record before submitting authorization. Use that same record to recover the response. Recovery creates no new payable order and requests no second signature. Keep the record private: it contains payment authorization and access credentials.
Exact-price, read-only GET endpoints returning bounded JSON or text. The current SDK supports ordinary externally owned Robinhood Chain wallets. Contract wallets, subscriptions, streaming responses and variable charges are outside this version.
Install the Paidbeam TypeScript SDK from npm and follow the integration guide. For your own API, Paidbeam registers your endpoint and provides a service URL and merchant credential. You can also try the hosted report API today.
Use the Paidbeam TypeScript SDK to add USDG payments to your API. Merchant setup goes through Paidbeam.