We'll use the Node SDK. Same shape in Python, Go, and Ruby.
npm install @opensettle/sdkOne POST creates a hosted checkout page. We'll return a URL you redirect your customer to.
import { OpenSettle } from "@opensettle/sdk";
const os = new OpenSettle({ apiKey: process.env.OPENSETTLE_TEST_KEY });
const checkout = await os.checkouts.create({
amount: 199.00,
currency: "USD",
settlement: {
chain: "base",
token: "USDC",
wallet: process.env.MERCHANT_WALLET,
},
success_url: "https://yourapp.com/success",
cancel_url: "https://yourapp.com/pricing",
});
return { url: checkout.url };Verify signatures, then fulfill the order. Webhooks are idempotent — safe to re-process without double-billing your customer.
import { verifyWebhook } from "@opensettle/sdk";
app.post("/webhook", async (req, res) => {
const event = verifyWebhook(
req.body,
req.header("opensettle-signature"),
process.env.WEBHOOK_SIGNING_SECRET,
);
if (event.type === "payment.confirmed") {
const payment = event.data;
await grantAccess(payment.customer);
await sendReceipt(payment.customer, payment.id);
}
res.sendStatus(200);
});Use the CLI to trigger a test payment — it behaves identically to a real one, without moving funds.
$ opensettle listen --forward-to http://localhost:3000/webhook
🔌 Listening for events…
$ opensettle checkouts test --amount 199
✓ Created checkout ck_test_9Zxq3Bm2
✓ Payment confirmed in 12.1s
✓ Webhook payment.confirmed delivered to localhost:3000