Klarna payment

The Klarna Payment App can be used to integrate with Klarna to handle payments in your e-commerce solution.

The Klarna Payment App is a reengineered version of the Klarna Add-on for Litium 8 and later.

The Klarna Payment app can be used to accept payments with Klarna Checkout (KCO) or Klarna Payments using Hosted Payment Page (HPP).

Values to replace in template:

  • ports
  • environment
    • ASPNETCORE_HTTPS_PORT
    • AppMetadata__AppUrl
    • LitiumApi__ApiUrl
version: '3'
services:
  klarna-payment:
    image: registry.litium.cloud/apps/klarna-payment:latest
    dns: 
    - 192.168.65.2
    restart: unless-stopped
    ports:
    - "10030:80"
    - "10031:443"
    environment:
    # Enable HTTPS binding
    - ASPNETCORE_URLS=https://+;http://+
    - ASPNETCORE_HTTPS_PORT=10031
    # Configuration for HTTPS inside the container, exported dotnet dev-certs with corresponding password
    - ASPNETCORE_Kestrel__Certificates__Default__Password=${CERT_PWD}
    - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/localhost.pfx
    # Folder for the configuraiton, this is volume-mapped
    - CONFIG_PATH=/app_config
    # Folder where logfiles should be placed, this is volume-mapped
    - APP_LOG_PATH=/logs
    # Don't validate certificates
    - AppConfiguration__ValidateCertificate=false
    # Url to this app
    - AppMetadata__AppUrl=https://customer-app-klarna-payment.localtest.me:10031
    # Url to the litium installation
    - LitiumApi__ApiUrl=https://customer.localtest.me:5001
    volumes:
    - ./data/klarna-payment/config:/app_config
    - ./data/klarna-payment/data:/app_data
    - ./data/klarna-payment/logs:/logs
    - ./data/klarna-payment/DataProtection-Keys:/root/.aspnet/DataProtection-Keys
    - ./data/https:/https:ro

Configuration file

{
  "Klarna": {
    "PaymentAccounts": [
      {
        "PaymentAccountId": "SE",
        "MerchantId": "",
        "SharedSecret": "",
        "Environment": "Test",
        "Region": "Europe", 
        "PaymentOptions": [ "Checkout" ],
        "UISettings": {
          "ColorButton": "#FF0000", 
          "ColorButtonText": "#FFFF00", 
          "ColorCheckbox": "#FF0000",
          "ColorCheckboxCheckMark": "#FFFF00",
          "ColorHeader": "#0000FF", 
          "ColorLink": "#00FF00",
          "RadiusBorder": "25"
        }
      },
      {
        "PaymentAccountId": "DK",
        "MerchantId": "",
        "SharedSecret": "",
        "Environment": "Test",
        "Region": "Europe", 
        "PaymentOptions": [ "Checkout" ]
      }
    ]
  }
}
  • PaymentAccountId: Identifier to select the account. Must be unique string.
  • MerchantId: Klarna UserName, this is Klarna merchant id followed by a string. This value is assigned by Klarna.
  • SharedSecret: Klarna Password, this value is assigned by Klarna.
  • Environment: Klarna environment. It should be "Test" or "Live".
  • Region: The region of Klarna account. It should be one of these values: "Europe", "NorthAmerica", "Oceania".
  • PaymentOptions: It must be "Checkout".
  • UISettings (optional): These fields are used to customize UI of Klarna checkout iframe.