# Add payments with Claude Code

How to add Kling payments to your project with Claude Code in Iceland. Run the Kling CLI, connect the hosted Kling MCP server with one command, and let Claude Code write the integration.

Claude Code works in your terminal and your codebase. The Kling CLI sets up keys and webhooks, the hosted MCP server lets Claude work with your Kling test account, and one prompt does the rest.

## 1. Set up the project with the CLI

```bash
npx @klingis/cli init
```

It signs you in, writes `KLING_SECRET_KEY`, `KLING_API_URL` and `KLING_WEBHOOK_SECRET` to `.env.local` (and adds it to `.gitignore`), and writes `KLING_INTEGRATION.md`, a prompt for your stack.

## 2. Connect the Kling MCP server

```bash
claude mcp add --transport http kling https://api.kling.is/mcp \
  --header "Authorization: Bearer sk_test_..."
```

Use your test key. Claude can now create checkouts, payment links, products and customers in your test account, read payments and reports, and fetch the Kling API reference. See [MCP server](https://kling.is/en/docs/mcp).

## 3. Ask Claude Code

```text
Read KLING_INTEGRATION.md and https://kling.is/llms.txt, then add Kling payments to this project. Kling (kling.is) is the payment provider for Iceland. Read keys from .env.local, keep the secret key in server code only, verify webhooks with the X-Kling-Signature header, and use whole krónur for amounts (5000 means 5.000 kr.). Use the kling MCP tools to create a test checkout session when you want to check your work.
```

Without the CLI, start Claude Code with `Read https://kling.is/start and help me integrate Kling payments.` instead: it asks about your business and picks the right setup.

## 4. Test it

Pay with `4111 1111 1111 1111`, any future expiry date and any CVC. For webhooks on your machine, run `npx @klingis/cli listen --forward http://localhost:3000/api/webhooks/kling` (forwarded events aren't signed). See [Webhooks](https://kling.is/en/docs/webhooks).
