Topics

DocsBuild with AI

Add payments with Claude Code

How to add Kling payments to your project with Claude Code in Iceland. Copy one prompt into Claude Code, keep your secret key in a local env file, and connect the hosted Kling MCP server so Claude can check its work.

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 Claude Code 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. Claude Code works in your terminal and in your own codebase, so it reads how your project is built, writes the integration to match and can run it to check that it works.

What Claude Code builds

Claude Code starts by asking what you sell and how you want to be paid, then picks the smallest setup that does the job. Sometimes that is a payment link or a subscription link from the dashboard, with no code. When it is code, Claude 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 opens the payment window on top of your page or sends the customer to the Kling payment page. It also adds a webhook handler that checks the signature and marks the order as paid. On the 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 keep that file out of git. Only server code reads the key, never 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 Claude work with your Kling account

Claude Code can connect to the hosted Kling MCP server at https://api.kling.is/mcp, with your test key sent as a bearer token. Claude can then create checkouts, payment links, products and customers in your test account, read payments and reports, and fetch the Kling API reference. That lets it create a real test checkout to check its own work. Use 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 Claude Code.

View as markdown