Checkout embed SDK

The smallest integration path. One <script>, a data-soren-checkout attribute, and a server endpoint that proxies your API key.

In sandbox today

Checkout runs with test money. See Checkout for what happens to a completed payment today.

1. Add the script

Site headhtml
<script src="https://sorenpay.com/checkout.js"></script>

2. Add a button

Anywhere on the pagehtml
<button
data-soren-checkout
data-amount-cents="2500"
data-description="Pro plan · 1 seat"
data-session-endpoint="/api/create-soren-session"
>
Pay with Soren
</button>

3. Create the session endpoint (server-side)

This route lives on your server. Never expose your apk_ key in the browser. Example for Next.js API route:

/api/create-soren-session.tstypescript
import { NextResponse } from "next/server";

export async function POST(req: Request) {
const body = await req.json();
const res = await fetch("https://sorenpay.com/api/v1/checkout/sessions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SOREN_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    amountUsdCents: body.amountUsdCents,
    description: body.description,
    acceptedAssets: body.acceptedAssets ?? ["USDC", "USDT"],
    // Leave the networks out and the session takes the ones your coins work on.
    acceptedChains: body.acceptedChains,
    successUrl: body.successUrl ?? "https://yoursite.com/thanks",
  }),
});
const json = await res.json();
return NextResponse.json(json.session);
}

4. Listen for completion (optional)

The SDK fires a soren:completed CustomEvent on document after a successful payment:

document.addEventListener("soren:completed", (e) => {
console.log("Paid!", e.detail);
// Redirect to your post-purchase flow
window.location.href = "/thank-you?session=" + e.detail.id;
});

document.addEventListener("soren:failed", (e) => {
console.warn("Payment failed", e.detail);
});

SDK reference

AttributeRequiredDefault
data-soren-checkoutYes—
data-amount-centsYes—
data-session-endpointYes/api/create-soren-session
data-descriptionNo—
data-merchant-referenceNo—
data-assetsNoUSDC,USDT
data-chainsNoThe networks your coins can be paid on (Coins and networks). A network you list that none of your coins can be paid on is left out

Manual control

Skip the button binding and call directly:

window.SorenPay.checkout({
sessionEndpoint: "/api/create-soren-session",
amountCents: 2500,
description: "Pro plan",
assets: ["USDC"],
chains: ["polygon", "base"],
}).then(({ sessionId, hostedUrl }) => {
console.log("Opened session", sessionId);
});