Post-delivery
In this section, you will learn more about how to manage your orders after they have been shipped using Klarna’s order management API.
- Retrieve a capture.
- Add new shipping information to a capture.
- Trigger a new send out of customer communication.
- Refund an amount of a captured order.
- Add a return fee when doing a refund.
- Release the remaining authorization for an order.
- Extend the customer’s payment due date.
Prerequisites
- You have already obtained your API credentials
- You have captured the amount stated in the delivery page
Tip: You can read more in-depth technical content on the API / SDK reference page.
Retrieve a capture
Retrieving all information related to a capture, e.g. shipping/billing information or order lines that were captured.
Use case
You need to view what information is related to a shipped item.
1. Retrieve the capture information from Klarna
Send in the order id and the specific capture id you want to know more about.
1 2 3
GET /ordermanagement/v1/orders/{order_id}/captures/{capture_id} Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
200
- OK
- The server has fulfilled the request and the capture information is returned
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
HTTP/1.1 200 OK Content-Type: application/json { "capture_id": "5b33ed47-79d0-4d76-99ea-4afaa7c8e552", "klarna_reference": "4K7Q6QF6-1", "captured_amount": 6000, "captured_at": "2017-01-10T10:31:17.973Z", "description": "Shipped the full order", "order_lines": [ { "reference": "123050", "type": "physical", "quantity": 10, "quantity_unit": "kg", "name": "Tomatoes", "total_amount": 6000, "unit_price": 600, "total_discount_amount": 0, "tax_rate": 2500, "total_tax_amount": 1200 } ], "refunded_amount": 0, "billing_address": { "given_name": "John", "family_name": "Doe", "title": "Mr", "street_address": "123 Fake St", "postal_code": "12345", "city": "New York", "region": "NY", "country": "US", "email": "john@doe.com", "phone": "123456" }, "shipping_address": { "given_name": "John", "family_name": "Doe", "title": "Mr", "street_address": "123 Fake St", "postal_code": "12345", "city": "New York", "region": "NY", "country": "US", "email": "john@doe.com", "phone": "123456" }, "shipping_info": [ { "shipping_company": "DHL US", "tracking_number": "1234567890", "return_shipping_company": "UPS", "return_tracking_number": "112233445566778899" } ] }
Add new shipping information to a capture
Shipping information can be attached to a capture, this will help you and us to keep track of orders sent to the customer. Read more about delivery tracking .
Use case
You have made a capture of your order, now after sending the order you want to add the shipping details.
1. Add the shipping information and make the API call
Send in the shipping details and add them to a specific capture.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
POST /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/shipping-info Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json { "shipping_info": [ { "shipping_company": "DHL US", "tracking_number": "1234567890", "return_shipping_company": "UPS", "return_tracking_number": "112233445566778899" } ] }
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
201 - Created
- The server has fulfilled the request
Trigger a new send out of customer communication
Trigger a new send out of customer communication and settlement details. Typically used to inform customers about changes to their order. This triggers an email to the customer with the latest details.
Use case
The customer did not receive the invoice as expected and you want to send a new invoice.
1. Make the API call and trigger a new send out
1 2 3
POST /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/trigger-send-out Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
204
- No Content - The server has fulfilled the request
In case of a 404
response, the response body will indicate whether the order or capture was not found
Refund an amount of a captured order
Refund an amount of a captured order. The refunded amount will be credited back to the customer.
The refunded amount must not be higher than captured_amount
.
The refunded amount can optionally be accompanied by a descriptive text and order lines.
Sending updated order lines allows Klarna to visualize what was refunded to the customer.
In case of multiple captures (shipments), allocating the refund to the right customer payment instruction requires consistent order lines. Find all the details here .
Use case
The customer sends item(s) back and you need to refund the customer with the specific amount.
1. Add new amount and make API call
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
POST /ordermanagement/v1/orders/{order_id}/refunds Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json { "refunded_amount": 3000, "description": "Refunding half the tomatoes", "order_lines": [ { "type": "physical", "reference": "123050", "name": "Tomatoes", "quantity": 5, "quantity_unit": "kg", "unit_price": 600, "tax_rate": 2500, "total_amount": 3000, "total_tax_amount": 600 } ] }
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
201
- Created
- The server has fulfilled the request
Add a return fee when doing a refund
Deduct a return fee from a refund amount
Add a special order line “return_fee” in the refund call to deduct the cost of return from the amount you are refunding to your customer. Use case
Your customer is returning a purchased good, and you want to charge them for the shipping costs associated with the return. Add a return fee when doing a refund To add a fee, make sure that the amount of the “return_fee” order line is negative. A negative amount means that you want to subtract it from the total refund amount. For example, if the customer wants to return an item worth 500 and the return cost is 50, then the total amount you will refund to the customer is 450 = 500 + (-50).
In other words, the “refunded_amount” must be equal to the sum of all “total_amount” order lines, including the “return_fee” order line.
1. Make refund API call with “return_fee” order line
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
POST /ordermanagement/v1/orders/{order_id}/refunds Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json { "refunded_amount": 2000, "description": "Refunding half the tomatoes", "order_lines": [ { "type": "physical", "reference": "123050", "name": "Tomatoes", "quantity": 5, "quantity_unit": "kg", "unit_price": 600, "tax_rate": 2500, "total_amount": 3000, "total_tax_amount": 600 }, { "type": "return_fee", "name": "Return shipping", "quantity": 1, "unit_price": -1000, "tax_rate": 2500, "total_amount": -1000, "total_tax_amount": -200 } ] }
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
201
- Created
- The server has fulfilled the request
Undo return fee
The “return_fee” order line can be easily undone by inverting the sign of the order line (from negative to positive).
1. Make refund API call with a positive “return_fee” order line amount
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
POST /ordermanagement/v1/orders/{order_id}/refunds Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json { "refunded_amount": 1000, "description": "Revert return fee", "order_lines": [ { "type": "return_fee", "name": "Return shipping", "quantity": 1, "unit_price": 1000, "tax_rate": 2500, "total_amount": 1000, "total_tax_amount": 200 } ] }
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
201
- Created
- The server has fulfilled the request
Decrease return fee
The “return_fee” order line can be easily decreased by refunding a new “return_fee” order line with a positive amount equal to the change you want to make. For example, if you have charged your customer 50 for returning goods and you want to lower that return fee to 40, you should send in a return fee with the positive amount 10. Then the total return fee will be -50 (from the initial refund) + 10 = 40.
1. Make refund API call with a positive “return_fee” order line amount
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
POST /ordermanagement/v1/orders/{order_id}/refunds Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json { "refunded_amount": 750, "description": "Revert return fee", "order_lines": [ { "type": "return_fee", "name": "Return shipping", "quantity": 1, "unit_price": 750, "tax_rate": 2500, "total_amount": 750, "total_tax_amount": 150 } ] }
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
201
- Created
- The server has fulfilled the request
Availability
There are a few important prerequisites for the “return_fee” order line to work. These criteria must be met:
- The order must be fully captured in only one capture of the full amount, i.e., no part captures are allowed.
- The summed amount of the order lines must be exactly equal to the “refunded_amount”. No rounding errors are allowed.
- The sum of all (including historical) return fees cannot become greater than 0. For example, adding a fee of -500 and then another fee of 550 (= 50) would not be allowed.
Signal that there is no intention to perform further captures and remaining amount should be released. If the purchase was made by card then Klarna will refund the remaining authorization to the customer.
Use case
You and the customer are happy with the delivery and you have no need to change or update the order. The custumer should thus not be debited for the remaining order amount, if the custumer has paid by card the remaining amount should be refunded to the customer.
1. Get the order id and make the API call
You need the specific order id to release the remaining authorization.
1 2 3
POST /ordermanagement/v1/orders/{order_id}/release-remaining-authorization Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
204
- No Content - The server has fulfilled the request
Extend the customer’s payment due date to Klarna
Give the customer more time to pay for their purchase by extending the order’s due date. This feature is available for orders where the customer has chosen a pay later product, such as Pay in 30 days or Pay in 4 installments.
Pricing
Please note that this is a paid feature. Due to the increased credit cost for Klarna, we take a fee for the payment time extension. Find the full pricing information here .
Use case
Accidents and mistakes happen. Have you shipped the wrong goods? Or, were the goods broken when they reached your customer? Regardless of the reason, the customer rightfully deserves some extra time to pay for their purchase. In such cases, the customer’s payment due date can be extended.
Here’s how it works:
Please note that extending the payment due date is made on capture (shipment) level. This is because Klarna associates every capture with an indivual invoice for the customer.
1. Make the API call to get the available options for extending the due date
1 2 3
GET /ordermanagement/v1/orders/{order_id}/capture/{capture_id}/extend-due-date-options Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json
2. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
In case of a 404
response, the response body will indicate whether the order or capture was not found
200
- OK
- The server has fulfilled the request. Please note that fees
may be empty, meaning no options are currently available.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
HTTP/1.1 200 OK Content-Type: application/json { "currency": "SEK", "options": [ { "number_of_days": 2 "amount": 0 }, { "number_of_days": 10, "amount": 1000 }, { "number_of_days": 30, "amount": 1900 }, { "number_of_days": 60, "amount": 4900 } ] }
3. Use one of the retrieved options and make the API call to extend the due date
1 2 3 4 5 6 7
POST /ordermanagement/v1/orders/{order_id}/capture/{capture_id}/extend-due-date Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= Content-Type: application/json { "number_of_days": 2 }
4. Handle the response from Klarna
Klarna will respond with one of the following:
Error message
- something went wrong
In case of a 404
response, the response body will indicate whether the order or capture was not found
204
- No Content
- The server has fulfilled the request.