Migration to 2025-07-18

Introduction

This migration guide outlines the changes introduced in the 2025-07-18 release. In this version, we add support for Klarna Hosted Payment Page (HPP) as a new payment method, allowing customers to pay via Klarna's hosted checkout experience.

Overview of Changes

New Payment Provider: Klarna

klarna has been added as a new payment provider. The PaymentProviderEnum now includes klarna as a valid value.

New Payment Method: HPP

hpp (Hosted Payment Page) has been added as a new payment method. The PaymentMethodEnum now includes hpp as a valid value.

Initiating a Klarna HPP Payment

To initiate a Klarna HPP payment, use provider: "klarna" and method: "hpp" in the initiate payment request. The provider_method_parameters must include the following Klarna HPP-specific fields:

Required Parameters

ParameterTypeDescription
purchase_countrystringISO 3166 alpha-2 country code (e.g. "SE")
localestringLocale for the purchase (e.g. "sv-SE")
designated_merchant_idstring (uuid)The primary Ping Payments Merchant ID for the payment
redirect_urlsobjectURLs for handling the payment flow outcome

Redirect URLs (all required)

FieldDescription
successURL to redirect to after successful payment
cancelURL to redirect to when payment is cancelled
errorURL to redirect to when an error occurs
backURL to redirect to when the user goes back (clicks/taps the X button)
failureURL to redirect to when payment fails

Optional Parameters

ParameterTypeDescription
billing_addressKlarnaAddressCustomer's billing address
shipping_addressKlarnaAddressCustomer's shipping address
merchant_referencestringReference displayed in the Klarna app
extra_merchant_dataobjectAdditional merchant data for risk assessment. May be required depending on the type of transactions being processed.
hpp_optionsobjectOptions for customizing the Klarna Hosted Payment Page (logo, background images, payment method categories, etc.)

Response

A successful initiation returns a redirect_url pointing to Klarna's hosted payment page. Redirect the customer to this URL to complete the payment.

Supported Currencies

Klarna HPP supports SEK, NOK, EUR, and DKK.

Example Request

{
  "currency": "SEK",
  "method": "hpp",
  "order_items": [
    {
      "amount": 10000,
      "merchant_id": "{{merchantId}}",
      "name": "Product A",
      "vat_rate": 25.0
    }
  ],
  "provider": "klarna",
  "total_amount": 10000,
  "provider_method_parameters": {
    "purchase_country": "SE",
    "locale": "sv-SE",
    "designated_merchant_id": "{{merchantId}}",
    "redirect_urls": {
      "success": "https://example.com/success",
      "cancel": "https://example.com/cancel",
      "error": "https://example.com/error",
      "back": "https://example.com/back",
      "failure": "https://example.com/failure"
    }
  }
}

Example Response

{
  "id": "15c44587-7ebb-43a3-b437-8d00e5f8df7a",
  "provider_method_response": {
    "redirect_url": "https://payment.klarna.com/pay/abc123"
  }
}

Affected Endpoints

  • Initiate payment