Checkout
Checkout
You have two options.
Option A: Hosted checkout (easiest)
JavaScript
const { invoice } = await createInvoice(...);
res.redirect(invoice.hosted_checkout_url);
Buyer sees a mobile-first payment page with QR code, address, countdown, status pill, and "Open in wallet". The page auto-updates via Server-Sent Events, then redirects to your success_url.
Option B: Custom checkout UI
Render your own frontend. SatLane exposes public (unauthenticated) buyer endpoints:
JavaScript
// 1. Fetch the snapshot (invoice ID is the credential)
const res = await fetch(`https://api.satlane.com/pay/invoices/${invoiceId}`);
const { invoice, store, live } = await res.json();
// 2. Render invoice.payment_uri as a QR code
// 3. Subscribe to live status updates via SSE
const es = new EventSource(`https://api.satlane.com${live.events_url}`);
es.addEventListener('invoice.paid', (e) => {
const { invoice } = JSON.parse(e.data);
// Show success, redirect, etc.
});
es.addEventListener('invoice.expired', (e) => { /* ... */ });
es.addEventListener('invoice.payment_seen', (e) => {
/* Detected, waiting for confirmation */
});
// Or listen to the generic message event; every status change fires one:
es.onmessage = (e) => {
const payload = JSON.parse(e.data);
console.log(payload.event_type, payload.invoice.status);
};
Prefer WebSocket? Use live.stream_url instead (same JSON payload per event).
CORS is open (Access-Control-Allow-Origin: *) on /pay/* so vendor frontends on any domain can call these directly.