Radondocs

Quickstart

Take your first payment with Radon Payments in about five minutes — one provider, one charge, no branching decisions.

By the end of this page you'll have taken a real test-mode payment and confirmed it server-side. We'll use Stripe because its test keys work instantly, but every step maps onto any of the 24 providers.

Prerequisites

Node 18 or newer, and a Stripe account with a test secret key (sk_test_…) from the Stripe dashboard.

Install the package

npm i @radonsdk/payments

Zero runtime dependencies — no Stripe SDK, no axios. Radon talks to every provider over fetch.

Set your key

Radon reads provider credentials from environment variables named RADON_<PROVIDER>_<KEY>, so you never hard-code secrets.

.env
RADON_STRIPE_SECRET_KEY=sk_test_...

Create the client

lib/payments.ts
import { RadonPayments } from "@radonsdk/payments";

export const payments = new RadonPayments({
  mode: "test",                 // sandbox everywhere; flip to "live" to go live
  providers: { stripe: {} },    // {} = read credentials from the env var
  defaultProvider: "stripe",
});

With free-only providers you don't need to call payments.init(). init() is only required when you configure a Pro provider (it verifies your license).

Take a charge

Amounts are always integer minor units plus an ISO-4217 currency — money(1999, "USD") is $19.99.

Take a payment
import { money } from "@radonsdk/payments";
import { payments } from "@/lib/payments";

const charge = await payments.charge({
  amount: money(1999, "USD"),
  customer: { email: "ada@example.com" },
});

console.log(charge.status);       // "succeeded" | "requires_action" | ...
console.log(charge.id);           // provider charge id, to confirm later
console.log(charge.redirectUrl);  // present when the customer must finish on a hosted page

You should see a charge.status of "succeeded" for a simple test card charge, and the payment appear in your Stripe test dashboard.

Confirm it server-side

Never trust a client redirect alone. Re-fetch the charge to confirm its final state before fulfilling an order.

const confirmed = await payments.retrieveCharge(charge.id);
if (confirmed.status === "succeeded") {
  // ✅ safe to fulfill
}

🎉 That's it

You took a payment through a unified API. The exact same code runs on Paystack, Adyen, or Coinbase Commerce — you'd only change the providers config.

Next steps

On this page