DocsBuild with AI
Add payments to a Replit app
How to take card payments in a Replit app in Iceland with Kling. Copy one prompt into Replit Agent, keep your secret key in Replit Secrets, and test with a test card.
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 to a Replit app in Iceland with Kling, a payments platform for Iceland that takes cards, Apple Pay and Google Pay in Icelandic krónur. Stripe doesn't onboard Icelandic businesses, but a Replit app only needs a small server endpoint and the Kling checkout to take payments, and Replit Agent can build both.
What Replit Agent builds
Replit apps have their own server, so the Agent adds an endpoint there that creates a checkout session when a customer clicks Pay. It sends the amount, in whole krónur (5000 means 5.000 kr.), and authenticates with your secret key. The customer then pays in the payment window, which opens on top of your page, or on the Kling payment page, which sends them back to your app afterwards. Card details go straight to Kling.
The Agent also adds an endpoint for webhooks. Kling calls it when a payment goes through; the endpoint checks the signature and marks the order as paid, whether or not the customer's browser ever comes back.
Where the secret key goes
Sign up at kling.is/signup and copy your test key (sk_test_...) from the API Keys & Docs page. In Replit it belongs in Secrets: your server code reads it as an environment variable, and it isn't part of the code you share or publish. Never paste it into the code itself or into anything that runs in the browser. The webhook's signing secret goes in Secrets too. You get it when you add a webhook under Notifications in the dashboard, pointing at your app's public URL.
Test it
With a test key no real money moves. Pay with 4111 1111 1111 1111, any future expiry date and any CVC, and check that the order is marked paid. 4000 0000 0000 0002 is declined, so you can see what the customer sees when a payment fails.
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 put it in Secrets 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 Replit Agent.