Integrate tonight. Launch when ready.
One script. One request. One webhook. Test keys simulate payments; live keys change nothing else. Full reference in the docs.
Three pieces
1. The page
The loader and a button. The checkout opens in an iframe over your page; the client secret travels by postMessage, never in a URL.
2. The server
Create a checkout session with your secret key. Lines with prices, quantities, modifiers, an optional warranty. You price everything.
3. The webhook
Signed events as the order is created and moves. Verify, answer 200, deduplicate by event id, act.
Cartirra Popup
On your page: one script tag, one button. Cartirra.open takes your public key and the session’s client secret.
Cartirra Popup guide in the docs →<!-- On your page: the loader, and a button Cartirra brands for you -->
<script src="https://checkout.cartirra.com/v1/cartirra.js" async></script>
<button data-cartirra-button id="checkout">Checkout with Cartirra</button>
<script>
document.getElementById('checkout').onclick = async () => {
// Your server creates the session (next sample) and returns its client_secret.
const { clientSecret } = await fetch('/api/checkout', { method: 'POST' }).then((r) => r.json())
Cartirra.open({ publicKey: 'pk_live_…', clientSecret, onSuccess: ({ orderId }) => location.assign(`/thanks?order=${orderId}`) })
}
</script>On your server
Send unit prices from your system. Options go as modifiers. A warranty on a line is saved to the customer on payment (Growth and up).
Quickstart in the docs →// On your server (Node): the cart as a snapshot, priced by you. The secret key never leaves here.
const res = await fetch('https://api.cartirra.com/v1/checkout-sessions', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.CARTIRRA_SECRET_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
lines: [{ sku: 'AIRBEAT-PRO', name: 'AirBeat Pro earbuds', quantity: 1, unit_price: { amount: '38500.00', currency: 'NGN' },
modifiers: [{ group: 'Colour', name: 'Black', price: { amount: '0.00', currency: 'NGN' } }],
warranty: { months: 6, covered_by: 'manufacturer' } }],
success_url: 'https://your-store.example/thanks',
}),
})
const session = await res.json()
// Hand session.client_secret to the page, or send the shopper to Cartirra Redirect (below).// On your server (PHP)
$ch = curl_init('https://api.cartirra.com/v1/checkout-sessions');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('CARTIRRA_SECRET_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'lines' => [['sku' => 'AIRBEAT-PRO', 'name' => 'AirBeat Pro earbuds', 'quantity' => 1,
'unit_price' => ['amount' => '38500.00', 'currency' => 'NGN']]],
'success_url' => 'https://your-store.example/thanks',
]),
]);
$session = json_decode(curl_exec($ch), true); // $session['client_secret']Webhooks
Cartirra-Signature: a timestamp and an HMAC-SHA256 of the raw body with your endpoint’s secret. Reject stale timestamps; treat a repeated event id as done. Every event and delivery in the dashboard’s log.
Webhooks guide in the docs →// Cartirra-Signature: t=<seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>"> with your whsec_ secret
import { createHmac, timingSafeEqual } from 'node:crypto'
function verify(rawBody, header, tolerance = 300) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')))
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > tolerance) return false
const expected = createHmac('sha256', process.env.CARTIRRA_WEBHOOK_SECRET).update(`${parts.t}.${rawBody}`).digest()
const given = Buffer.from(parts.v1 ?? '', 'hex')
return given.length === expected.length && timingSafeEqual(given, expected)
}
// POST /webhooks: verify, answer 200 fast, then act on event.type ('order.created', 'order.updated', …)Cartirra Redirect
No script: send the customer to Cartirra’s checkout page with the client secret and your public key. Your success_url brings them back.
Cartirra Redirect guide in the docs →<!-- No script at all: Cartirra Redirect sends the shopper to Cartirra’s checkout page -->
<a href="https://checkout.cartirra.com/#/pay/<client_secret>?pk=pk_live_…">Pay on a Cartirra page</a>Payment links and QR codes
From the dashboard. A link opens a session on your behalf; the order comes back through the same webhooks.
Payment links in the docs →Test mode
sk_test_ and pk_test_ keys. Payments, refunds and payouts simulated; webhooks fire as live. Test data kept apart.
Test mode in the docs →Your products are ready. So is the infrastructure.
Start free, send yourself a test order, go live when ready. No card, no contract, nothing to move.