Skip to content

Klarna & Scalapay Integration ​

Klarna and Scalapay provide buy-now-pay-later (BNPL) payment options, allowing customers to pay in installments. Both integrations follow a similar flow: order approval, installment plan creation, and periodic settlement.

Components ​

ComponentFileRole
KlarnaApisrc/CoreBundle/Api/KlarnaApi.phpKlarna API client
ScalapayApisrc/CoreBundle/Api/ScalapayApi.phpScalapay API client

Configuration ​

Required parameters in parameters.yml:

yaml
klarna:
  api_url: "https://..."
  username: "..."
  password: "..."

scalapay:
  api_url: "https://..."
  api_key: "..."

BNPL Flow ​

View diagram source
sequenceDiagram
    participant CUST as Customer
    participant MAG as Magento Checkout
    participant BNPL as Klarna / Scalapay
    participant API as KlarnaApi / ScalapayApi
    participant DB as Database

    CUST->>MAG: Select BNPL at checkout
    MAG->>BNPL: Create order session
    BNPL-->>CUST: Approve installment plan
    CUST->>BNPL: Confirm plan
    BNPL->>API: Order approved notification
    API->>DB: Record BNPL transaction
    Note over BNPL,CUST: Installments collected over time
    BNPL->>API: Settlement notification
    API->>DB: Record settlement

Diagram

How It Works ​

  1. Checkout: the customer selects Klarna or Scalapay as their payment method
  2. Approval: the BNPL provider evaluates the customer and approves the installment plan
  3. Confirmation: the customer confirms the payment schedule
  4. Order creation: Logidav records the approved transaction and proceeds with fulfillment
  5. Settlement: the BNPL provider collects installments from the customer and settles with the merchant on a schedule

Merchant risk

With BNPL, the merchant receives the full payment from the provider (minus fees) regardless of whether the customer completes all installments. The credit risk sits with Klarna or Scalapay.

Error Handling ​

ScenarioBehavior
Customer not approvedOrder cancelled or alternative payment offered
Session expiredCustomer must restart checkout
Settlement delayMonitored; no action needed from Logidav
API timeoutRetry with backoff

Internal developer documentation for Menzzo systems.