Order Returns
Order Returns represent reversals of previously created Orders in the Leat system. They are typically generated by external systems (e.g. web shops, POS systems
Order Returns represent reversals of previously created Orders in the Leat system. They are typically generated by external systems (e.g. web shops, POS systems, kiosks, etc.) when an order—or part of it—is refunded, or returned. In Leat, returns play a crucial role in accurately adjusting Loyalty, Marketing, Data and Automation flows. For example, a return may revoke previously awarded points or reverse a prepaid transaction.
Create And Process Order Return
Creates a new Order Return and processes it at once (i.e. handling corrections for the initial Order). It returns both the Order Return entity itself and a result object. If an Order Action was configured for the Account and the original Order triggered a Run, this is executed in sync and will populate the result object. An example of such a result would be a transaction containing loyalty points that reverses or corrects the points awarded during the original Order.
POST
https://api.piggy.eu/api/v3/oauth/clients/order-returns/create-and-processHeaders
Authorization
Accept
Bearer {{ personal_access_token }}
application/json
Input parameters
order
object
required
The corresponding original Order for this Order Return
uuid string
required if external_identifier is missing
UUID of the Order
external_identifier string
required if uuid is missing
External identifier of the Order
external_identifier string
required
A unique identifier from your system
status string
required
Status of the order return
Possible values:
PENDINGPending fulfilment
COMPLETEDOrder Return has been completed.
line_items
array of objects
optional
List of Line Items to be returned
external_identifier string
required
External identifier of the Line Item
quantity number
required
Quantity of the Line Item
discount_amount number
optional
Discount amount of the Line Item to be returned
total_amount number
optional
Total amount of the Line Item to be returned (after discounts). If not given, remaining quantity and price will be used to calculate the total amount to be returned, discounts may be ignored.
reason string
optional
The reason that the Line Item was returned
sub_line_items
array of objects
optional
List of Sub Line Items that should be returned
external_identifier string
required
External identifier of the Sub Line Item
quantity number
required
Quantity of the Sub Line Item
discount_amount number
optional
Discount amount of the Sub Line Item to be returned
total_amount number
optional
Total amount of the Sub Line Item to be returned (after discounts). If not given, remaining quantity and price will be used to calculate the total amount to be returned, discounts may be ignored.
reason string
optional
The reason that the Sub Line Item was returned
applied_discounts
array of objects
optional
List of Discounts applied to this Order
external_identifier string
required
External identifier of the Applied Discount
amount number
required
Amount to be returned
charges
array of objects
optional
Any charges not included as line items. E.g. gratuity, service charges or shipping
external_identifier string
required
External identifier of the Charge
amount number
optional
The cost of the charge, before discounts, in the currency's lowest denomination, to be returned
discount_amount number
optional
The discount amount, in the currency's lowest denomination, to be returned
total_amount number
required
The total cost of the charge, after discounts, in the currency's lowest denomination, to be returned
Response Example
{
"data": {
"return": {
"uuid": "5558761f-5974-448e-ae6c-2efcf11f266c",
"status": "COMPLETED",
"order": {
"uuid": "0f7c7bb3-5228-48c5-abdc-1b9cdcaacd9a"
},
"line_item_returns": [
{
"uuid": "7416cc03-3214-4b5b-8001-921bf4ff3163",
"quantity": 5,
"line_item": {
"uuid": "19a237a3-4a00-400f-aeef-c7c976a87454"
},
},
],
"sub_line_item_returns": [
{
"uuid": "bd5cc183-715e-41f4-b305-34097ff04839",
"quantity": 1,
"sub_line_item": {
"uuid": "b941af99-c19a-4066-8bd5-5952ac3207ea"
},
},
],
},
"result": {
"type": "POINTS_TRANSACTION",
"data": {
"points": 35,
"new_balance": 2267,
}
}
},
"meta": []
}