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:
- Creating the Order: Replicates the Order in the Leat system.
- 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:
- 'business_profile' instead of 'shop': This entity has already been renamed in the Leat dashboard for some time now and will be named as such in API calls.
- Refactor of Credit Receptions: As part of a larger refactor of the core of our Loyalty engine, some new entities have been introduced, whilst others have been renamed. For this particular API, this means a
points_transactionwill be returned as a result instead ofcredit_reception. - Input parameters: For previous API endpoints, input parameters like a Contact's UUID were given as
contact_uuid. In this newest endpoint, an object is expected instead.
Create And Process Order
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).
https://api.piggy.eu/api/v3/oauth/clients/orders/create-and-processBearer {{ personal_access_token }}application/jsonexternal_identifierstringrequiredreferencestringoptionalstatusstringrequiredCREATEDOrder has just been created, not yet completedPENDINGPending fulfilment and/or paymentCOMPLETEDOrder has been completedCANCELLEDOrder was cancelled before completionpayment_statusstringrequiredUNPAIDPayment process has not been startedPENDINGPayment process started, pending confirmationPAIDPayment successfultotal_order_amountnumberrequiredorder_amountnumberoptionaltotal_discount_amountnumberoptionalcurrencystringoptionalpaid_atstringoptionalcompleted_atstringoptionalcontactobjectrequireduuidstringrequiredbusiness_profileobjectrequireduuidstringrequiredline_itemsarray of objectsrequiredexternal_identifierstringrequirednamestringrequiredquantitynumberrequiredpricenumberrequiredtotal_amountnumberrequireddiscount_amountnumberoptionalproductobjectoptionaluuidstringrequired if external_identifier is missingexternal_identifierstringrequired if uuid is missingresultobjectoptionaluuidstringrequiredtypestringrequiredGIFTCARD_TRANSACTIONGiftcard TransactionPREPAID_TRANSACTIONPrepaid TransactionVOUCHERVouchersub_line_itemsarray of objectsoptionalexternal_identifierstringrequirednamestringrequiredquantitynumberrequiredpricenumberrequiredtotal_amountnumberrequireddiscount_amountnumberoptionalproductobjectoptionaluuidstringrequired if undefinedexternal_identifierstringrequired if undefinedapplied_discountsarray of objectsoptionalexternal_identifierstringrequirednamestringrequiredamountnumberrequiredtypestringoptionalPERCENTAGEFor percentage based discountsABSOLUTEFor absolute discountsvaluenumberoptionalapplied_tostringrequiredORDERIndicates Discount is applied on an Order levelORDER_LINESIndicates Discount is applied to individual Line Items, Sub Line Items, and/or Chargesline_itemsarray of objectsoptionalexternal_identifierstringrequiredsub_line_itemsarray of objectsoptionalexternal_identifierstringrequiredchargesarray of objectsoptionalexternal_identifierstringrequiredofferobjectoptionaluuidstringrequiredtypestringrequiredREWARD_REDEMPTIONReward RedemptionCOLLECTABLE_REWARD_REDEMPTIONCollectable Reward RedemptionVOUCHER_REDEMPTIONVoucher Redemptionchargesarray of objectsoptionalexternal_identifierstringrequiredtypestringoptionaldeprecatednamestringrequiredamountnumberoptionaldiscount_amountnumberoptionaltotal_amountnumberrequiredcharge_definitionobjectoptionalSERVICE_CHARGEA service charge applied to the orderGRATUITYGratuity or tipSHIPPINGShipping costsWRAPPINGWrapping costsTAXSeparate tax charges. Do not add if taxes are already included in line item total amounts.uuidstringrequired if undefinedexternal_identifierstringrequired if undefinedpaymentsarray of objectsoptionaluuidstringrequiredtypestringrequiredGIFTCARD_TRANSACTIONGiftcard TransactionPREPAID_TRANSACTIONPrepaid Transaction1
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).
https://api.piggy.eu/api/v3/oauth/clients/ordersBearer {{ personal_access_token }}application/jsonexternal_identifierstringrequiredreferencestringoptionalstatusstringrequiredCREATEDOrder has just been created, not yet completedPENDINGPending fulfilment and/or paymentCOMPLETEDOrder has been completedCANCELLEDOrder was cancelled before completionpayment_statusstringrequiredUNPAIDPayment process has not been startedPENDINGPayment process started, pending confirmationPAIDPayment successfultotal_order_amountnumberrequiredorder_amountnumberoptionaltotal_discount_amountnumberoptionalcurrencystringoptionalpaid_atstringoptionalcompleted_atstringoptionalcontactobjectrequireduuidstringrequiredbusiness_profileobjectrequireduuidstringrequiredline_itemsarray of objectsrequiredexternal_identifierstringrequirednamestringrequiredquantitynumberrequiredpricenumberrequiredtotal_amountnumberrequireddiscount_amountnumberoptionalproductobjectoptionaluuidstringrequired if external_identifier is missingexternal_identifierstringrequired if uuid is missingresultobjectoptionaluuidstringrequiredtypestringrequiredGIFTCARD_TRANSACTIONGiftcard TransactionPREPAID_TRANSACTIONPrepaid TransactionVOUCHERVouchersub_line_itemsarray of objectsoptionalexternal_identifierstringrequirednamestringrequiredquantitynumberrequiredpricenumberrequiredtotal_amountnumberrequireddiscount_amountnumberoptionalproductobjectoptionaluuidstringrequired if undefinedexternal_identifierstringrequired if undefinedapplied_discountsarray of objectsoptionalexternal_identifierstringrequirednamestringrequiredamountnumberrequiredtypestringoptionalPERCENTAGEFor percentage based discountsABSOLUTEFor absolute discountsvaluenumberoptionalapplied_tostringrequiredORDERIndicates Discount is applied on an Order levelORDER_LINESIndicates Discount is applied to individual Line Items, Sub Line Items, and/or Chargesline_itemsarray of objectsoptionalexternal_identifierstringrequiredsub_line_itemsarray of objectsoptionalexternal_identifierstringrequiredchargesarray of objectsoptionalexternal_identifierstringrequiredofferobjectoptionaluuidstringrequiredtypestringrequiredREWARD_REDEMPTIONReward RedemptionCOLLECTABLE_REWARD_REDEMPTIONCollectable Reward RedemptionVOUCHER_REDEMPTIONVoucher Redemptionchargesarray of objectsoptionalexternal_identifierstringrequiredtypestringoptionaldeprecatednamestringrequiredamountnumberoptionaldiscount_amountnumberoptionaltotal_amountnumberrequiredcharge_definitionobjectoptionalSERVICE_CHARGEA service charge applied to the orderGRATUITYGratuity or tipSHIPPINGShipping costsWRAPPINGWrapping costsTAXSeparate tax charges. Do not add if taxes are already included in line item total amounts.uuidstringrequired if undefinedexternal_identifierstringrequired if undefinedpaymentsarray of objectsoptionaluuidstringrequiredtypestringrequiredGIFTCARD_TRANSACTIONGiftcard TransactionPREPAID_TRANSACTIONPrepaid Transaction1
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.
https://api.piggy.eu/api/v3/oauth/clients/orders/{uuid}/processBearer {{ personal_access_token }}application/jsonuuidstringrequired1
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.
https://api.piggy.eu/api/v3/oauth/clients/orders/findBearer {{ personal_access_token }}application/jsonexternal_identifierstringrequired1
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.
https://api.piggy.eu/api/v3/oauth/clients/orders/{uuid}Bearer {{ personal_access_token }}application/jsonstatusstringoptionalCREATEDOrder has just been created, not yet completedPENDINGPending fulfilment and/or paymentCOMPLETEDOrder has been completedCANCELLEDOrder was cancelled before completionpayment_statusstringoptionalUNPAIDPayment process has not been startedPENDINGPayment process started, pending confirmationPAIDPayment successful1
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).
https://api.piggy.eu/api/v3/oauth/clients/orders/simulateBearer {{ personal_access_token }}application/jsonstatusstringoptionalCREATEDOrder has just been created, not yet completedPENDINGPending fulfilmentCOMPLETEDWhen createdpayment_statusstringoptionalUNPAIDPayment process has not been startedPENDINGPayment process started, pending confirmationPAIDPayment successfultotal_order_amountnumberrequiredorder_amountnumberoptionaltotal_discount_amountnumberoptionalcurrencystringoptionalcontactobjectoptionaluuidstringrequiredbusiness_profileobjectrequireduuidstringrequiredline_itemsarray of objectsrequirednamestringrequiredquantitynumberrequiredpricenumberrequiredtotal_amountnumberrequireddiscount_amountnumberoptionalproductobjectoptionaluuidstringoptionalexternal_identifierstringoptionalsub_line_itemsarray of objectsoptionalnamestringrequiredquantitynumberrequiredpricenumberrequiredtotal_amountnumberrequireddiscount_amountnumberoptionalproductobjectoptionaluuidstringoptionalexternal_identifierstringoptionalapplied_discountsarray of objectsoptionalnamestringrequiredamountnumberrequiredtypestringoptionalPERCENTAGEFor percentage based discountsABSOLUTEFor absolute discountsvaluenumberoptionalapplied_tostringrequiredORDERFor Order level discountsLINE_ITEMSFor Line Item level discountsSUB_LINE_ITEMSFor Sub Line Item level discountschargesarray of objectsoptionalnamestringrequiredamountnumberoptionaldiscount_amountnumberoptionaltotal_amountnumberrequiredcharge_definitionobjectoptionalSERVICE_CHARGEA service charge applied to the orderGRATUITYGratuity or tipSHIPPINGShipping costsWRAPPINGWrapping costsTAXSeparate tax charges. Do not add if taxes are already included in line item total amounts.uuidstringrequired if undefinedexternal_identifierstringrequired if undefined1
2
3
4
5
6
7
8
9
{
"data": {
"type": "points_transaction",
"data" : {
"points": 35
},
},
"meta": []
}