Step 1
I set up an Ngrok tunnel on a custom domain (klarna.mage2.pro
).
It requires an Ngrok «Pro» plan or higher one («Business»).
Step 2
I have set up a CNAME
DNS record for the klarna.mage2.pro
domain pointing to the Ngrok subdomain provided by Ngrok on the Step 1 (v2dpzsqg.cname.us.ngrok.io
):
Step 3
I have pointed the klarna.mage2.pro
to 127.0.0.1
for my local worstation via the hosts
file:
127.0.0.1 klarna.mage2.pro
Step 4
I have set up a VirtualHost
for Apache on my local workstation listening to the 443
port (Klarna requires HTTPS for checkout API callbacks):
<VirtualHost klarna.mage2.pro:443>
ServerName klarna.mage2.pro
DocumentRoot "C:/work/clients/blushme.se/klarna-blank/code"
SSLEngine on
SSLCertificateFile "C:/server/nginx/conf/certs/myssl.crt"
SSLCertificateKeyFile "C:/server/nginx/conf/private/myssl.key"
</VirtualHost>
Step 5
I have changed the Magento’s base URL to https://klarna.mage2.pro
:
UPDATE core_config_data
SET value = 'https://klarna.mage2.pro/'
WHERE path LIKE 'web/%secure/base_url';
Step 6
I have run Ngrok in the following way:
C:\work\lic\ngrok http -hostname=klarna.mage2.pro https://klarna.mage2.pro
Step 7
Now the Klarna Checkout should work.
You can use the following test bank card:
- Number: 4111 1111 1111 1111
- CVV: 123
- Exp: Any valid date in the future
Step 8
Klarna Checkout’s API callbacks are redirected by Ngrok to my local workstation: