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

Orders

Orders are replicas of the orders generated by external software (e.g. web shops, ordering apps, POS systems, kiosks et cetera), to be used by Leat as the driving force behind our Loyalty, Marketing, Data and Automation tools. In the Leat dashboard, clients can setup Actions to be triggered after the successful creation of an Order in the Leat system. This can result in Leat objects such as a Points Transaction or a Prepaid Transaction.

Using Orders for Loyalty purposes requires two steps:

  1. Creating the Order: Replicates the Order in the Leat system.
  2. Processing the Order: Clients will set up their so-called Order Action in their dashboard to decide how to process the Order within the Leat system. This will usually entail converting the Order into a Points Transaction (currently the only option, to be extended in the near future).

For some integrations, it makes sense to split the two steps, and only perform the second step under certain circumstances. For most integrations, however, both steps are required. To make it easier for those, a combined Create and Process Order endpoint has been added.

New conventions

Please note: this API call uses conventions that will be used in the V4 version of our API and from this points onwards. If you're already familiar with our API, take note of the following:

Create And Process Order

RECOMMENDED

Creates a new Order in the Leat system and directly processes it. Returns both the Order entity itself and a result object containing the result of the Order Action as configured by the Client. Currently, the only type of Order Action supported is the creation of a Points Transaction. However, please take into account that more result types will be added in the future (e.g. Prepaid Transaction).

Note that all monetary amounts – like total_order_amount – are to be given in the currency's lowest denomination (e.g. €34,50 -> 3450).

