---
title: "Send purchase"
method: POST
path: "/purchases/actions/send-purchase"
tags: ["Purchases"]
---

# Send purchase

`POST /purchases/actions/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](https://carecloud.readme.io/reference/postpurchaseacceptpayment) - calculate applicable discounts and recommended rewards before bill closure; typically called first.
- [POST /purchases/actions/recommend-best-rewards](https://carecloud.readme.io/reference/postpurchaserecommendedrewards) - get the list of best-fit rewards available for a bill before deciding which to apply.
- [GET /purchases](https://carecloud.readme.io/reference/getpurchases) - retrieve purchase records after closure.

## Headers

- `Accept-Language` string

## Request body

- object
  - `store_id` string, required — ID of the store.
  - `cashdesk_number` integer, required — Number of the cash-desk in store.
  - `card_number` string — The customer card number.
  - `customer_id` string — ID of the customer that made the purchase. You can search customers by plenty parameter in the resource customers.
  - `bill` FinalBill, required — Final bill structure.
    - `fiscal` true | false — Information, whether it is a fiscal bill.
    - `purchase_type_id` string, required — Type of the purchase. Values are available in resource [GET /purchase-types](https://carecloud.readme.io/reference/getpurchasetypes).
    - `canceled` true | false, required — Information, whether it is the cancellation of the purchase. It is the only parameter that identifies the canceled purchase. All other values are the same as in the original bill. No different values like totalPrice, quantity, paidAmount, and itemPrice are changed nor inverted.
    - `payment_type` 'S' | 'A' | 'C' | 'D', required — Payment type changes the checkout process depending on the value of the parameter you can allow/deny the use of benefits. *Possible values are: "S" - with standard setup checkout process allows you to collect points, but isn't possible to apply overall discounts / "A"- checkout process allows you to collect points and apply overall discounts too / "C" - use credits for payment, allows you to collect points, but isn't possible to apply overall discounts / "D"- will enable you to use overall discounts, but you are not able to collect points with this setup*
    - `payment_recap` PaymentRecap — Alternative payment methods summary. ⚠️ Ensure that all relevant parameters received in the response from the `POST /accept-payment` endpoint are correctly transferred to the `payment_recap` structure. This is essential for accurate calculation of rewards, discounts, and other customer benefits.
      - `credit_points` number, float — Amount of the points used for payment of the purchase.
      - `amount_for_credit` number, float — Amount of the credits used for payment of the purchase.
      - `vouchers` PaymentVoucher[] — List of used vouchers/rewards for the payment of purchases.
        - `code` string — Code of a reward or a voucher used in the purchase.
        - `name` string — Name of the reward.
        - `discount_value` number, float — Value of discount in the currency of the purchase.
        - `discount_percent` number, float — Value of discount in percent.
        - `bill_item_id` string — ID of the related bill item.
      - `recommended_discounts` DiscountItem[] — List of applied discounts where the service did not use the voucher/reward.
        - `discount_code` string — Code of discount (set value “offline” for offline mode discounts).
        - `discount_value` number, float — Value of discount in the currency of the bill.
        - `discount_percent` number, float — Discount percentage of the bill.
        - `description` string — Text description of the discount reason.
        - `bill_item_id` string, required — ID of the related bill item.
    - `bill_id` string, required — Identification number of the purchase created in the production system like POS, e-commerce solution or ERP (The ID must be unique in the production system). In case you want to send cancelled purchase, please use prefix `C` for the original purchase ID. Example: ``` Original purchase ID: 39475X Canceled purchase ID: C39475X ```
    - `bill_number` string — Alternative identification of the bill. In the case of cancellation, there should be bill_id from the original bill.
    - `payment_time` string, required — Timestamp of the payment. Accepts the format `YYYY-MM-DD HH:MM:SS` or ISO-8601 format (`YYYY-MM-DDTHH:MM:SS`). All times must be in the local timezone.
    - `created_by` string — Name of the user who created a bill.
    - `currency_id` string, required — ID of the currency from resource [GET /currencies](https://carecloud.readme.io/reference/getcurrencies).
    - `total_price` number, float, required — The total price of the bill as a sum of all items.
    - `utm` UTM — UTM structure for data from email campaign.
      - `utm_source` string — Use utm_source to identify a search engine, newsletter name, or other sources. (Example: google).
      - `utm_medium` string — Use utm_medium to identify a medium such as an email or cost-per-click. (Example: cpc).
      - `utm_campaign` string — Used for keyword analysis. Use utm_campaign to identify a specific product promotion or strategic campaign. (Example: utm_campaign=spring_sale).
    - `bill_items` BillItem[], required — List of bill items.
      - `plu_ids` PluId[], required — An array of all available pluIds from the particular product lists (default is Product ID from Global product list (consist cleaned data - unique ID of every product across all POS systems)).
        - `list_code` string, required — Code of the particular product list (basic is code of Global product list (consist cleaned data - unique ID of every product across all POS systems)). For example, “GLOBAL”, “SKU”, “PLU”, etc.
        - `code` string, required — Code of product from the product list (basic is Product ID from Global product list (consist cleaned data - unique ID of every product across all POS systems)).
      - `plu_name` string, required — Product name.
      - `category_plu_id` string — Product group ID identify the product group in the system outside of CareCloud (POS, e-shop, etc.). Consist cleaned data - unique ID of every product group across all POS systems. This parameter needs to be set only if product learning is activated. If not set during product learning the default product group will be used.
      - `vat_rate` number, float, required — VAT rate of the item.
      - `quantity` number, float, required — Quantity of product.
      - `paid_amount` number, float, required — Real money value (unit price * quantity) paid by the customer (The value for a pharmaceutical client could have a copayment for drug prescription or money value of drugs not covered by an insurer).
      - `price` number, float, required — Value of parameter "paid_amount". In the case of a pharmaceutical client, add to the value of "paid_amount" a value of money covered by the customer health insurance.
      - `bill_item_id` string, required — ID of the bill item.
      - `loyalty_off` true | false, required — Switch off all loyalty benefits (points, discounts- instant and campaign prices, vouchers) on the item.
      - `purchase_item_type_id` string, required — Type of the purchase item from resource [purchase-item-types](https://carecloud.readme.io/reference/getpurchaseitemtypes).There is a distinction between a purchase in an e-shop, in a brick-and-mortar store, a mobile application, or a cancellation of the purchase. It also differentiates purchases without the possibility of applying loyalty benefits from ordinary purchases or from purchases with the application of loyalty points.
      - `customer_id` string — The ID of the customer. [GET /customers](https://carecloud.readme.io/reference/getcustomers)
      - `purchase_item_property_records` PropertyRecord[] — List of properties for the purchase item.
        - `property_record_id` string — The unique ID of the property record.
        - `property_id` string, required — The unique ID of the property.
        - `property_name` string — Name of the property.
        - `property_value` union — Value of the property record. The format depends on the data type of the property. - **string** – a plain text value: ```json { "property_id": "p1_note", "property_value": "VIP customer" } ``` - **date** – a date string in `YYYY-MM-DD` format: ```json { "property_id": "p1_birth_date", "property_value": "1985-06-15" } ``` - **integer** – a whole number: ```json { "property_id": "p1_visit_count", "property_value": 42 } ``` - **float** – a decimal number: ```json { "property_id": "p1_average_spend", "property_value": 149.90 } ``` - **enum** – a single-item array containing a PropertyItem object: ```json { "property_id": "p1_favourite_color", "property_value": [ { "id": "86e05affc7a7abefcd513ab400", "name": "Blue", "resource_record_id": null, "state": 1 } ] } ``` - **multiselect** – a multi-item array of PropertyItem objects: ```json { "property_id": "p1_favourite_color", "property_value": [ { "id": "86e05affc7a7abefcd513ab400", "name": "Blue", "resource_record_id": null, "state": 1 }, { "id": "81eaeea13b8984a169c490a325", "name": "Green", "resource_record_id": null, "state": 1 } ] } ``` - **custom data type** – the format depends on the specific data type configuration. For example, a serialized JSON object: ```json { "property_id": "p1_address", "property_value": "{\"street\":\"Main St\",\"city\":\"Prague\"}" } ```
          - string
          - number
          - integer
          - boolean
          - unknown[]
            - unknown
          - object
        - `last_change` string — Date and time of the last change. *(YYYY-MM-DD HH:MM:SS)*
    - `property_records` PropertyRecord[] — List of a purchase property records
      - `property_record_id` string — The unique ID of the property record.
      - `property_id` string, required — The unique ID of the property.
      - `property_name` string — Name of the property.
      - `property_value` union — Value of the property record. The format depends on the data type of the property. - **string** – a plain text value: ```json { "property_id": "p1_note", "property_value": "VIP customer" } ``` - **date** – a date string in `YYYY-MM-DD` format: ```json { "property_id": "p1_birth_date", "property_value": "1985-06-15" } ``` - **integer** – a whole number: ```json { "property_id": "p1_visit_count", "property_value": 42 } ``` - **float** – a decimal number: ```json { "property_id": "p1_average_spend", "property_value": 149.90 } ``` - **enum** – a single-item array containing a PropertyItem object: ```json { "property_id": "p1_favourite_color", "property_value": [ { "id": "86e05affc7a7abefcd513ab400", "name": "Blue", "resource_record_id": null, "state": 1 } ] } ``` - **multiselect** – a multi-item array of PropertyItem objects: ```json { "property_id": "p1_favourite_color", "property_value": [ { "id": "86e05affc7a7abefcd513ab400", "name": "Blue", "resource_record_id": null, "state": 1 }, { "id": "81eaeea13b8984a169c490a325", "name": "Green", "resource_record_id": null, "state": 1 } ] } ``` - **custom data type** – the format depends on the specific data type configuration. For example, a serialized JSON object: ```json { "property_id": "p1_address", "property_value": "{\"street\":\"Main St\",\"city\":\"Prague\"}" } ```
        - string
        - number
        - integer
        - boolean
        - unknown[]
          - unknown
        - object
      - `last_change` string — Date and time of the last change. *(YYYY-MM-DD HH:MM:SS)*

## Response `201`

Created

- object
  - `data` object
    - `purchase_id` string — The unique ID of the purchase.

## Other responses

- `400` — Bad input parameter. The response body's `error.error_data.invalid_params[]` array lists the parameters that caused the failure, each carrying a `reason` code. See the `BadRequestErrorBody` schema for the generic reason taxonomy. Operations with domain-specific business rules document additional reasons at the operation level.
- `401` — The client has invalid credentials or auth token.
- `403` — The client does not exist or the client tried to access an unauthorized property or resource.
- `404` — The resource was not found.
- `405` — The resource does not support the specified HTTP method.
- `429` — Too many requests - more than the resource limit.
- `500` — Server is not working as expected.
- `503` — Temporary state when the service is temporarily unavailable, overloaded or there is a maintenance window.

---

[API](https://skmtc.net/crmcarecloud/apis/rest-api-reference.md) · [All operations](https://skmtc.net/crmcarecloud/apis/rest-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/crmcarecloud/rest-api-reference/revisions/329c06dbf8d9/schema)
