Appearance
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
| Component | File | Role |
|---|---|---|
KlarnaApi | src/CoreBundle/Api/KlarnaApi.php | Klarna API client |
ScalapayApi | src/CoreBundle/Api/ScalapayApi.php | Scalapay 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
How It Works
- Checkout: the customer selects Klarna or Scalapay as their payment method
- Approval: the BNPL provider evaluates the customer and approves the installment plan
- Confirmation: the customer confirms the payment schedule
- Order creation: Logidav records the approved transaction and proceeds with fulfillment
- 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
| Scenario | Behavior |
|---|---|
| Customer not approved | Order cancelled or alternative payment offered |
| Session expired | Customer must restart checkout |
| Settlement delay | Monitored; no action needed from Logidav |
| API timeout | Retry with backoff |