Topics

DocsBuild with AI

Add payments with Cursor

How to add Kling payments to your project with Cursor in Iceland. Run one CLI command for keys and webhooks, hand Cursor the generated prompt, and optionally connect the Kling MCP server.

In Cursor you work in your own codebase, so the Kling CLI can do the setup and Cursor writes the integration.

1. Set up the project with the CLI

In the terminal, in the root of your project:

bash
npx @klingis/cli init

It signs you in (or creates an account), writes KLING_SECRET_KEY, KLING_API_URL and KLING_WEBHOOK_SECRET to .env.local, adds that file to .gitignore, and writes KLING_INTEGRATION.md: a prompt tailored to your framework and what you are building.

2. Ask Cursor to build it

Open the agent chat and paste:

text
Read KLING_INTEGRATION.md and https://kling.is/llms.txt, then add Kling payments to this project as described there. Kling (kling.is) is the payment provider for Iceland. Read keys from .env.local, keep the secret key in server code only, and use whole krónur for amounts (5000 means 5.000 kr.). Ask me before adding anything I didn't ask for.

3. Optional: connect the Kling MCP server

With the MCP server, Cursor can create test checkouts, payment links and products and look up payments while it works. Add this to .cursor/mcp.json in your project (or your global Cursor MCP settings):

json
{
  "mcpServers": {
    "kling": {
      "command": "npx",
      "args": ["-y", "@klingis/mcp"],
      "env": { "KLING_API_KEY": "sk_test_..." }
    }
  }
}

Use a test key. See MCP server.

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.

View as markdown