Merchant middleware
Set an exact USDG price for a read-only endpoint. Release the response after the payment service confirms settlement.
Merchant integrationPrice an API request in USDG on Robinhood Chain. Deliver after settlement and let buyers recover the same response if the connection drops.
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 happens between the first HTTP 402 and the saved response. Hover to pause or select a stage.
Simulation
The API quotes an exact price for this request.
The buyer checks the terms and saves the signed purchase privately.
Paidbeam verifies that the USDG transfer is confirmed.
The API returns the report and retains the response.
The buyer retrieves the same report with the original purchase record.
GET /api/transaction-report?hash=0x…
HTTP 402 Payment Required · 1.00 USDGSIGN authorization for 1.00 USDG
SAVE purchase before submissionVERIFY USDG settlement on chain 4663
CONFIRMED merchant received 1.00 USDGHTTP 200 OK
result: { "status": "success", … }RECOVER original purchase → same JSON
additional charge: 0 USDG
Look up a Robinhood Chain transaction and get its receipt status, network fees, and decoded ERC-20 transfers.
GET /api/transaction-report
Public API access is pending.
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.
Yes. Install the Robinhood SDK from npm and follow the integration guide. The current release is 0.2.0-rc.1. A Paidbeam operator must register the merchant and endpoint and provide the service URL and merchant credential. Public API access is not open yet.
Connect your existing API to USDG payments with the Paidbeam SDK.