- Copy
packages/payment-klarnatosrc/modules/payment-klarna - Update
modules/client.tswith the following:import { KlarnaCheckout } from './payment-klarna' ... export const registerModules: VueStorefrontModule[] = [ ..., KlarnaCheckout ]
See config.json for example config
Endpoint for creating order (vsf-api)
Endpoint for retrieving Klana confirmation snippet (vsf-api)
Endpoint called when order total changes (vsf-api)
If set to true available shipping methods will be sent to Klarna and enable Klarnas shipping method form
https://developers.klarna.com/api/#checkout-api__create-a-new-order__options
Some plugins might use other keys
In theme/pages/Checkout.vue
import KCO from 'src/modules/payment-klarna/components/KlarnaCheckout'
export {
...,
components: {
klarna-checkout: KCO
}
}
And then just <klarna-checkout /> where you want to render it
Will be found at www.example.com/confirmation and www.example.com/STORECODE/confirmation
See beforeRegistration.ts for more info
If you need to extend this library you most likely don't need to fork it, just create a plugin!
There's a few default plugins already made. See the plugins folder for README and inspiration.
- Copy
packages/payment-klarna-bridgetosrc/api/extensions/payment-klarna-bridge - Add
payment-klarna-bridgetoregisteredExtensionsinlocal.json
See config.json for example config
Klarna docs: https://developers.klarna.com/api/#checkout-api__create-a-new-order__merchant_urls
Alongside Klarnas variables ({checkout.order.id}, {checkout.order.url} and/or {checkout.order.uri}) you can also use {{sourceCode}} which will be replaced currentStoreView().storeCode and {{dataSourceCode}} which will be replaced currentStoreView().dataSourceCode (useful if you need a different field for the url).
Your Klarna auth credentials
"auth": {
"user": "PK0123_something",
"pass": "password"
},"endpoints": {
"order": "https://api.something.klarna.com", // pick from https://developers.klarna.com/api/#api-urls
// TODO: Integrate to magento2-vsf-kco module
"validate_order": "" // will be called when total amount changes
},https://developers.klarna.com/api/#api-urls
Please use this module: https://github.com/kodbruket/magento2-vsf-kco
- Node 10+ (https://nodejs.org/en/download/)
- Yarn (https://yarnpkg.com/en/docs/install)
- Docker (https://docs.docker.com/v17.09/engine/installation/)
docker-compose(https://docs.docker.com/compose/install/)
Protip: On Mac run, install Docker and Brew then run
brew install node && brew install yarn && brew install docker-compose
git clone --recurse-submodules https://github.com/kodbruket/vsf-payment-klarna
cd vsf-payment-klarna
yarn # set up git hooks
docker-compose up
# new tab
make es-restore # seed Magento catalog dataVisit http://localhost:3000
yarn cypress
ssh -R vsf-payment-klarna:80:localhost:8080 serveo.net