Get started
Quickstart
Create a test payment, pay it in the sandbox and receive the webhook. You only need a test key and a terminal.
1. Get a test key
Sign in to dashboard.kepperhq.com with your Kepper app email and login PIN, open API keys in test mode and create a key. It starts with sk_test_ and is shown only once, so copy it into your server's environment variables straight away.
KEPPER_SECRET_KEY=sk_test_...2. Create a payment
Amounts are in kobo, so ₦5,000 is 500000. The reference is your own order ID, and it must be unique.
curl https://api.kepperhq.com/v2/gateway/payments \
-H "Authorization: Bearer $KEPPER_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 500000,
"channel": "card",
"reference": "order_1001",
"customer": { "email": "ada@example.com", "name": "Ada Obi" },
"callbackUrl": "https://yourshop.com/payment/complete"
}'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: 500000,
channel: "card",
reference: "order_1001",
customer: { email: "ada@example.com", name: "Ada Obi" },
callbackUrl: "https://yourshop.com/payment/complete",
}),
});
const { data: payment } = await res.json();
// Redirect your customer to payment.checkoutUrl3. Pay in the sandbox
Open the checkoutUrl from the response. In test mode it opens the Kepper sandbox checkout, where you can mark the payment as successful or expired. Then you're sent back to your callbackUrl with ?reference=order_1001 added.
4. Confirm the payment
Set a test webhook URL in the dashboard under Webhooks to receive payment.successful events (see Webhooks). You can also fetch the payment:
curl https://api.kepperhq.com/v2/gateway/payments/order_1001 \
-H "Authorization: Bearer $KEPPER_SECRET_KEY"Never fulfil an order because of the redirect alone
Anyone can open your callback URL. Only fulfil an order after a verified webhook, or after you've fetched the payment from your server and its status is successful.
5. Go live
- Ask our team to enable live payments for your business.
- Create a live key (
sk_live_) and set your live webhook URL. - Swap the key in your server's environment variables. Nothing else in your code changes.