Please note that this documentation is for the most recent version of this extension. It may not be relevant for older versions. Related documentation can be found in the documentation directory of the extension.
Configuring Klarna Checkout
Attention:
Klarna Checkout requires the Pro version of the shop extension!
stateDiagram-v2
%% Frontend
[*] --> prepared : Customer builds cart\nand starts checkout
prepared --> ordered : Checkout completed\nconfirmation email sent\ninvoice number assigned
%% Klarna payment flow
ordered --> paid : Payment authorized/confirmed\nKlarnaCheckoutService->finishOrder()\nask Klarna in if payment is verified)
%% Shipping & completion
paid --> shipped : Goods shipped manually
paid --> processed : Completion without shipping\n(e.g. digital goods)
shipped --> processed : Order completed after shipping
%% Exceptional case
ordered --> canceled_unpaid : Payment failed or expired
canceled_unpaid --> processed : Cancellation completed
%% Conditions
note right of processed
Conditions:
- paid_date MUST be set
- shipped_date MUST be set
if shipping occurred
end note
Preparation
In order to use Klarna Checkout you need to do the following:
- Make sure the Country/Land field is set in Checkout.
Klarna API access credentials
- On the Klarna login page, switch to Settings -> Klarna access data
- Create your new API credentials
- Your new user name (UID) and password will be displayed
- Save and then tick the checkbox to close the modal.
This link will take you to the test environment (Sandbox/Playground): https://auth.playground.eu.portal.klarna.com/auth/realms/merchants/protocol/openid-connect/auth?client_id=merchant-portal
Configuring Shop information in Klarna
Under Settings -> Store information: https://playground.eu.portal.klarna.com/settings/store
Add additional actions after a successful payment
If you need actions to be carried out after successful payment, use the KlarnaPaid event listener.
- Create a new slot:
<?php namespace YourVendor\YourExtension\EventListener; use CodingMs\ShopPro\Event\BasketOrder\KlarnaPaidEvent; class DoSomeThingEventListener { public function __invoke(KlarnaPaidEvent $event): void { /* Do something */ } } - Then register the event listener in
Configuration/Services.yaml:services: YourVendor\YourExtension\EventListener\DoSomeThingEventListener: tags: - name: event.listener identifier: 'myListener' event: CodingMs\ShopPro\Event\BasketOrder\KlarnaPaidEvent
Testing
You will need a test account that you can create here: https://playground.eu.portal.klarna.com/developer-sign-up?
See: https://developers.klarna.com/documentation/testing-environment/
Warning:
Payment methods that you would like to use or test that don't appear in your test account can be requested by sending an email to shop(at)klarna(dot)de.
Test credit card
In order to simulate/test the card payment flow from the end user perspective use the following card details in the loaded Klarna widget:
Credit card number: 4111 1111 1111 1111CVV: 123Exp: 12/25 (or any valid date in the future)
Test bank account
To test using a bank connection, start typing and the system will suggest Demo Bank. Select it and enter any account number + pin with minimum 8 digits. Then select an account and enter 12345 as the TAN.
Verify your details/phone number
You can test this by entering the telephone number +491755555555. You will then need to enter a 6-digit code. Enter 999999 to simulate a failed attempt. Any other 6 digit code apart from 999999 will be validated.
Support from Klarna
If you need help with your retailer account, you can contact Karna directly by phone (0221 669 50130) or email at shop(at)klarna(dot)de.
