Quickstart
Get up and running with Khaime payments in three steps.
1. Create Your API Key
Navigate to API Settings
Go to Settings → API & Integrations → Partner API.
Generate a key
Click Create API Key. Choose Sandbox for testing, Live for production.You’ll receive:
- API Key:
pk_sandbox_abc123... (used in X-API-Key header)
- Webhook Secret:
whsec_xyz789... (used to verify webhook signatures)
Store your webhook secret securely. It’s only shown once.
2. Create a Charge
Make your first API call to create a payment:
curl -X POST https://api.khaime.com/api/v1/partner/payments/charge \
-H "X-API-Key: pk_sandbox_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "USD",
"description": "Test Payment",
"reference": "test_001",
"customer": {
"email": "customer@example.com",
"first_name": "Jane",
"last_name": "Doe",
"country": "US"
}
}'
Amounts are in the smallest currency unit (cents for USD, kobo for NGN).
5000 = $50.00 USD.
The response includes the gateway-specific data you need:
{
"success": true,
"data": {
"charge_id": "charge_a1b2c3d4",
"payment_gateway": "stripe",
"client_secret": "pi_xxx_secret_yyy",
"publishable_key": "pk_test_...",
"transaction_id": "456"
}
}
3. Handle the Payment
Based on the payment_gateway in the response:
Use the client_secret and publishable_key to mount Stripe’s Payment Element:<script src="https://js.stripe.com/v3/"></script>
<script>
const stripe = Stripe(data.publishable_key);
const elements = stripe.elements({ clientSecret: data.client_secret });
const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');
</script>
Redirect the customer to the payment_url:window.location.href = data.payment_url;
Paystack redirects back to your callback_url after payment.
4. Receive the Webhook
After payment completes, Khaime sends a webhook to your configured URL:
{
"event_type": "payment.succeeded",
"event_id": "evt_123_1708900000000",
"data": {
"transaction_id": "456",
"amount": 5000,
"currency": "USD",
"status": "success",
"customer": {
"email": "customer@example.com"
}
}
}
Learn more about webhooks →
Next Steps
Multicurrency
Let customers pay in NGN, GHS, KES, EUR, and more.
Subscriptions
Set up recurring billing with automatic renewals.
WooCommerce Plugin
Zero-code integration for WordPress stores.
Webhook Security
Verify webhook signatures to prevent fraud.