> ## Documentation Index
> Fetch the complete documentation index at: https://docs.khaime.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Accept your first payment in under 10 minutes.

# Quickstart

Get up and running with Khaime payments in three steps.

## 1. Create Your API Key

<Steps>
  <Step title="Sign up or log in">
    Go to [app.khaime.com](https://app.khaime.com) and create your merchant account.
  </Step>

  <Step title="Navigate to API Settings">
    Go to **Settings → API & Integrations → Partner API**.
  </Step>

  <Step title="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)

    <Warning>Store your webhook secret securely. It's only shown once.</Warning>
  </Step>
</Steps>

## 2. Create a Charge

Make your first API call to create a payment:

<CodeGroup>
  ```bash cURL theme={null}
  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"
      }
    }'
  ```

  ```javascript Node.js theme={null}
  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
  ```

  ```python Python theme={null}
  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'])
  ```
</CodeGroup>

<Note>
  Amounts are in the **smallest currency unit** (cents for USD, kobo for NGN).
  `5000` = \$50.00 USD.
</Note>

The response includes the gateway-specific data you need:

```json Response theme={null}
{
  "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:

<Tabs>
  <Tab title="Stripe">
    Use the `client_secret` and `publishable_key` to mount Stripe's Payment Element:

    ```html theme={null}
    <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>
    ```
  </Tab>

  <Tab title="Paystack">
    Redirect the customer to the `payment_url`:

    ```javascript theme={null}
    window.location.href = data.payment_url;
    ```

    Paystack redirects back to your `callback_url` after payment.
  </Tab>
</Tabs>

## 4. Receive the Webhook

After payment completes, Khaime sends a webhook to your configured URL:

```json theme={null}
{
  "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 →](/webhooks/overview)

## Next Steps

<CardGroup cols={2}>
  <Card title="Multicurrency" icon="globe" href="/payments/multicurrency">
    Let customers pay in NGN, GHS, KES, EUR, and more.
  </Card>

  <Card title="Subscriptions" icon="repeat" href="/payments/subscriptions">
    Set up recurring billing with automatic renewals.
  </Card>

  <Card title="WooCommerce Plugin" icon="wordpress" href="/plugins/woocommerce/installation">
    Zero-code integration for WordPress stores.
  </Card>

  <Card title="Webhook Security" icon="shield" href="/webhooks/verification">
    Verify webhook signatures to prevent fraud.
  </Card>
</CardGroup>
