Skip to main content

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.

Khaime SDK

@khaime/sdk is an embeddable JavaScript library of Web Components that handle the full product-purchase flow — from showing a product to collecting payment — without sending the customer away from your page.

Three ways to take a payment

Pay Button

One-click checkout for a single product. Drop <khaime-pay-button> in and you’re done.

Storefront + Cart

Full catalog with multi-item cart and checkout — <khaime-storefront> + <khaime-cart-page>.

Programmatic

Create a checkout session on your server, render the payment UI on the client with sdk.createPayment().

Install

Script tag (recommended for WordPress / static sites):
<script src="https://api.khaime.com/sdk/v2/khaime.js"></script>
In development, use https://api.khaimedev.com/sdk/v2/khaime.js. The SDK auto-detects the API base from the script URL.
npm (for bundled apps):
npm install @khaime/sdk
import { KhaimeSDK } from '@khaime/sdk';

Initialize

const sdk = KhaimeSDK.init({
  merchantId: 'YOUR_MERCHANT_ID', // required
  apiKey: 'sk_live_...',          // optional; required only for server-authenticated calls
  sandbox: false,                 // true to route to the sandbox environment
  debug: false,                   // true to log API calls and events
});
KhaimeSDK.init is idempotent — calling it a second time returns the same singleton instance. The SDK registers four custom elements on init: <khaime-storefront>, <khaime-product-card>, <khaime-pay-button>, and <khaime-pricing>.

What each flow covers

FlowBest forEntry pointCart?
Pay ButtonSingle-product checkout, “Buy now” CTAs, digital downloads, subscriptions<khaime-pay-button product-id="…">No
Storefront + CartMulti-SKU stores, physical goods, mixed baskets<khaime-storefront>Yes
ProgrammaticServer-driven pricing, WordPress shortcodes, custom UIsdk.createPayment({ sessionToken })No (or server-managed)
All three flows share the same backend (/api/v1/sdk/checkout/*), emit the same payment events, and support both Stripe and Paystack — the SDK routes to the right gateway based on the transaction currency.

Next steps