Skip to main content

Quickstart

Get up and running with Khaime payments in three steps.

1. Create Your API Key

1

Sign up or log in

Go to app.khaime.com and create your merchant account.
2

Navigate to API Settings

Go to Settings → API & Integrations → Partner API.
3

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"
    }
  }'
const response = await fetch('https://api.khaime.com/api/v1/partner/payments/charge', {
  method: 'POST',
  headers: {
    'X-API-Key': 'pk_sandbox_your_key_here',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    amount: 5000, // $50.00 in cents
    currency: 'USD',
    description: 'Test Payment',
    reference: 'test_001',
    customer: {
      email: 'customer@example.com',
      first_name: 'Jane',
      last_name: 'Doe',
      country: 'US',
    },
  }),
});

const data = await response.json();
console.log(data.data.charge_id); // charge_abc123
import requests

response = requests.post(
    'https://api.khaime.com/api/v1/partner/payments/charge',
    headers={
        'X-API-Key': 'pk_sandbox_your_key_here',
        'Content-Type': 'application/json',
    },
    json={
        'amount': 5000,
        'currency': 'USD',
        'description': 'Test Payment',
        'reference': 'test_001',
        'customer': {
            'email': 'customer@example.com',
            'first_name': 'Jane',
            'last_name': 'Doe',
            'country': 'US',
        },
    },
)

data = response.json()
print(data['data']['charge_id'])
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:
Response
{
  "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>

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.