Skip to main content

Pay Button

The fastest way to sell a single product. Drop <khaime-pay-button> onto your page, point it at a product ID, and the SDK handles everything — creating a checkout session, opening the payment modal, and reporting the result. Use this when you have a single product per button (a digital download, a subscription plan, an event ticket, a course). For multi-item baskets, see Storefront + Cart.

1. Load the SDK

2. Initialize

3. Render the button

4. Handle the result

onPaymentSuccess means the customer completed the payment UI. Always confirm the order server-side via a webhook before fulfilling.

What happens under the hood

1

Click

The customer clicks the button. The SDK calls POST /api/v1/sdk/checkout/initialize with { product_id, quantity, currency? } and receives a session token.
2

Modal opens

The SDK lazy-loads the checkout modal and fetches GET /api/v1/sdk/checkout/session/{sessionToken} to get the payment gateway credentials.
3

Payment

The modal renders Stripe Elements (USD, EUR, GBP, etc.) or Paystack inline (NGN, GHS, ZAR) based on the transaction currency.
4

Confirm

On submit, the SDK calls POST /api/v1/sdk/checkout/session/{sessionToken}/confirm and emits khaime:payment-success with the order ID.

Full example

Attributes reference

Next steps