How to Test Klarna Payments
This guide shows how to create a payment request that launches Bead’s hosted checkout page, select Klarna in the UI, complete the Sandbox checkout using Klarna test credentials, and verify the result.
1 – Prerequisites
Klarna enabled for your Sandbox merchant and terminal
Contact developer support if Klarna is not yet activated for your Sandbox environment.
Sandbox base URL
https://api.test.devs.beadpay.io
Hosted payment page base
Returned in paymentUrls (example host: https://pay.test.devs.beadpay.io)
Terminal API key
You need the real apiKey value. maskedApiKey is not usable.
merchantId and terminalId
Must match the terminal API key you were issued.
Webhook endpoint (recommended)
Publicly reachable and registered in the Bead dashboard.
Authentication note: Payments endpoints use header based authentication. Send your API key as X-Api-Key on every request.
2 – Create Payment Request
Send a POST /payments/crypto to generate the hosted checkout URL.
Required headers:
X-Api-Key: {apiKey}Content-Type: application/json
Minimal request example:
curl -s -X POST "https://api.test.devs.beadpay.io/payments/crypto" \
-H "Content-Type: application/json" \
-H "X-Api-Key: {apiKey}" \
-d '{
"terminalId": "{terminalId}",
"merchantId": "{merchantId}",
"requestedAmount": 35.00,
"paymentUrlType": "web",
"reference": "ORDER-0001",
"redirectUrl": "https://merchant.example.com/return"
}'Example response:
Save these values:
paymentUrls[0](hosted checkout URL)trackingId(used to check status)paymentPageId(useful for support and troubleshooting)
3 – Launch Hosted Payment Page
Use paymentUrls[0] to launch checkout.
Redirect
Redirect the shopper’s browser to the hosted page URL.
Embed
Load the hosted page URL in an iframe inside your site.
The shopper now sees Bead’s hosted payment page.
4 – Select Klarna and Open Klarna Checkout
In the Bead hosted UI, select Klarna as the payment method.
Bead displays a Klarna QR code linked to Klarna’s Sandbox checkout.
How the tester can open Klarna checkout:
Scan the QR code with a phone camera to open Klarna in the mobile browser.
Click or tap the QR code to copy the Klarna checkout URL, then paste it into any browser.
5 – Complete Klarna Sandbox Checkout
Use the following test values in Klarna’s Sandbox flow.
Phone number
716-220-4669
PIN (if prompted)
123456
Card number
4111 1111 1111 1111
Card expiry
Any future MM/YY (example 12/29)
Card CVV
123
Follow Klarna’s prompts until the shopper is returned to your redirectUrl (if you provided one).
6 – Verify Result
You can verify completion using webhooks (recommended) and optionally via an API status check.
Option A: Webhook verification
Confirm your webhook endpoint receives a payment event indicating completion. Look for a status field that indicates the payment is completed (example values include completed).
Option B: API status check (optional)
Use the same terminal API key approach as POST /payments/crypto.
Endpoint:
GET /payments/tracking/{trackingId}
Example curl:
What to confirm:
The response shows the payment in a completed state (example field:
statusCodeequalscompleted).Amount fields reflect a successful payment for the requested amount.
Troubleshooting
Common issues:
Klarna does not appear as a tender option Klarna may not be enabled for the Sandbox merchant or terminal. Confirm enablement with developer support.
401 Unauthorized The API key is missing or invalid, or the header name is wrong. The header must be exactly
X-Api-Key.403 Forbidden The API key is valid but not permitted for the
merchantIdorterminalIdin your request. Confirm the IDs match the credential set you were issued and that you are using the correct environment.Redirect does not happen Confirm you set a valid
redirectUrl. If not provided, Bead will display a hosted confirmation screen instead of redirecting.
7 – Next Steps
Test different amounts and run cancellation or expiry scenarios.
Validate your production readiness using webhooks plus status checks (avoid tight polling loops).
Move to production by switching to
https://api.devs.beadpay.ioand using live Klarna credentials and a production terminal API key.
Last updated