Topics

DocsBuild with AI

Add payments with Cursor

How to add Kling payments to your project with Cursor in Iceland. Copy one prompt into Cursor's agent, keep your secret key in a local env file, and optionally connect the Kling MCP server.

Fastest: let your AI tool do the work

Copy the prompt and paste it into ChatGPT, Claude, Cursor, Lovable or any other AI tool. It reads our quickstart, asks about your business and picks the right setup.

You can add payments with Cursor to a website or app for a business in Iceland, using Kling, a payments platform for Iceland that takes cards, Apple Pay and Google Pay in Icelandic krónur. In Cursor you work in your own codebase, so the agent fits Kling into the framework and structure you already have instead of starting from a template.

What Cursor builds

Cursor's agent first asks what you sell and how you want to be paid, then picks the smallest setup that does the job. Often that is a payment link or a subscription link from the dashboard, with no code at all. When code is the right answer, it adds an endpoint on your server that creates a checkout session with your secret key, in whole krónur (5000 means 5.000 kr.), and a few lines in the browser that open the payment window on top of your page, or send the customer to the Kling payment page. It also adds a webhook handler that checks the signature and marks the order as paid. For your server it can use the typed SDK, @klingis/sdk, described under SDKs and tools.

Where the secret key goes

Sign up at kling.is/signup and copy your test key (sk_test_...) from the API Keys & Docs page. Put it in the environment file your framework reads, such as .env.local, and make sure that file is never committed. Only server code reads the key; it must never end up in code that runs in the browser. The webhook's signing secret, which you get when you add a webhook under Notifications in the dashboard, goes in the same file.

Let Cursor work with your Kling account

You can also connect Cursor to the Kling MCP server. Cursor can then create test checkouts, payment links and products and look up payments while it works, and read the Kling API reference as it writes code. Connect it with a test key, so it can only touch test data.

Test it

With a test key no real money moves. Pay with 4111 1111 1111 1111, any future expiry date and any CVC. 4000 0000 0000 0002 is declined. Kling sends webhooks to a public URL, so to receive them on your own machine, use a tunnelling tool that gives your local server a public address. The Webhooks page explains how.

Go live

Apply for live payments in the dashboard. Kling applies to the card acquirer on your behalf, and once you are approved you create a live key and set it on your production server in place of the test key. Live has its own webhook and signing secret. See Test mode to going live.

To start, copy the prompt at the top of this page and paste it into Cursor's agent chat.

View as markdown