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):In development, use
https://api.khaimedev.com/sdk/v2/khaime.js. The SDK auto-detects the API base from the script URL.Initialize
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
| Flow | Best for | Entry point | Cart? |
|---|---|---|---|
| Pay Button | Single-product checkout, “Buy now” CTAs, digital downloads, subscriptions | <khaime-pay-button product-id="…"> | No |
| Storefront + Cart | Multi-SKU stores, physical goods, mixed baskets | <khaime-storefront> | Yes |
| Programmatic | Server-driven pricing, WordPress shortcodes, custom UI | sdk.createPayment({ sessionToken }) | No (or server-managed) |
/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
- Start with the Pay Button quickstart — shortest path to a working payment.
- Review the events reference to hook into product clicks, cart updates, and payment outcomes.
- Always verify payments server-side via webhooks before fulfilling an order.
