Klarna
Klarna offers a simple and highly adaptable Buy Now Pay Later (BNPL) payment option, crafted to simplify financial transactions.
Allow your customers to pay how and when they want. Increase your sales, boost the average order value, and ensure customers return more frequently.
How it works
When choosing Klarna payment, we redirect the customer to the Klarna checkout page, that way, the customer just puts the card info and makes the payment. As soon as the payment has been done, the customer will be redirected to Paybyrd's system, where we will check the transaction status and tell the good news: "Your payment was a success".
Klarna provides the following payment methods:
Payment in 30 Days
Allows your customers to try out their items with an additional 30 days to complete the payment.
Financing
Gives your customers the flexible option to buy now and spread the cost over monthly payments.
Payment in 3 times
Offers your customers a modern alternative to credit: lets them pay later in 3 interest-free installments.
Create order
You can see below the simplest example of how to create an order and the generated response:
Generic order
This is an example of a generic order:
curl --request POST \
--url https://gateway.paybyrd.com/api/v2/orders \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{YOUR_API_KEY_HERE}}' \
--data '
{
"marketId": "PT",
"isoAmount": 5000,
"orderRef": "Klarna Product Order",
"currency": "EUR",
"orderOptions": {
"redirectUrl": "https://paybyrd.com",
"culture": "pt-PT"
},
"shopper": {
"email": "[email protected]",
"firstName": "Test",
"lastName": "Person-pt",
"phoneCountryCode": 351,
"phoneNumber": "935556731",
"shippingAddress": "Avenida Dom João II 40",
"shippingPostalCode": "1990-094",
"shippingCity": "Lisboa",
"shippingState": "LB",
"shippingCountry": "PRT",
"customReference": "spiderman",
"billingAddress": "Avenida Dom João II 40",
"billingPostalCode": "1990-094",
"billingCity": "Lisboa",
"billingCountry": "PRT"
},
"shoppingCart": {
"items": [
{
"description": "Web launcher",
"quantity": 1,
"unitPrice": 5000,
"amount": 5000,
"categories": [
"weapons",
"launchers"
],
"shipping": {
"shippingMethod": "STD"
},
"type": "Product"
}
]
},
"paymentOptions": {
"allowedPaymentMethods": [
"KLARNA"
]
}
}'
{
"orderDate": "2024-08-06T13:38:31Z",
"status": "created",
"checkoutUrl": "https://link-s.paybyrd.com/chk_5zBliRhln",
"tags": 0,
"index": 1,
"transactions": [],
"orderId": "351cd5c6-5865-4e7c-ba4e-aff337f7bdd2",
"amount": "50.00",
"currency": "EUR",
"orderRef": "Klarna Product Order",
"shopper": {
"customReference": "spiderman",
"shopperId": "f900c01b-2624-4619-bd49-26fed1f79471",
"email": "[email protected]",
"firstName": "Test",
"lastName": "Person-pt",
"phoneCountryCode": 351,
"phoneNumber": "935556731",
"shippingAddress": "Avenida Dom João II 40",
"shippingPostalCode": "1990-094",
"shippingCity": "Lisboa",
"shippingState": "LB",
"shippingCountry": "PRT",
"shippingType": "Undefined",
"billingAddress": "Avenida Dom João II 40",
"billingPostalCode": "1990-094",
"billingCity": "Lisboa",
"billingCountry": "PRT"
},
"orderOptions": {
"redirectUrl": "https://paybyrd.com",
"culture": "pt-PT",
"sendBy": []
},
"paymentOptions": {
"useSimulated": true,
"cardOptions": {
"isPreAuth": false,
"isDccEnabled": false
},
"tokenOptions": {
"tokenizationMethod": "none"
},
"allowedPaymentMethods": [
"KLARNA"
]
},
"terminalOptions": {
"notifyChanges": false
},
"shoppingCart": {
"items": [
{
"amount": 5000,
"categories": [
"weapons",
"launchers"
],
"description": "Web launcher",
"shipping": {
"shippingMethod": "STD"
},
"type": "Product",
"quantity": 1,
"unitPrice": 5000
}
]
},
"marketId": "PT",
"code": "BYRD200",
"description": "Operation successfully completed",
"checkoutKey": "eyJPcmRlcklkIjoiMzUxY2Q1YzYtNTg2NS00ZTdjLWJhNGUtYWZmMzM3ZjdiZGQyIiwiT3JkZXJSZWYiOiJLbGFybmEgUHJvZHVjdCBPcmRlciIsIlBlcnNvbklkIjo4MDYsIkxpdmUiOmZhbHNlLCJFbnRpdHlJZCI6IjM1MWNkNWM2LTU4NjUtNGU3Yy1iYTRlLWFmZjMzN2Y3YmRkMiIsIkFtb3VudCI6IjUwLjAwIiwiQ3VycmVuY3kiOiJFVVIifQ==",
"splitPayments": []
}
Airline order
This is an example of an airline ticket order:
curl --request POST \
--url https://gateway.paybyrd.com/api/v2/orders \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{YOUR_API_KEY_HERE}}' \
--data '
{
"marketId": "PT",
"isoAmount": 5000,
"orderRef": "Klarna Order",
"currency": "EUR",
"orderOptions": {
"redirectUrl": "https://paybyrd.com",
"culture": "pt-PT"
},
"shopper": {
"email": "[email protected]",
"firstName": "Peter",
"lastName": "Parker",
"phoneCountryCode": 351,
"phoneNumber": "935556731",
"homeAddress": "Avenida Dom João II 40",
"homePostalCode": "1990-094",
"homeCity": "Lisbon",
"homeCountry": "PRT",
"billingAddress": "Avenida Dom João II 40",
"billingPostalCode": "1990-094",
"billingCity": "Lisboa",
"billingCountry": "PRT"
},
"paymentOptions": {
"allowedPaymentMethods": [
"KLARNA"
]
},
"airline": {
"TravelType": "Roundtrip",
"typeOperation": "EMD",
"departureDate": "2024-12-19T19:30:00Z",
"passengerName": "Peter Parker",
"airlinePassengers": [
{
"ticketNumber": "123456",
"firstName": "Peter",
"lastName": "Parker",
"phoneCountryCode": 351,
"phoneNumber": "935556731",
"email": "[email protected]",
"membershipId": "6e419621-e2f1-4133-bc63-978c0b3d5562"
}
],
"airlineLegs": [
{
"flightNumber": "TP120",
"cabin": "4",
"serviceClass": "Y",
"departureDate": "2024-12-19T19:30:00Z",
"arrivalDate": "2024-12-20T09:30:00Z",
"operatingAirline": "TP",
"departureAirport": "GIG",
"arrivalAirport": "LIS",
"arrivalCountry": "PRT",
"travellersNumber": 1,
"hoursBeforeDeparture": 5,
"isDepartureDateChanged": false,
"segmentCodeStatus": "ABC123",
"fareBasisCode": "Y12R456",
"ticketDeliveryMethod" : "PHONE",
"ticketDeliveryRecipient": "5511953259340",
"segmentPrice": 5000
}
]
}
}'
{
"orderDate": "2024-08-06T13:57:44Z",
"status": "created",
"checkoutUrl": "https://link-s.paybyrd.com/chk_jdghAASb6",
"tags": 0,
"index": 1,
"transactions": [],
"orderId": "121656cf-a6de-4641-a4cd-4523c1c6b5e6",
"amount": "50.00",
"currency": "EUR",
"orderRef": "Klarna Order",
"shopper": {
"shopperId": "408f80b2-26a4-4744-824b-acf9eda9c92f",
"email": "[email protected]",
"firstName": "Peter",
"lastName": "Parker",
"phoneCountryCode": 351,
"phoneNumber": "935556731",
"homeAddress": "Avenida Dom João II 40",
"homePostalCode": "1990-094",
"homeCity": "Lisbon",
"homeCountry": "PRT",
"shippingType": "Undefined",
"billingAddress": "Avenida Dom João II 40",
"billingPostalCode": "1990-094",
"billingCity": "Lisboa",
"billingCountry": "PRT"
},
"orderOptions": {
"redirectUrl": "https://paybyrd.com",
"culture": "pt-PT",
"sendBy": []
},
"paymentOptions": {
"useSimulated": true,
"cardOptions": {
"isPreAuth": false,
"isDccEnabled": false
},
"tokenOptions": {
"tokenizationMethod": "none"
},
"allowedPaymentMethods": [
"KLARNA"
]
},
"terminalOptions": {
"notifyChanges": false
},
"marketId": "PT",
"code": "BYRD200",
"description": "Operation successfully completed",
"checkoutKey": "eyJPcmRlcklkIjoiMTIxNjU2Y2YtYTZkZS00NjQxLWE0Y2QtNDUyM2MxYzZiNWU2IiwiT3JkZXJSZWYiOiJLbGFybmEgT3JkZXIiLCJQZXJzb25JZCI6ODA2LCJMaXZlIjpmYWxzZSwiRW50aXR5SWQiOiIxMjE2NTZjZi1hNmRlLTQ2NDEtYTRjZC00NTIzYzFjNmI1ZTYiLCJBbW91bnQiOiI1MC4wMCIsIkN1cnJlbmN5IjoiRVVSIn0=",
"airline": {
"exchangeTicketAmount": 0,
"travelType": "Roundtrip",
"typeOperation": "EMD",
"airlineLegs": [
{
"serviceClass": "Y",
"stopOverCode": "O",
"flightNumber": "TP120",
"fareBasisCode": "Y12R456",
"arrivalAirport": "LIS",
"arrivalDate": "2024-12-20T09:30:00Z",
"cabin": "4",
"departureAirport": "GIG",
"departureDate": "2024-12-19T19:30:00Z",
"hoursBeforeDeparture": 5,
"isDepartureDateChanged": false,
"operatingAirline": "TP",
"segmentCodeStatus": "ABC123",
"travellersNumber": 1,
"arrivalCountry": "PRT"
}
],
"airlinePassengers": [
{
"documentType": 0,
"email": "[email protected]",
"firstName": "Peter",
"lastName": "Parker",
"membershipId": "6e419621-e2f1-4133-bc63-978c0b3d5562",
"ticketNumber": "123456"
}
]
},
"splitPayments": []
}
Marketplace order
This is an example of a marketplace order:
curl --request POST \
--url https://gateway.paybyrd.com/api/v2/orders \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{YOUR_API_KEY_HERE}}' \
--data '
{
"marketId": "PT",
"isoAmount": 5000,
"orderRef": "Klarna MarketPlace Order",
"currency": "EUR",
"orderOptions": {
"redirectUrl": "https://paybyrd.com",
"culture": "pt-PT"
},
"shopper": {
"email": "[email protected]",
"firstName": "Peter",
"lastName": "Parker",
"phoneCountryCode": 351,
"phoneNumber": "935556731",
"homeAddress": "Avenida Dom João II 40",
"homePostalCode": "1990-094",
"homeCity": "Lisbon",
"homeCountry": "PRT",
"shippingAddress": "Avenida Dom João II 40",
"shippingPostalCode": "1990-094",
"shippingCity": "Lisboa",
"shippingState": "LB",
"shippingCountry": "PRT",
"billingAddress": "Avenida Dom João II 40",
"billingPostalCode": "1990-094",
"billingCity": "Lisboa",
"billingCountry": "PRT",
"FirstPurchaseDate": "2021-07-15T20:56:22Z",
"LastPurchaseDate": "2021-07-15T20:56:22Z",
"PaidPurchasesCount" : 10,
"PaidPurchasesAmount" : 65000
},
"shoppingCart": {
"items": [
{
"description": "Web launcher",
"quantity": 1,
"unitPrice": 5000,
"amount": 5000,
"categories": [
"weapons",
"launchers"
],
"shipping": {
"shippingMethod": "STD"
},
"type": "Product"
}
]
},
"splitPayments": [
{
"IsoAmount": 4000,
"merchantId": "ABC123",
"merchantName": "Seller Test",
"merchantRating": 4.5,
"productCategory": "Computers",
"merchantAccountInfo": {
"registrationDate": "2021-07-15T20:56:22Z",
"passwordLastModified": "2021-07-15T20:56:22Z",
"emailLastModified": "2021-07-15T20:56:22Z",
"listingLastModified": "2021-07-15T20:56:22Z",
"loginLastModified": "2021-07-15T20:56:22Z",
"addressLastModified": "2021-07-15T20:56:22Z"
},
"tradesCount": 10,
"tradesVolume": 135000,
"isDigitalProduct" : false
},
{
"IsoAmount": 1000,
"merchantId": 806
}
],
"paymentOptions": {
"allowedPaymentMethods": [
"KLARNA"
]
}
}'
{
"orderDate": "2024-08-06T13:26:05Z",
"status": "created",
"checkoutUrl": "https://link-s.paybyrd.com/chk_G82dSOgFJ",
"tags": 0,
"index": 1,
"transactions": [],
"orderId": "695b4790-f27c-482e-9e85-b453ddb8309e",
"amount": "50.00",
"currency": "EUR",
"orderRef": "Klarna MarketPlace Order",
"shopper": {
"shopperId": "d253b9fb-9677-4618-819a-92597b02608c",
"email": "[email protected]",
"firstName": "Peter",
"lastName": "Parker",
"phoneCountryCode": 351,
"phoneNumber": "935556731",
"shippingAddress": "Avenida Dom João II 40",
"shippingPostalCode": "1990-094",
"shippingCity": "Lisboa",
"shippingState": "LB",
"shippingCountry": "PRT",
"homeAddress": "Avenida Dom João II 40",
"homePostalCode": "1990-094",
"homeCity": "Lisbon",
"homeCountry": "PRT",
"shippingType": "Undefined",
"billingAddress": "Avenida Dom João II 40",
"billingPostalCode": "1990-094",
"billingCity": "Lisboa",
"billingCountry": "PRT",
"FirstPurchaseDate": "2021-07-15T20:56:22Z",
"LastPurchaseDate": "2021-07-15T20:56:22Z",
"PaidPurchasesCount" : 10,
"PaidPurchasesAmount" : 65000
},
"orderOptions": {
"redirectUrl": "https://paybyrd.com",
"culture": "pt-PT",
"sendBy": []
},
"paymentOptions": {
"useSimulated": true,
"cardOptions": {
"isPreAuth": false,
"isDccEnabled": false
},
"tokenOptions": {
"tokenizationMethod": "none"
},
"allowedPaymentMethods": [
"KLARNA"
]
},
"terminalOptions": {
"notifyChanges": false
},
"shoppingCart": {
"items": [
{
"amount": 5000,
"categories": [
"weapons",
"launchers"
],
"description": "Web launcher",
"shipping": {
"shippingMethod": "STD"
},
"type": "Product",
"quantity": 1,
"unitPrice": 5000
}
]
},
"marketId": "PT",
"code": "BYRD200",
"description": "Operation successfully completed",
"checkoutKey": "eyJPcmRlcklkIjoiNjk1YjQ3OTAtZjI3Yy00ODJlLTllODUtYjQ1M2RkYjgzMDllIiwiT3JkZXJSZWYiOiJLbGFybmEgTWFya2V0UGxhY2UgT3JkZXIiLCJQZXJzb25JZCI6ODA2LCJMaXZlIjpmYWxzZSwiRW50aXR5SWQiOiI2OTViNDc5MC1mMjdjLTQ4MmUtOWU4NS1iNDUzZGRiODMwOWUiLCJBbW91bnQiOiI1MC4wMCIsIkN1cnJlbmN5IjoiRVVSIn0=",
"splitPayments": [
{
"isoAmount": 4000,
"merchantId": "ABC123",
"isPartner": false,
"merchantName": "Seller Test",
"merchantRating": 4.5,
"productCategory": "Computers",
"merchantAccountInfo": {
"registrationDate": "2021-07-15T20:56:22Z",
"passwordLastModified": "2021-07-15T20:56:22Z",
"emailLastModified": "2021-07-15T20:56:22Z",
"listingLastModified": "2021-07-15T20:56:22Z",
"loginLastModified": "2021-07-15T20:56:22Z",
"addressLastModified": "2021-07-15T20:56:22Z"
},
"tradesCount": 10,
"tradesVolume": 135000,
"isDigitalProduct": false
},
{
"isoAmount": 1000,
"merchantId": "806",
"isPartner": false,
"merchantRating": 0.0,
"tradesCount": 0,
"tradesVolume": 0,
"isDigitalProduct": false
}
]
}
Working with Shipping
There are two ways to send the shipping fee:
- Add a shopping cart item as ShippingFee when creating the order.
- In the shopping cart item, fill in the amount in the shipping property **This amount will be sent if there is no ShippingFee item in the cart
"shoppingCart": {
"items": [
{
"description": "Web launcher",
"quantity": 1,
"unitPrice": 5000,
"amount": 5000,
"categories": [
"weapons",
"launchers"
],
"shipping": {
"shippingMethod": "STD"
},
"type": "Product"
},
{
"description": "Shipping",
"quantity": 1,
"unitPrice": 199,
"amount": 199,
"shipping": {
"shippingMethod": "STD"
},
"type": "ShippingFee"
}
]
},
"shoppingCart": {
"items": [
{
"description": "Web launcher",
"quantity": 1,
"unitPrice": 5000,
"amount": 5000,
"categories": [
"weapons",
"launchers"
],
"shipping": {
"shippingMethod": "STD",
"amount": 199
},
"type": "Product"
}
]
},
Create payment from order
You can see below the simplest example of how to create a Klarna payment with a Checkout Key and the generated response:
curl --request POST \
--url https://gateway.paybyrd.com/api/v2/payment?checkoutKey=eyJPcmRlcklkIjoiNGQ0MzhkNDQtNTYwOS00YWRjLWFjNWQtYTk0OGM3ZTM5NDU1IiwiT3JkZXJSZWYiOiJOZXcgT3JkZXIiLCJQZXJzb25JZCI6MzMwOCwiTGl2ZSI6ZmFsc2UsIkVudGl0eUlkIjoiNGQ0MzhkNDQtNTYwOS00YWRjLWFjNWQtYTk0OGM3ZTM5NDU1IiwiQW1vdW50IjoiMjUwMC4wMCIsIkN1cnJlbmN5IjoiRVVSIn0%3D \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{YOUR_API_KEY_HERE}}' \
--data '
{
"type": "BNPL",
"amount": "50.00",
"currency": "EUR",
"culture": "pt-PT",
"brand": "KLARNA",
"salesChannel": "Desktop",
"shopper": {
"phoneCountryCode": "+351",
"phoneNumber": "935556731",
"email": "[email protected]",
"firstName": "Test",
"lastName": "Person-pt",
"billingAddress": "Avenida Dom João II 40",
"billingCountry": "PRT",
"billingPostalCode": "1990-094",
"billingCity": "Lisboa"
}
}'
{
"culture": "pt-PT",
"salesChannel": "Desktop",
"type": "Bnpl",
"currency": "EUR",
"orderRef": "Klarna Product Order",
"brand": "KLARNA",
"paymentMethod": "klarna",
"redirectUrl": "https://paybyrd.com",
"action": {
"type": "redirect",
"url": "https://webapp-redirect-api-stg.azurewebsites.net/api/v1/Redirect/4333c3d2-0d34-4597-bf24-a6b987ad8666"
},
"shopper": {
"customReference": "spiderman",
"email": "[email protected]",
"firstName": "Test",
"lastName": "Person-pt",
"phoneCountryCode": 351,
"phoneNumber": "935556731",
"ipAddress": "131.0.31.137",
"shippingAddress": "Avenida Dom João II 40",
"shippingPostalCode": "1990-094",
"shippingCity": "Lisboa",
"shippingCountry": "PRT",
"billingAddress": "Avenida Dom João II 40",
"billingPostalCode": "1990-094",
"billingCity": "Lisboa",
"billingCountry": "PRT"
},
"code": "BYRD207",
"description": "Pending redirect",
"status": "Processing",
"requestId": "59abd567-2988-4b9b-92de-15719d432768",
"ipAddress": "131.0.31.137",
"marketId": "PT",
"acceptTokenization": false,
"transactionMode": "None",
"transactionId": "4333c3d2-0d34-4597-bf24-a6b987ad8666",
"amount": "50.00",
"isoAmount": 5000
}
See the full API reference here.
In order to know whether the transaction was accepted or not, you must check the code field. For successful scenarios, the expected code is BYRD207. You can find here the list of all possible codes
Updated 10 days ago