Purchases

There are the purchases tied to customer accounts stored in CRM CareCloud. The purchases are saved online when closing the bill or imported by the offline web service after the purchase. There are many parameters that specifies the purchase like bill items and its prices, date and time of the purchase, store, where purchase was made or loyalty card number. All this data are used for segmentation or voucher creation.

Available methods

All available methods for resource purchases.

HTTP method Endpoint Description
[badge-blue GET] /purchases Get information about a collection of purchases
[badge-blue GET ] /purchases/{purchase_id} Get information about a specific purchase

Available methods with sub-resources

All available methods for sub-resources of resource purchases.

HTTP method Endpoint Description
[badge-blue GET ] /purchases/{purchase_id}/purchase-items Collection of the purchase items
[badge-blue GET ] /purchases/{purchase_id}/vouchers Collection of vouchers
[badge-blue GET ] /purchases/{purchase_id}/points Collection of points

Actions

Action methods for resource purchses.

HTTP method Endpoint Description
[badge-blue GET] /purchases/{purchase_id}/actions/payment-summary Action method returns payment summary of the purchase. Shows credit, points and vouchers summary.
[badge-green POST] /purchases/actions/recommended-best-rewards Method returns all available rewards for POS installation. Rewards can be used later in send purchase process
[badge-green POST] /purchases/actions/accept-payment This method processes purchase closure from POS
[badge-green POST] /purchases/actions/send-purchase Method send the final closed bill to CareCloud from POS

Get all purchases

Get a list of purchases saved in CRM
[badge-blue GET] /purchases

Query string

Parameter name Type Description Mandatory (Yes/No)
count integer The number of records to return.
Default value is 100.
No
offset integer The number of records from a collection to skip.
Default value is 0.
No
sort_field string One of the query string parameters for sorting.
Response is sorted by the specified field.
No
sort_direction string Direction of sorting the response list.
Possible values are: ASC / DESC
No
store_id string The unique id for the store where purchase was made No
customer_id string The unique id for the customer No
type_id integer Purchase type No
payment_time_from string Date and time from of the purchase payment (YYYY-MM-DD HH:MM:SS) No
payment_time_to string Date and time to of the purchase payment (YYYY-MM-DD HH:MM:SS) No

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
purchases Purchase[] List of purchases
total_items integer Count of all found purchases

Get a purchase

Get information about a specific purchase
[badge-blue GET] /purchases/{purchase_id}

Path parameters

Parameter name Type Description Mandatory (Yes/No)
purchase_id string The unique id for the purchase Yes

Response

Status code: 200 OK
Output structure : Purchase


Return payment summary

Action method shows credit, point and voucher summary of purchase.
[badge-blue GET] /purchases/{purchase_id}/actions/payment-summary

Path parameters

Parameter name Type Description Mandatory (Yes/No)
purchase_id string The unique id of the purchase Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
earned_points float Amount of earned points of the purchase.
used_credits float Amount of credits used to pay of the purchase
used_points float Amount of points used to pay of the purchase
used_points_total float Amount of points used to pay and used in vouchers of the purchase
used_vouchers Voucher[] List of used vouchers


Recommended best rewards

Method returns all available rewards for POS installation. The output contains list of all available and valid rewards. Each reward contains a parameter of maximum usage of rewards in a purchase. If amount equals zero, reward can not be applied. Rewards are allways connected to products through bill items.

[badge-green POST] /purchases/actions/recommended-best-rewards

Request

Parameter name Type Description Mandatory (Yes/No)
store_id string Id of store Yes
cashdesk_number integer Number of the cashdesk in store Yes
card_number string A customer's card number Yes
reward_list_type string Type of the rewards
Possible values: F - full (all manual rewards available and valid for the specific POS)/ C -condensed (only manual rewards corresponding to items on the bill - maxCount not equals zero)/ A - all rewards list including automatic apply this is only for the DATA CUBE
Yes
bill Bill Structure of bill from POS Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
recommended_best_rewards RecommendedReward[] List of the best rewards for POS


Accept payment

The method processes bill closure requests. CareCloud returns information about discounts, applied vouchers, and points used for payment that change the bill's final price.

[badge-green POST] /purchases/actions/accept-payment

Request

Parameter name Type Description Mandatory (Yes/No)
store_id string Id of the store Yes
cashdesk_number integer A store cashdesk number Yes
card_number string A customer's card number No
payment_type string Method of the bill closure
Possible values: ā€œSā€-standard / ā€œDā€- use discount now
Yes
max_points string Amount of points to be redeemed No
max_credit string Amount of credits to be used No
benefit_codes string[] The bill closure will use present codes and recommend discounts No
bill Bill Structure of a bill from POS Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
accepted_payment AcceptedPayment The structure contains values for applied rewards, vouchers, discounts, and other benefits


Send purchase

The method sends the final closed bill to CareCloud. It returns info about success/failure in the response.

[badge-green POST] /purchases/actions/send-purchase

Request

Parameter name Type Description Mandatory (Yes/No)
store_id string Id of the store Yes
cashdesk_number integer Number of the cashdesk in the store Yes
card_number string Number of the customer's card No
bill FinalBill Structure of the final bill from POS Yes

Response

Status code: 201 Created
Output structure : object

Parameter name Type Description
purchase_id string Id of the created purchase