Use the Order management API to make a refund with fees when your customers want to return items.
When your customers ask for a refund and want to return the items they bought, you can charge a return fee using this API call.
Your customers are charged with this return fee at the moment of refund, meaning that we take the return fee from the refunded amount they receive.
Charging the return fee is only possible if the orders meet the required conditions:
To charge return fees, you have to call the same endpoint you use for refunding an order, but with type: return_fee
as an additional parameter in order_lines
.
Send a POST
request to the {apiUrl}/ordermanagement/v1/orders/{order_id}/refunds
endpoint.
Include the following in your request:
description
(optional): text to add details of the refunds. Your customers can see this descriptionorder_lines
(required): list of details associated with this capture. You have to add an extra order line representing the return fee and set its type
to return_fee
reference
(optional): internal reference to the refundrefunded_amount
(required): the total order amount to be refunded. It must be less or equal to the captured_amount
from the order capture{
"refunded_amount": 9500,
"order_lines": [
{
"name": "T-Shirt",
"type": "physical",
"quantity": 1,
"unit_price": 10000,
"total_amount": 10000
},
Sample request to refund with return fees.
You must add the parameter type: return_fee
in the order lines to charge the return fee successfully. Adding this parameter lets your customer visualize the fee in the Klarna app.
If the request is successful, you'll receive a 201 Created
response, including refund_id
and location
as HTTP response headers.
If your request contains errors, you'll receive an error response. Make sure the order is already captured and the order_id
in the request is correct.
You can use the correlation_id,
and the order_id
values to troubleshoot the call in the Merchant portal logs section.
{
"error_code": "REFUND_NOT_ALLOWED",
"error_messages": [
"Over refund is not allowed. Refund not possible."
],
"correlation_id": "7863c755-eb1b-4b24-a884-06c2368389d7"
}
Sample of an error response to refund with return fees.
You can also remove the charged fees added in the request explained above. For this action, you have to send a new request to refund an order, including the amount previously charged as a return fee.
Ready to send this request? See the API reference of this call.