Purchases
Send purchase
Send a final closed bill to CareCloud. The bill is recorded and processed by the loyalty engine.
What happens when a purchase is sent
- A purchase record is created and its server-generated purchase_id is returned.
- The customer's points balance is updated according to the purchase items, applied rewards, and configured loyalty rules.
- Vouchers selected at bill closure are marked as used.
- A marketing-automation event is triggered.
- The customer's status may be recalculated afterwards based on total purchase amount and other configured criteria.
Related operations
- POST /purchases/actions/accept-payment - calculate applicable discounts and recommended rewards before bill closure; typically called first.
- POST /purchases/actions/recommend-best-rewards - get the list of best-fit rewards available for a bill before deciding which to apply.
- GET /purchases - retrieve purchase records after closure.
post/purchases/actions/send-purchase
Headers
Accept-Languagestring
The unique ID of the language code by ISO 639-1.
Request body
Example request
{
"store_id": "81eaeea13b8984a169c490a325",
"cashdesk_number": 1,
"card_number": "1000000000016",
"customer_id": "8ea2591121e636086a4a9c0992",
"bill": {
"fiscal": true,
"purchase_type_id": "86e05affc7a7abefcd513ab400",
"payment_type": "A",
"payment_recap": {
"credit_points": 7,
"amount_for_credit": 4.2,
"vouchers": [
{
"code": "PTV123",
"name": "10% off your first purchase",
"discount_value": 70,
"discount_percent": 10,
"bill_item_id": "6fd73167342d6899c415320"
}
],
"recommended_discounts": [
{
"bill_item_id": "6fd73167342d6899c415320"
}
]
},
"bill_id": "39475X",
"payment_time": "2016-06-30 15:05:49",
"currency_id": "8bed991c68a470e7aaeffbf048",
"total_price": 700,
"utm": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "spring_sale"
},
"bill_items": [
{
"plu_ids": [
{
"list_code": "GLOBAL",
"code": "abc"
}
],
"plu_name": "Iphone 14",
"category_plu_id": "CA234B",
"vat_rate": 20,
"quantity": 2,
"paid_amount": 1200,
"price": 1200,
"bill_item_id": "6fd73167342d6899c415320",
"loyalty_off": true,
"purchase_item_type_id": "86e05affc7a7abefcd513ab400",
"customer_id": "8ea2591121e636086a4a9c0992",
"purchase_item_property_records": [
{
"property_record_id": "docasna_blokace_darce_do:8ea2591121e636086a4a9c0992",
"property_id": "docasna_blokace_darce_do",
"property_name": "Property #6",
"last_change": "2023-02-02 00:00:00"
}
]
}
],
"property_records": [
{
"property_record_id": "docasna_blokace_darce_do:8ea2591121e636086a4a9c0992",
"property_id": "docasna_blokace_darce_do",
"property_name": "Property #6",
"last_change": "2023-02-02 00:00:00"
}
]
}
}Response
Created
Example response
{
"data": {
"purchase_id": "85c763ebcec2fa488f8857bee"
}
}