Setup
A Klarna account can be requested from the Klarna Business Portal.Credentials
To connect a Klarna account, obtain the following credentials from the Klarna Business Portal.- Username: An API username which can be generated by navigating to Preferences → Settings → Manage Klarna API Credentials
- Password: An API password which can be generated by navigating to Preferences → Settings → Manage Klarna API Credentials
- Region: The region of the Klarna account. Enter
EUfor Europe,NAfor North America, orOCfor Oceania
Features
Klarna supports the following features:- Delayed capture - Authorize a payment and capture it at a later time
- Partial capture - Capture a portion of the authorized amount
- Partial refunds - Refund a portion of the captured amount
- Refunds - Refund transactions in full
- Void - Cancel an authorized transaction before capture
- Payment method tokenization - Store Klarna payment methods for future recurring use
Supported countries
Klarna supports transactions from buyers in the following countries:| Country code | Country code | Country code | Country code | Country code | Country code | Country code | Country code |
|---|---|---|---|---|---|---|---|
AT | AU | BE | CA | CH | DE | DK | ES |
FI | FR | GB | IE | IT | NL | NO | PL |
PT | SE | US |
Supported currencies
Klarna supports processing payments in the following currencies:| Currency code | Currency code | Currency code | Currency code | Currency code | Currency code | Currency code | Currency code |
|---|---|---|---|---|---|---|---|
AUD | CAD | CHF | DKK | EUR | GBP | NOK | PLN |
SEK | USD |
Limitations
The following features are not supported by this connector:- Direct capture - Immediate settlement is not supported; authorization must be captured separately
- Multi-capture - Multiple captures against a single authorization are not supported
- Over capture - Capturing more than the authorized amount is not supported
- Incremental authorization - Increasing the authorized amount is not supported
- Partial authorization - Accepting a partial amount when the full amount cannot be authorized is not supported
- Zero auth - Zero-dollar verification transactions are not supported
- Network tokens - Network tokenization is not supported
- 3-D Secure - 3DS authentication is not applicable
- Transaction sync - Automatic transaction status synchronization is not supported
- Settlement reporting - Automatic settlement reporting is not supported
Integration
For Klarna, the default integration uses a redirect to the Klarna hosted payments page. A direct integration using the Klarna JavaScript SDK or mobile SDKs is also supported.Redirect integration
Start by creating a new transaction with the following required fields.payment_method.approval_url and the buyer_approval_pending status.
approval_url to complete the Klarna approval flow. Once approved, the transaction moves to authorization_succeeded.
Direct integration
Gr4vy supports direct integration with Klarna using the Klarna Payments SDK or mobile SDKs, allowing you to embed the payment UI directly in your app while using Gr4vy to manage the transaction lifecycle. To initiate a direct integration, create a transaction withintegration_client set to web, ios, or android. For mobile, use your app deep link for redirect_url (for example, yourapp://).
After the transaction is created, the API response includes a session_token which can be used to get the session data for that transaction.
client_token from the session data to initialize the Klarna SDK. Refer to the Klarna SDK documentation for web, iOS, and Android integration guides.
Complete the transaction
After the customer authorizes the payment through the Klarna SDK, Klarna returns anauthorization_token. To finalize the transaction, send this token to Gr4vy as a query parameter on the default_completion_url returned in the session response.
Terminal
authorization_succeeded. It can then be captured, voided, or refunded through Gr4vy.
Subscriptions (MIT)
Klarna supports storing the buyer’s payment method during the first (customer-present) payment and charging future renewals as merchant-initiated transactions (MIT) using the saved payment method, typically with no redirect.Webhooks must be configured for the Klarna payment service. After the buyer approves the payment, Klarna sends an
authorization_token via webhook which Gr4vy uses to create the reusable customer token. Without this webhook, store: true will not work.First payment
Setstore to true to save the Klarna payment method for the buyer.
Subsequent payment
After the payment method is saved, use the payment method ID to charge future renewals.- Set
payment_method.methodtoidand pass the saved payment method ID. - Set
payment_sourcetorecurring. - Set
merchant_initiatedandis_subsequent_paymenttotrue.