Kepper Developers

Accept payments

Card payments

Create a card payment, redirect your customer to the checkoutUrl, and fulfil the order when the payment.successful webhook arrives.

You never handle card details

Customers enter their card on a secure, PCI DSS-compliant hosted checkout page. Card numbers never touch your servers or ours, so you don't need any card-security certification of your own.

1. Create the payment on your server

Node.js
const res = await fetch("https://api.kepperhq.com/v2/gateway/payments", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KEPPER_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    amount: 2500000,                 // ₦25,000 in kobo
    channel: "card",
    reference: order.id,             // your own unique order ID
    customer: { email: order.email, name: order.name },
    callbackUrl: "https://yourshop.com/payment/complete",
    metadata: { orderId: order.id },
  }),
});
const { data: payment } = await res.json();

2. Redirect the customer

Send the customer's browser to payment.checkoutUrl. They pay there with their card, completing 3-D Secure or an OTP if their bank asks for it.

Express
res.redirect(303, payment.checkoutUrl);

3. The customer comes back

When they're done, the customer is sent to your callbackUrl with your reference added, for examplehttps://yourshop.com/payment/complete?reference=order_1001. Use it to show a "confirming your payment" page. Then check the status from your server:

Node.js
const res = await fetch(`https://api.kepperhq.com/v2/gateway/payments/${reference}`, {
  headers: { Authorization: `Bearer ${process.env.KEPPER_SECRET_KEY}` },
});
const { data: payment } = await res.json();
if (payment.status === "successful" && payment.amount === order.amountInKobo) {
  // mark the order as paid
}

The redirect is not proof of payment

Treat the callback as navigation only. Fulfil the order from the webhook, or from a server-side fetch that shows status: "successful" and the amount you expected.

4. Fulfil on the webhook

When the payment is confirmed we credit your wallet and send payment.successful to your webhook URL. This is the most reliable signal, because it arrives even if the customer closes their browser before the redirect.

Things to know

  • A card payment stays pending for up to 24 hours, then becomes expired.
  • A failed card attempt doesn't end the payment. The customer can try again on the same checkout page.
  • callbackUrl is required for card payments and must use https.
  • Sending the same request again with the same reference returns the original payment, so retries are safe.
Card payments | Kepper Developers