Skip to main content
POST

Create Payment Intent

Create a payment intent tied to a product in your Khaime catalog. Returns a client_secret (Stripe) or authorization_url (Paystack) for an embedded checkout on your own page, plus a ready-made payment_url to Khaime’s hosted checkout page if you’d rather redirect instead of embedding.
This endpoint does not create a Stripe-hosted Checkout Session. POST /payments/sessions and POST /payments/intents call the exact same handler and return the exact same response shape — they are aliases, not different flows. Older versions of this page described a hosted-Checkout-Session response (session_id, stripe_session_id, a checkout.stripe.com URL) — that flow was replaced by the PaymentIntent/Direct Charge model below and is no longer reachable through this route. If you have integration code built against the old shape, update it to read intent_id / client_secret instead.
Use this endpoint (or its /payments/intents alias) when you want a product-based checkout with Stripe Payment Element or Paystack’s inline popup embedded on your own page. If you don’t have the product in Khaime’s catalog — e.g. WooCommerce/custom platforms where the product lives elsewhere — use Create Charge instead.

Request Body

product_id
integer
required
ID of an existing, published Khaime product owned by your business. Must match your API key’s environment (a sandbox key can only resolve sandbox products, a live key only live products) — otherwise 404.
The Joi schema also accepts product_name as a fallback lookup field, but the controller currently rejects any request missing product_id before that fallback runs — product_name-only requests always fail with a “Missing required fields” error today. Always pass product_id.
currency
string
required
3-letter ISO currency code the customer pays in.
amount
integer
Override amount in smallest currency unit. If omitted, the product’s catalog price is used.
customer
object
required
payment_gateway
string
Force a specific gateway instead of Khaime’s automatic currency-based routing. Only stripe or paystack are accepted — you cannot force startbutton or flutterwave through this field.
subscription_frequency_key
string
Set to make this a recurring payment (e.g. monthly, yearly). Presence of this field (or subscription_plan_key) is what makes the intent a subscription — there is no separate boolean flag.
Recurring billing here is handled by Khaime’s own billing cron, not Stripe Subscriptions — stripe_subscription_id in the response is always null.
subscription_plan_key
string
Alternative to subscription_frequency_key when the product has named plans configured. If the plan has exactly one frequency option, it’s auto-selected.
success_url
string
Where the customer lands after paying via Paystack’s redirect flow. Threaded into Paystack’s callback_url so the buyer returns to your confirmation page directly.
cancel_url
string
Redirect URL if the customer abandons a Paystack redirect payment.
metadata
object
Custom key-value pairs. No scalar-type enforcement is applied server-side — unlike Create Charge, you can pass nested values here, but avoid it: nested metadata can still fail downstream if the selected gateway’s API rejects non-string values.

Response

Use client_secret + publishable_key to mount Stripe Payment Element on your own page. For Paystack, use authorization_url (present instead of client_secret when payment_gateway resolves to paystack). Or simply redirect the customer to payment_url — Khaime’s own hosted checkout page — if you don’t want to embed anything.

Response Fields

Error Codes

Checking Payment Status

There is currently no working polling endpoint for intents created through this route — see Get Session for why. Use webhooks (payment.succeeded / payment.failed) to confirm payment status.