> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kleap.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Payments

> Accept payments on your Kleap site with Stripe

You can accept payments on your Kleap site using **Stripe**. Because Kleap sites are fast, mostly-static websites, the simplest and safest way to sell is with **Stripe Payment Links** and **Buy Buttons** — no server or secret keys required.

<Info>
  Stripe Payment Links and Buy Buttons are hosted by Stripe and embed with a public key only. That means no sensitive keys ever live in your site's code — which is safer and works perfectly with a static site.
</Info>

## The Easy Way: Payment Links

A **Payment Link** is a Stripe-hosted checkout page you can link to from any button.

<Steps>
  <Step title="Create products in Stripe">
    In your [Stripe Dashboard](https://dashboard.stripe.com), create a product and price (one-time or subscription).
  </Step>

  <Step title="Create a Payment Link">
    Go to **Payment Links** → **New**, pick your product, and copy the link (looks like `https://buy.stripe.com/...`).
  </Step>

  <Step title="Add it to your site">
    Ask the AI to add a buy button:

    ```
    Add a "Buy now" button in the pricing section that links to
    https://buy.stripe.com/your-link-here
    ```
  </Step>
</Steps>

That's it — clicks go to Stripe's secure checkout, and Stripe handles payment, receipts, and (for subscriptions) recurring billing.

## Buy Buttons & Pricing Tables

Stripe also offers embeddable **Buy Buttons** and **Pricing Tables** you can drop into a page. Create one in Stripe, then:

```
Embed this Stripe pricing table on my Pricing page:
<stripe-pricing-table pricing-table-id="..." publishable-key="pk_live_...">
</stripe-pricing-table>
```

<Warning>
  Only ever use your **publishable key** (`pk_live_...` / `pk_test_...`) in your site. **Never** put a **secret key** (`sk_...`) in a website — it must stay private.
</Warning>

## Test vs Live Mode

| Mode     | Keys / Links                        | Use                 |
| -------- | ----------------------------------- | ------------------- |
| **Test** | Test-mode payment links, `pk_test_` | Try the flow safely |
| **Live** | Live payment links, `pk_live_`      | Real payments       |

### Test Card Numbers

Use these in test mode:

| Card Number           | Result             |
| --------------------- | ------------------ |
| `4242 4242 4242 4242` | Success            |
| `4000 0000 0000 0002` | Declined           |
| `4000 0000 0000 3220` | Requires 3D Secure |

## Advanced: Custom Checkout

Fully custom, server-side Stripe flows (dynamic carts, metered billing, custom webhooks) require a backend to hold your secret key. That's beyond a static site — if you need it, you'd pair your site with your own backend or a serverless function. For most sites, Payment Links and Buy Buttons cover selling products, plans, and services.

## Best Practices

<AccordionGroup>
  <Accordion title="Use Payment Links for most cases">
    They're the fastest, safest way to sell on a static site — no keys in your code.
  </Accordion>

  <Accordion title="Keep secret keys out of your site">
    Only publishable keys belong in a website. Secret keys stay in Stripe / a backend.
  </Accordion>

  <Accordion title="Test before going live">
    Run a test-mode purchase end to end before switching to live links.
  </Accordion>
</AccordionGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Button doesn't open checkout">
    Make sure the button links to a valid `https://buy.stripe.com/...` Payment Link, and that the link is set to **live** mode when you're ready for real payments.
  </Accordion>

  <Accordion title="Pricing table not showing">
    Confirm you used your **publishable** key (`pk_...`) and the correct pricing-table ID from Stripe.
  </Accordion>
</AccordionGroup>

<Card title="Selling something bigger?" icon="database" href="/integrations/database">
  Add Kleap Database for orders, accounts, and saved data
</Card>
