Logo
Getting started
    • Overview
    • Authentication
    • Testing
    • Error handling
    • Webhooks
    • Loyalty Tokens
    • Register API
Tutorials
API Reference

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, 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-process
Headers
Authorization
Accept
Bearer {{ personal_access_token }}
application/json
Input parameters
order
object
required
external_identifierstring
required
A unique identifier from your system
statusstring
required
Status of the order return
Possible values:
line_items
array of objects
optional
sub_line_items
array of objects
optional
applied_discounts
array of objects
optional
charges
array of objects
optional
Response Example
Show more
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 { "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": [] }