Wajub Components

Redirect — hosted checkout

Create a payment session on your server, then redirect to authorization_url. Zero client SDK required.

Key features

Server-only secret

WAJUB_SECRET_KEY — never NEXT_PUBLIC_

authorization_url

Full hosted checkout URL from POST /payments

Webhook confirmation

Trust webhooks, not the return URL alone

Fastest integration

No @wajub/js on the storefront

app/api/checkout/session/route.ts
// app/api/checkout/session/route.ts
import { NextResponse } from 'next/server';

export async function POST(req: Request) {
  const { cartId } = await req.json();

  const res = await fetch('https://api.wajub.com/payments', {
    method: 'POST',
    headers: {
      Authorization: process.env.WAJUB_SECRET_KEY!,
      'Content-Type': 'application/json',
      'Idempotency-Key': `cart-${cartId}`,
    },
    body: JSON.stringify({
      amount: 15000,
      currency: 'XAF',
      customer: { email: 'buyer@example.com' },
      callback: 'https://shop.example.com/order/return',
    }),
  });

  const { authorization_url } = await res.json();
  return NextResponse.redirect(authorization_url);
}

Try it now

Total15,000 XAF

Redirects to pay.wajub.com (or your local checkout URL)

Mock vs live

Without WAJUB_SECRET_KEY, the demo uses mock sessions. Set the key in .env.local for real payments.