Skip to content
Kayana

Building a Checkout Page with Kayana’s Stripe Plugin (Python)

Last updated Mar 5, 2026

Overview

The Kayana Payment API allows you to accept payments from customers without building your own checkout infrastructure. This guide walks you through integrating the payment flow using the Stripe Plugin written in Python. The plugin handles:

  • Creating payment sessions
  • Communicating with the Kayana payment API
  • Loading Stripe Embedded Checkout
  • Processing payments securely

Instead of manually calling the Kayana payment APIs, the plugin exposes a simplified entry point: POST /launch This endpoint:

  1. Creates a payment session
  2. Opens the checkout page automatically
  3. Internally calls the Kayana payment gateway
  4. Initialises Stripe Embedded Checkout
  5. Processes the payment securely

What you'll build

In this guide, you will:

  • Create a payment instance using the Kayana API • Retrieve the Stripe publishable_key and client_secret • Load the Stripe Embedded Checkout UI • Process the payment securely

Server Setup

Start the plugin server.

  • python stripe_plugin.py

Server will run at:

  • http://localhost:<port_number>

Available endpoints:

  • POST /launch
  • POST /api/business-payment
  • GET /proxy/debug

GET /docs

Before you begin

You will need:

    • A Kayana Property ID
    • A valid Kayana API Key
    • Python installed
    • Basic understanding of Python APIs and HTTP requests
  • Start the plugin server.
  • python stripe_plugin.py
  • Server will run at:
  • http://localhost:<port_number>
  • Available endpoints:
  • POST /launch
  • POST /api/business-payment
  • GET /proxy/debug
  • GET /docs

Sandbox vs Production

EnvironmentDescription
SandboxUsed for testing payments without real transactions
ProductionUsed for live payments with real cards

Sandbox: https://integration.dev.kayana.co.uk Production: https://integration.kayana.co.uk

How it works

The payment flow consists of three main steps.

Step 1 — Server-side

Create a payment instance and receive: publishable_key client_secret

Step 2 — Server-side

Return these keys to the frontend.

Step 3 — Client-side

Load Stripe Embedded Checkout using those keys and complete the payment.

Set up the Python server

Run the plugin: python stripe_plugin.py Once started, the server runs at: http://localhost:8000 The plugin provides several endpoints.

EndpointPurpose
/launchStarts a payment session
/api/business-paymentCalls Kayana Payment API
/api/sessionRetrieves session data
/payment/successDisplays the success page

Step 1 — Create Payment Instance (Retrieve Stripe Keys)

The checkout page then retrieves the Stripe payment keys. The plugin internally calls the Kayana API: POST /web/payment This request returns:

  • publishable_key
  • client_secret

Both keys are required to initialise Stripe Embedded Checkout.

cURL Request

curl -X POST https://integration.dev.kayana.co.uk/web/payment \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -H "type: business" \ -d '{ "property_id": "Prop_abc123example", "psp_code": "STRIPE", "currency_code": "GBP", "amount": 12.0, "payment_mode": "CARD" }'

Example Response

{ "status": true, "data": { "publishable_key": "pk_test_123456789", "client_secret": "cs_test_987654321" } }

Step 2 — Launch the Checkout Session

The first step is to start the payment process using the plugin’s /launch endpoint. This endpoint:

  • validates the request
  • creates a payment session
  • stores the payment metadata
  • opens the checkout page in the browser

Endpoint

POST /launch

Example cURL

curl -X POST http://localhost:8000/launch \ -H "Content-Type: application/json" \ -d '{ "property_id": "Prop_abc123example", "currency_code": "GBP", "amount": 12.0, "customer_email": "customer@example.com" }'

Example Response

{ "launched": true, "session_id": "abc123-session-id", "url": "http://localhost:8000/?session_id=abc123-session-id" } This opens the checkout page: http://localhost:8000/?session_id=SESSION_ID

Step 3 — Load Stripe Embedded Checkout

The frontend loads Stripe and initialises checkout.

Include Stripe SDK

<script src="https://js.stripe.com/v3/"></script>

Initialize Stripe

const stripe = Stripe(publishableKey);

Mount Embedded Checkout

const checkout = await stripe.initEmbeddedCheckout({ clientSecret }); checkout.mount('#stripe-checkout-container'); Stripe now displays the secure payment form.

Support

Need help?

  • Technical issues: Contact Kayana Technical Support
  • Production credentials: Request from your Kayana account manager
  • PSP configuration: Reach out to Kayana Technical Support

Next steps

  • Explore webhook integration for payment notifications
  • Learn about refunds and dispute handling
  • Set up recurring payments for subscriptions

Next Steps

If you prefer to use RYFT as your Payment Service Provider (PSP), Kayana also supports a full RYFT integration flow. Refer to our guide on Building an advanced Kayana integration with RYFT in Python.

Still need a hand?Contact support← All help