---
title: "Accept payment"
method: POST
path: "/purchases/actions/accept-payment"
tags: ["Purchases"]
---

# Accept payment

`POST /purchases/actions/accept-payment`

Calculate the applicable discounts, vouchers, and points for a bill before it is finalised. The response contains the recommendations the cashier can present to the customer; it does not commit the purchase.

**What happens when accept-payment is called**

- CareCloud evaluates the supplied bill items against the customer's eligible benefits (vouchers, discounts, point payment).
- The response contains `recommended_discounts`, `vouchers`, `credit_points`, and related fields the cashier can apply.
- No purchase record is created and no benefits are consumed by this call. To finalise the bill, call [POST /purchases/actions/send-purchase](https://carecloud.readme.io/reference/postpurchasesend) afterwards.

**Related operations**

- [POST /purchases/actions/recommend-best-rewards](https://carecloud.readme.io/reference/postpurchaserecommendedrewards) - get the list of best-fit rewards for a bill before deciding which to apply.
- [POST /purchases/actions/send-purchase](https://carecloud.readme.io/reference/postpurchasesend) - finalise the bill after the customer accepts the calculated payment.

## 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 the 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 resource customers.
  - `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.*
  - `max_points` number, float — Amount of points to be redeemed.
  - `max_credit` number, float — Amount of credit customer wants to use in the purchase.
  - `benefit_codes` string[] — The bill closure will use present codes and recommend discounts.
  - `bill` Bill, required — Structure of bill from POS.
    - `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 [currencies](https://carecloud.readme.io/reference/getcurrencies).
    - `total_price` number, float, required — The total price of the bill as a sum of all items.
    - `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)*

## Response `200`

OK

- object
  - `data` AcceptedPayment — The structure contains values for applied rewards, vouchers, discounts, and other benefits.
    - `recommended_discounts` DiscountItem[] — The list of offered discounts excludes rewards (Loyalty Status Discount).
      - `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.
    - `credit_points` number, float — Amount of used points.
    - `price_of_credit_points` number, float — Amount of money corresponding to the number of used points.
    - `credit` number, float — Amount of used credits.
    - `vouchers` PaymentVoucher[] — List of applied rewards/vouchers on the current bill (includes the value of discount) independent of DiscountItem.
      - `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.
    - `credit_points_of_this_transaction` number, float — Sum of points gained from this transaction.
    - `total_credit_points` number, float — Amount of the points on the customer account (after the recent purchase is closed).
    - `total_credit` number, float — Amount of the credits on the customer account (after the recent purchase is closed).
    - `messages` CashierMessage[] — A recommendation messages for the cashier in his language localization.
      - `text` string — Text of the message.

## 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)
