Klarna
Klarna Pay Later allows customers to split up their payments into several rates. If you have set up a Klarna agreement on the Acquiring page in Billwerk+ administration, the payment option will automatically be presented in Billwerk+ Checkout.
Notice
Klarna payment option is only presented if the currency is supported by Klarna.
๐ Creating a Klarna Checkout Session
Notice
It is a Klarna requirement that you send in order lines for a Klarna Payment. This allows for an accurate calculation of VAT per item in the basket and will give a more detailed Klarna invoice.
A billing address is required by Klarna. Note that it is not sufficient to reference a customer object. You will have to explicitly set a billing address field on the order-object of the charge call.
Sample request
curl -X POST \
--url https://checkout-api.reepay.com/v1/session/charge \
-u 'priv_xxxx:' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"order": {
"customer_handle": "cust-0001",
"handle": "klarna-test-1",
"currency": "DKK",
"order_lines":[
{
"ordertext":"Order text",
"amount": 1000,
"vat": 0.25,
"quantity":1,
"amount_incl_vat": "true"
}],
"settle":false,
"billing_address":{
"address":"Strรธget 15",
"city":"Hornbรฆk","country":"DK",
"email":"[email protected]","first_name":"Gorm","last_name":"Bรธgh",
"postal_code":"3100","phone":"12345678"
}
}
}'
๐ต Klarna as the only payment option
If you would like Klarna to be presented as the only option in Billwerk + Payments Checkout, you can use the payment_methods
parameter in the create session call. This will automatically expand the Klarna payment option.
Sample
curl -X POST \
--url https://checkout-api.reepay.com/v1/session/charge \
-u 'priv_xxxx:' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"payment_methods": ["klarna_pay_later"],
"order": {
"customer_handle": "cust-0001",
"handle": "klarna-test-1",
"currency": "DKK",
"order_lines":[
{
"ordertext":"Order text",
"amount": 1000,
"vat": 0.25,
"quantity":1,
"amount_incl_vat": "true"
}],
"settle":false,
"billing_address":{
"address":"Strรธget 15",
"city":"Hornbรฆk","country":"DK",
"email":"[email protected]","first_name":"Gorm","last_name":"Bรธgh",
"postal_code":"3100","phone":"12345678"
}
}
}'
๐ Custom arguments
Custom arguments can be passed to Klarna in the optional session_data
object. These data are only stored for the duration of the checkout session.
Parameter | Description |
---|---|
ssn | Optional value containing the customer's social security number. |
๐ Test of Klarna
In order to test Klarna before going live, you can create a Klarna "Playground" account. This provides you with a test API username and test API key. Billwerk + Payments support can setup a Klarna test acquiring agreement on your Billwerk + Payments test account. Klarna provides test data in order to test both the success case ("approved") and rejections of payments.
The test credentials can be found here:
https://developers.klarna.com/documentation/testing-environment/sample-data/
with a page for each country, e.g. for Denmark:
https://developers.klarna.com/documentation/testing-environment/sample-data/dk/
๐ Klarna - pending orders
Billwerk+ Payments does not support Klarna's "pending" state. This state indicates a payment at a later stage will either be accepted or rejected.
Pending Klarna orders will simply be rejected by the Billwerk+ Payments system.
Updated 8 months ago