POST
https://api.piggy.eu/api/v3/oauth/clients/orders/create-and-process
Headers
Authorization
Accept
Bearer {{ personal_access_token }}
application/json
Input parameters
external_identifierstring
required
A unique identifier from your system
referencestring
optional
A human readable identifier from your system, for reference purposes only
statusstring
required
Status of the order
Possible values:
payment_statusstring
required
Status of the payment of the order
Possible values:
total_order_amountnumber
required
Total order amount, after discounts and other charges, in the currency's lowest denomination.
order_amountnumber
optional
Total order amount, before discounts and other charges, in the currency's lowest denomination
total_discount_amountnumber
optional
Total discount amount, in the currency's lowest denomination
currencystring
optional
Order currency in ISO 4217 format; defaults to Account's default currency
paid_atstring
optional
The date and time this Order was paid, in ISO 8601 format
completed_atstring
optional
The date and time this Order was completed, in ISO 8601 format
contact
object
required
business_profile
object
required
line_items
array of objects
required
applied_discounts
array of objects
optional
charges
array of objects
optional
payments
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 { "data": { "order": { "uuid": "bfada889-6a69-4fcf-aed6-42933ae9084d", "contact": { "uuid": "12345-abcdefg-6789-yuiop", "email": "spongebob@bikinibottom.sea" }, "business_profile": { "uuid": "12345-abcdefg-6789-yuiop", "name": "HeadQuarters" }, "external_identifier": "EXT-0012", "reference": "Order B-2110", "status": "COMPLETED", "payment_status": "PAID", "currency": "EUR", "formatted_total_order_amount": "€ 33.31", "order_amount": 3175, "total_charges_amount": 381, "total_discount_amount": 225, "total_order_amount": 3331, "paid_at": "2025-05-01T20:10:44+00:00", "completed_at": "2025-05-01T20:11:03+00:00", "line_items": [ { "uuid": "021as-8892k-ljkafds-98as", "external_identifier": "LI_IT_11090_lkajsf", "name": "Double Krabby Patty", "quantity": 2, "price": 1250, "total_amount": 2500, "discount_amount": 0, "product": { "external_identifier": "PR-12-401", "name": "Double Krabby Patty", }, "sub_line_items": [ { "uuid": "87a4be97-73dd-40a4", "external_identifier": "SU_LI_IT_11090_lkajsf", "name": "Extra Secret Sauce", "quantity": 1, "price": 500, "total_amount": 500, "discount_amount": 0, "product": { "external_identifier": "PR-15-454", "name": "Extra Secret Sauce", } } ] }, { "uuid": "187-8Dfadf3-lsdf234ds-99ass", "external_identifier": "LI_IT_991_Ac990s", "name": "Kelp Soda", "quantity": 2, "price": 450, "total_amount": 675, "discount_amount": 225, "product": { "external_identifier": "PR-12-401", "name": "Double Krabby Patty", }, }, ], "applied_discounts": [ { "uuid": "021as-8892k-ljkafds-98as", "external_identifier": "DISC_25_OFF_DRINKS", "name": "25% off Drinks", "amount": 225, "type": "PERCENTAGE", "value": 25, "applied_to": "LINE_ITEM", "line_items": [ { "external_identifier": "LI_IT_991_Ac990s", }, ], }, "charges": [ { "external_identifier": "SRV_CH-12", "type": "SERVICE_CHARGE", "name": "Service charge: 12%", "amount": 381, "discount_amount": 0, "total_amount": 0 }, ], "created_at": "2025-05-01T20:11:58+00:00", "updated_at": "2025-05-01T20:11:58+00:00" }, "result": { "type": "POINTS_TRANSACTION", "data": { "points": 35, "new_balance": 2267, } } }, "meta": [] }

Create Order

Creates a new Order in the Leat system. It does not yet process the Order, so no Points Transaction will be created just yet. Call the Process Order endpoint to convert the Order into a Points Transaction. Alternatively, use the Create and Process Order endpoint instead.

Note that all monetary amounts – like total_order_amount – are to be given in the currency's lowest denomination (e.g. €34,50 -> 3450).

POST
https://api.piggy.eu/api/v3/oauth/clients/orders
Headers
Authorization
Accept
Bearer {{ personal_access_token }}
application/json
Input parameters
external_identifierstring
required
A unique identifier from your system
referencestring
optional
A human readable identifier from your system, for reference purposes only
statusstring
required
Status of the order
Possible values:
payment_statusstring
required
Status of the payment of the order
Possible values:
total_order_amountnumber
required
Total order amount, after discounts and other charges, in the currency's lowest denomination.
order_amountnumber
optional
Total order amount, before discounts and other charges, in the currency's lowest denomination
total_discount_amountnumber
optional
Total discount amount, in the currency's lowest denomination
currencystring
optional
Order currency in ISO 4217 format; defaults to Account's default currency
paid_atstring
optional
The date and time this Order was paid, in ISO 8601 format
completed_atstring
optional
The date and time this Order was completed, in ISO 8601 format
contact
object
required
business_profile
object
required
line_items
array of objects
required
applied_discounts
array of objects
optional
charges
array of objects
optional
payments
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 { "data": { "uuid": "bfada889-6a69-4fcf-aed6-42933ae9084d", "contact": { "uuid": "12345-abcdefg-6789-yuiop", "email": "spongebob@bikinibottom.sea" }, "business_profile": { "uuid": "12345-abcdefg-6789-yuiop", "name": "HeadQuarters" }, "external_identifier": "EXT-0012", "reference": "Order B-2110", "status": "COMPLETED", "payment_status": "PAID", "currency": "EUR", "formatted_total_order_amount": "€ 33.31", "order_amount": 3175, "total_charges_amount": 381, "total_discount_amount": 225, "total_order_amount": 3331, "paid_at": "2025-05-01T20:10:44+00:00", "completed_at": "2025-05-01T20:11:03+00:00", "line_items": [ { "uuid": "021as-8892k-ljkafds-98as", "external_identifier": "LI_IT_11090_lkajsf", "name": "Double Krabby Patty", "quantity": 2, "price": 1250, "total_amount": 2500, "discount_amount": 0, "product": { "external_identifier": "PR-12-401", "name": "Double Krabby Patty", }, "sub_line_items": [ { "uuid": "87a4be97-73dd-40a4", "external_identifier": "SU_LI_IT_11090_lkajsf", "name": "Extra Secret Sauce", "quantity": 1, "price": 500, "total_amount": 500, "discount_amount": 0, "product": { "external_identifier": "PR-15-454", "name": "Extra Secret Sauce", } } ] }, { "uuid": "187-8Dfadf3-lsdf234ds-99ass", "external_identifier": "LI_IT_991_Ac990s", "name": "Kelp Soda", "quantity": 2, "price": 450, "total_amount": 675, "discount_amount": 225, "product": { "external_identifier": "PR-12-401", "name": "Double Krabby Patty", }, }, ], "applied_discounts": [ { "uuid": "021as-8892k-ljkafds-98as", "external_identifier": "DISC_25_OFF_DRINKS", "name": "25% off Drinks", "amount": 225, "type": "PERCENTAGE", "value": 25, "applied_to": "LINE_ITEM", "line_items": [ { "external_identifier": "LI_IT_991_Ac990s", }, ], }, "charges": [ { "external_identifier": "SRV_CH-12", "type": "SERVICE_CHARGE", "name": "Service charge: 12%", "amount": 381, "discount_amount": 0, "total_amount": 0 }, ], "created_at": "2025-05-01T20:11:58+00:00", "updated_at": "2025-05-01T20:11:58+00:00" }, "meta": [] }

Process Order

Processes an existing Order in the Leat system and returns a result object. If an Order Action was configured for the Account, then this is executed in sync and will fill the result object. An example of such a result would be a transaction containing loyalty points.

POST
https://api.piggy.eu/api/v3/oauth/clients/orders/{uuid}/process
Headers
Authorization
Accept
Bearer {{ personal_access_token }}
application/json
Input parameters
uuidstring
required
The uuid of the order in your Leat system
Response Example
Show more
1 2 3 4 5 6 7 8 9 10 { "data": { "type": "POINTS_TRANSACTION", "data": { "points": 35, "new_balance": 2267, } }, "meta": [] }

Find Order

Use the external_identifier to find an Order.

GET
https://api.piggy.eu/api/v3/oauth/clients/orders/find
Headers
Authorization
Accept
Bearer {{ personal_access_token }}
application/json
Input parameters
external_identifierstring
required
A unique identifier from your system
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 { "data": { "uuid": "bfada889-6a69-4fcf-aed6-42933ae9084d", "contact": { "uuid": "12345-abcdefg-6789-yuiop", "email": "spongebob@bikinibottom.sea" }, "business_profile": { "uuid": "12345-abcdefg-6789-yuiop", "name": "HeadQuarters" }, "external_identifier": "EXT-0012", "reference": "Order B-2110", "status": "COMPLETED", "payment_status": "PAID", "currency": "EUR", "formatted_total_order_amount": "€ 33.31", "order_amount": 3175, "total_charges_amount": 381, "total_discount_amount": 225, "total_order_amount": 3331, "paid_at": "2025-05-01T20:10:44+00:00", "completed_at": "2025-05-01T20:11:03+00:00", "line_items": [ { "uuid": "021as-8892k-ljkafds-98as", "external_identifier": "LI_IT_11090_lkajsf", "name": "Double Krabby Patty", "quantity": 2, "price": 1250, "total_amount": 2500, "discount_amount": 0, "product": { "external_identifier": "PR-12-401", "name": "Double Krabby Patty", }, "sub_line_items": [ { "uuid": "87a4be97-73dd-40a4", "external_identifier": "SU_LI_IT_11090_lkajsf", "name": "Extra Secret Sauce", "quantity": 1, "price": 500, "total_amount": 500, "discount_amount": 0, "product": { "external_identifier": "PR-15-454", "name": "Extra Secret Sauce", } } ] }, { "uuid": "187-8Dfadf3-lsdf234ds-99ass", "external_identifier": "LI_IT_991_Ac990s", "name": "Kelp Soda", "quantity": 2, "price": 450, "total_amount": 675, "discount_amount": 225, "product": { "external_identifier": "PR-12-401", "name": "Double Krabby Patty", }, }, ], "applied_discounts": [ { "uuid": "021as-8892k-ljkafds-98as", "external_identifier": "DISC_25_OFF_DRINKS", "name": "25% off Drinks", "amount": 225, "type": "PERCENTAGE", "value": 25, "applied_to": "LINE_ITEM", "line_items": [ { "external_identifier": "LI_IT_991_Ac990s", }, ], }, "charges": [ { "external_identifier": "SRV_CH-12", "type": "SERVICE_CHARGE", "name": "Service charge: 12%", "amount": 381, "discount_amount": 0, "total_amount": 0 }, ], "created_at": "2025-05-01T20:11:58+00:00", "updated_at": "2025-05-01T20:11:58+00:00" }, "meta": [] }

Update Order

Use the uuid to update an existing Order.

PUT
https://api.piggy.eu/api/v3/oauth/clients/orders/{uuid}
Headers
Authorization
Accept
Bearer {{ personal_access_token }}
application/json
Input parameters
statusstring
optional
Status of the order
Possible values:
payment_statusstring
optional
Status of the payment of the order
Possible values:
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 { "data": { "uuid": "bfada889-6a69-4fcf-aed6-42933ae9084d", "contact": { "uuid": "12345-abcdefg-6789-yuiop", "email": "spongebob@bikinibottom.sea" }, "business_profile": { "uuid": "12345-abcdefg-6789-yuiop", "name": "HeadQuarters" }, "external_identifier": "EXT-0012", "reference": "Order B-2110", "status": "COMPLETED", "payment_status": "PAID", "currency": "EUR", "formatted_total_order_amount": "€ 33.31", "order_amount": 3175, "total_charges_amount": 381, "total_discount_amount": 225, "total_order_amount": 3331, "paid_at": "2025-05-01T20:10:44+00:00", "completed_at": "2025-05-01T20:11:03+00:00", "line_items": [ { "uuid": "021as-8892k-ljkafds-98as", "external_identifier": "LI_IT_11090_lkajsf", "name": "Double Krabby Patty", "quantity": 2, "price": 1250, "total_amount": 2500, "discount_amount": 0, "product": { "external_identifier": "PR-12-401", "name": "Double Krabby Patty", }, "sub_line_items": [ { "uuid": "87a4be97-73dd-40a4", "external_identifier": "SU_LI_IT_11090_lkajsf", "name": "Extra Secret Sauce", "quantity": 1, "price": 500, "total_amount": 500, "discount_amount": 0, "product": { "external_identifier": "PR-15-454", "name": "Extra Secret Sauce", } } ] }, { "uuid": "187-8Dfadf3-lsdf234ds-99ass", "external_identifier": "LI_IT_991_Ac990s", "name": "Kelp Soda", "quantity": 2, "price": 450, "total_amount": 675, "discount_amount": 225, "product": { "external_identifier": "PR-12-401", "name": "Double Krabby Patty", }, }, ], "applied_discounts": [ { "uuid": "021as-8892k-ljkafds-98as", "external_identifier": "DISC_25_OFF_DRINKS", "name": "25% off Drinks", "amount": 225, "type": "PERCENTAGE", "value": 25, "applied_to": "LINE_ITEM", "line_items": [ { "external_identifier": "LI_IT_991_Ac990s", }, ], }, "charges": [ { "external_identifier": "SRV_CH-12", "type": "SERVICE_CHARGE", "name": "Service charge: 12%", "amount": 381, "discount_amount": 0, "total_amount": 0 }, ], "created_at": "2025-05-01T20:11:58+00:00", "updated_at": "2025-05-01T20:11:58+00:00" }, "meta": [] }

Simulate Order Result

Simulates the result of a new Order in the Leat system. Please note that the actual result may differ, as some time-based rules may be in place. Also, some rules may not be applied if the required information is missing from the payload (e.g. contact).

POST
https://api.piggy.eu/api/v3/oauth/clients/orders/simulate
Headers
Authorization
Accept
Bearer {{ personal_access_token }}
application/json
Input parameters
statusstring
optional
Status of the order
Possible values:
payment_statusstring
optional
Status of the payment of the order
Possible values:
total_order_amountnumber
required
Total order amount, after discounts and other charges, in the currency's lowest denomination
order_amountnumber
optional
Total order amount, before discounts and other charges, in the currency's lowest denomination
total_discount_amountnumber
optional
Total discount amount, in the currency's lowest denomination
currencystring
optional
Order currency in ISO 4217 format; defaults to Account's default currency
contact
object
optional
business_profile
object
required
line_items
array of objects
required
applied_discounts
array of objects
optional
charges
array of objects
optional
Response Example
Show more
1 2 3 4 5 6 7 8 9 { "data": { "type": "points_transaction", "data" : { "points": 35 }, }, "meta": [] }