> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paybyrd.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Klarna

Klarna is a Buy Now Pay Later (BNPL) payment method that lets customers defer or split payments at checkout.

## How it works

When a customer selects Klarna, they are redirected to the Klarna checkout page to complete payment. After payment, the customer is redirected back, but the transaction status may not be immediately available at that point. The final status is delivered asynchronously — use webhooks or query the API to confirm it.

Klarna provides the following payment methods:

| Method | Description |
| - | - |
| Payment in 30 days | Buy now and pay within 30 days. |
| Financing | Spread the cost over monthly payments. |
| Payment in 3 times | Split the cost into 3 interest-free installments. |

## Create order

The following example shows how to create a Klarna order:

### Generic order

```bash Request theme={null}
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}' \
 --data '
{
 "marketId": "PT",
 "isoAmount": 5000,
 "orderRef": "Klarna Product Order",
 "currency": "EUR",
 "orderOptions": {
   "redirectUrl": "https://paybyrd.com",
   "culture": "pt-PT"
 },
 "shopper": {
   "email": "peter@parker.com",
   "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"
   ]
 }
}'
```

```json Response theme={null}
{
    "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": "customer@email.pt",
        "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

```bash Request theme={null}
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}' \
  --data '
{
    "marketId": "PT",
    "isoAmount": 5000,
    "orderRef": "Klarna Order",
    "currency": "EUR",
    "orderOptions": {
        "redirectUrl": "https://paybyrd.com",
        "culture": "pt-PT"
    },
    "shopper": {
        "email": "customer@email.pt",
        "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": "peter.parker@spidermail.com",
                "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
            }
        ]
    }
}'
```

```json Response theme={null}
{
    "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": "customer@email.pt",
        "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": "peter.parker@spidermail.com",
                "firstName": "Peter",
                "lastName": "Parker",
                "membershipId": "6e419621-e2f1-4133-bc63-978c0b3d5562",
                "ticketNumber": "123456"
            }
        ]
    },
    "splitPayments": []
}
```

### Marketplace order

```bash Request theme={null}
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}' \
  --data '
{
    "marketId": "PT",
    "isoAmount": 5000,
    "orderRef": "Klarna MarketPlace Order",
    "currency": "EUR",
    "orderOptions": {
        "redirectUrl": "https://paybyrd.com",
        "culture": "pt-PT"
    },
    "shopper": {
        "email": "customer@email.pt",
        "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"
        ]
    }
}'
```

```json Response theme={null}
{
    "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": "customer@email.pt",
        "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
        }
    ]
}
```

### Bus reservation

```bash Request theme={null}
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}' \
  --data '
{
    "marketId": "PT",
    "isoAmount": 6000,
    "orderRef": "Klarna Bus Reservation Order",
    "currency": "EUR",
    "orderOptions": {
        "redirectUrl": "https://paybyrd.com",
        "culture": "pt-br"
    },
    "paymentOptions": {
        "allowedPaymentMethods": [
            "KLARNA",
            "card"
        ],
        "maxAttempts": "3"
    },
    "shopper": {
        "email": "customer@email.pt",
        "firstName": "Peter",
        "lastName": "Parker",
        "phoneCountryCode": 351,
        "phoneNumber": "935556731",
        "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"
    },
    "shoppingCart": {
        "items": [
            {
                "amount": 6000,
                "categories": [
                    "Bus Tickets"
                ],
                "description": "Bilhetes",
                "shipping": {
                    "shippingMethod": "STD"
                },
                "type": "Product",
                "quantity": 1,
                "unitPrice": 6000
            }
        ]
    },
    "busReservations": [
        {
            "pnr": "ABC123",
            "affiliateName": "FlixBus",
            "itineraries": [
                {
                    "departureCity": "Los Angeles",
                    "arrivalCity": "San Francisco",
                    "carrier": "FlixBus",
                    "segmentPrice": 4000,
                    "departureDate": "2025-03-06T14:38:49.371Z",
                    "ticketDeliveryMethod": "Email",
                    "ticketDeliveryRecipient": "customer@email.pt"
                }
            ],
            "passengers": [
                {
                    "firstName": "John",
                    "lastName": "Doe"
                },
                {
                    "firstName": "Jane",
                    "lastName": "Doe"
                }
            ]
        },
        {
            "pnr": "ABC123",
            "affiliateName": "FlixBus",
            "itineraries": [
                {
                    "departureCity": "San Francisco",
                    "arrivalCity": "Los Angeles",
                    "carrier": "FlixBus",
                    "segmentPrice": 2000,
                    "departureDate": "2025-03-06T14:38:49.371Z",
                    "ticketDeliveryMethod": "Email",
                    "ticketDeliveryRecipient": "customer@email.pt"
                }
            ],
            "passengers": [
                {
                    "firstName": "John",
                    "lastName": "Doe"
                }
            ]
        }
    ]
}'
```

```json Response theme={null}
{
    "orderDate": "2025-03-06T13:37:04Z",
    "status": "created",
    "checkoutUrl": "https://link-s.paybyrd.com/chk_Qyb1imi9o",
    "tags": 0,
    "index": 1,
    "transactions": [],
    "orderId": "037f5069-aec9-413b-a7d9-1167b131c1c2",
    "amount": "60.00",
    "currency": "EUR",
    "orderRef": "Klarna Bus Reservation",
    "shopper": {
        "customReference": "shp_GeQJEuk1cqv15B11",
        "shopperId": "31d2b911-5c6a-43d2-a302-e87286b7a611",
        "email": "customer@email.pt",
        "firstName": "Peter",
        "lastName": "Parker",
        "phoneCountryCode": 351,
        "phoneNumber": "935556731",
        "shippingAddress": "Avenida Dom João II 40",
        "shippingPostalCode": "1990-094",
        "shippingCity": "Lisboa",
        "shippingState": "LB",
        "shippingCountry": "PRT",
        "shippingType": "Undefined",
        "firstPurchaseDate": "2025-03-06T13:37:04.2065037+00:00",
        "lastPurchaseDate": "2025-03-06T13:37:04.2065037+00:00",
        "billingAddress": "Avenida Dom João II 40",
        "billingPostalCode": "1990-094",
        "billingCity": "Lisboa",
        "billingCountry": "PRT"
    },
    "orderOptions": {
        "redirectUrl": "https://paybyrd.com",
        "culture": "pt-br",
        "sendBy": []
    },
    "paymentOptions": {
        "useSimulated": true,
        "cardOptions": {
            "isPreAuth": false,
            "isDccEnabled": true
        },
        "tokenOptions": {
            "tokenizationMethod": "none"
        },
        "allowedPaymentMethods": [
            "card"
        ],
        "maxAttempts": 3
    },
    "terminalOptions": {
        "notifyChanges": false
    },
    "shoppingCart": {
        "items": [
            {
                "amount": 6000,
                "categories": [
                    "Bus Tickets"
                ],
                "description": "Bilhetes",
                "shipping": {
                    "shippingMethod": "STD"
                },
                "type": "Product",
                "quantity": 1,
                "unitPrice": 6000
            }
        ]
    },
    "busReservations": [
        {
            "pnr": "ABC123",
            "affiliateName": "FlixBus",
            "itineraries": [
                {
                    "departureCity": "Los Angeles",
                    "arrivalCity": "San Francisco",
                    "carrier": "FlixBus",
                    "segmentPrice": 4000,
                    "departureDate": "2025-03-06T14:37:02.955Z",
                    "ticketDeliveryMethod": "EMAIL",
                    "ticketDeliveryRecipient": "customer@email.pt"
                }
            ],
            "passengers": [
                {
                    "firstName": "John",
                    "lastName": "Doe"
                },
                {
                    "firstName": "Jane",
                    "lastName": "Doe"
                }
            ]
        },
        {
            "pnr": "ABC123",
            "affiliateName": "FlixBus",
            "itineraries": [
                {
                    "departureCity": "San Francisco",
                    "arrivalCity": "Los Angeles",
                    "carrier": "FlixBus",
                    "segmentPrice": 2000,
                    "departureDate": "2025-03-06T14:37:02.955Z",
                    "ticketDeliveryMethod": "EMAIL",
                    "ticketDeliveryRecipient": "customer@email.pt"
                }
            ],
            "passengers": [
                {
                    "firstName": "John",
                    "lastName": "Doe"
                }
            ]
        }
    ],
    "marketId": "PT",
    "code": "BYRD200",
    "description": "Operation successfully completed",
    "checkoutKey": "eyJPcmRlcklkIjoiMDM3ZjUwNjktYWVjOS00MzNiLWE3ZDktOTY2N2I0MzFjNGMyIiwiT3JkZXJSZWYiOiJLbGFybmEgQnVzIFJlc2VydmF0aW9uIiwiUGVyc29u111iOjEwLCJMaXZlIjpmYWxzZSwiRW50aXR5SWQiOiIwMzdmNTA2OS1hZWM5LTQzM2ItYTdkOS05NjY3YjQzMWM0YzIiLCJBbW91bnQiOiI2MC4wMCIsIkN1cnJlbmN5IjoiRVVSIn0=",
    "splitPayments": []
}
```

### Working with shipping

There are two ways to send the shipping fee:

1. Add a shopping cart item with type `ShippingFee` when creating the order.
2. In the shopping cart item, set the `amount` inside the `shipping` property. This amount is used only if there is no `ShippingFee` item in the cart.

```json ShippingFee item theme={null}
"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"
        }
    ]
}
```

```json Shipping amount theme={null}
"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 create a Klarna payment by passing the `checkoutKey` from the order response:

```bash Request theme={null}
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}' \
  --data '
{
    "type": "BNPL",
    "amount": "50.00",
    "currency": "EUR",
    "culture": "pt-PT",
    "brand": "KLARNA",
    "salesChannel": "Desktop",
    "shopper": {
        "phoneCountryCode": "+351",
        "phoneNumber": "935556731",
        "email": "customer@email.pt",
        "firstName": "Test",
        "lastName": "Person-pt",
        "billingAddress": "Avenida Dom João II 40",
        "billingCountry": "PRT",
        "billingPostalCode": "1990-094",
        "billingCity": "Lisboa"
    }
}'
```

```json Response theme={null}
{
    "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": "customer@email.pt",
        "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
}
```

To check whether the transaction was accepted, look at the **code** field. A successful response returns **BYRD207**. See the [Create Payment](https://docs.paybyrd.com/api-reference/payments/create-payment.md) API reference for the full list of request parameters, and the [API code reference](https://docs.paybyrd.com/api-reference/api-code-reference.md) for all possible codes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.