Redirect
Send the customer to checkout_url. When they've paid, we bring them back to your redirect_url. No front-end code at all.
// After creating the payment return redirect($payment['data']['checkout_url']);
Developers
Two endpoints, predictable JSON and amounts in naira. Use the live API key from your Paybeta console.
curl https://checkout.paybeta.ng/api/v1/payments \ -H "P-API-KEY: $PAYBETA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mode": "test", "reference": "ORDER-1001", "amount": 25000, "description": "Pro plan, monthly", "customer": { "email": "ada@example.com" }, "redirect_url": "https://shop.example/thanks" }'
// Laravel $payment = Http::withHeaders(['P-API-KEY' => config('services.paybeta.key')]) ->post('https://checkout.paybeta.ng/api/v1/payments', [ 'mode' => 'test', 'reference' => $order->reference, 'amount' => 25000, 'customer' => ['email' => $order->email], 'redirect_url' => route('orders.thanks', $order), ]) ->throw(); return redirect($payment->json('data.checkout_url'));
const res = await fetch('https://checkout.paybeta.ng/api/v1/payments', { method: 'POST', headers: { 'P-API-KEY': process.env.PAYBETA_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ mode: 'test', reference: order.reference, amount: 25000, customer: { email: order.email }, redirect_url: 'https://shop.example/thanks', }), }); const { data } = await res.json(); // Send the customer to data.checkout_url
// Signature = HMAC SHA256 of data.reference, keyed with your secret key const expected = crypto .createHmac('sha256', process.env.PAYBETA_SECRET_KEY) .update(req.body.data.reference) .digest('hex'); const given = req.get('Signature') || ''; const valid = given.length === expected.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(given)); if (valid && req.body.eventType === 'transaction.successful') { await fulfil(req.body.data.reference); }
{
"status": "successful",
"message": "Payment created",
"data": {
"id": "GTW-K3J9X2…",
"reference": "ORDER-1001",
"status": "pending",
"mode": "test",
"amount": 25000,
"fee": 375,
"checkout_url": "https://checkout.paybeta.ng/pay/GTW-K3J9X2…"
}
}
Integration
Both use the same payment you create on your server. Pick per page.
Send the customer to checkout_url. When they've paid, we bring them back to your redirect_url. No front-end code at all.
// After creating the payment return redirect($payment['data']['checkout_url']);
Keep the customer on your site. Add paybeta.js and open the checkout over your page from a button.
<script src="https://checkout.paybeta.ng/v1/paybeta.js"></script> new PaybetaPop().resumeTransaction('GTW-K3J9X2…', { onSuccess: (tx) => confirmOnServer(tx.reference), onCancel: () => {}, });
You only pay on successful payments
Already on the Paybeta API? Use your live API key and start with "mode": "test".
We use cookies
This site uses only the cookies it needs to work and stay secure, and remembers your theme. No ads or tracking. Privacy policy