Skip to main content

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.
npm (for bundled apps):

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

All three flows share the same backend (/api/v1/sdk/checkout/*), emit the same payment events, and support both embedded and redirect payment flows — the SDK routes to the right gateway based on the transaction currency.

Next steps