Vytvořte E-commerce řešení (E-shop)
Jak použít REST API platformy CareCloud k integraci vašeho e-commerce řešení?
Nastavení a integrace
Zde najdete kompletní příručku pro vývojáře k integraci REST API platformy CareCloud s vaší aplikací. Přečtěte si ji a zjistěte více o procesu integrace a usnadněte si první kroky pomocí odkazu Quickstart. Můžete se naučit, jak používat naše REST API a vytvářet první volání API. Tato příručka umožňuje snadnou autentizaci a bezpečné volání s ohledem na zabezpečení vašich dat. Najdete zde popis parametrů API a jeho verzování, strukturu URL, chybové kódy a HTTP volání.
Využijte REST API Guide platformy CareCloud
Quickstart
Jste tu nový? Začněte s Quickstart!
Naučte se využívat REST API
Vaše první volání API
Autentizace
Naučte se autentizovat s REST API
Jak získat bearer token?
Využívejte API snadno a rychle
Sada API nástrojů
Tady najdete nejsnazší způsob, jak začít používat CareCloud API. Stačí stáhnout "collection" a importovat ji do Vaší instalace aplikace Postman. Během několika minut tak můžete sami volat CC API. Kromě toho se zde dozvíte, jak používat CareCloud API SDK, tedy sadu vývojových nástrojů včetně CareCloud PHP klienta, počínaje instalací balíčku, vytvořením klienta CC API a přístupem ke všem koncovým bodům CC API z objektu $client.
Navíc zde najdete základní stavební prvky Vašeho API PHP klienta, kterého si můžete následně upravit a přizpůsobit Vaši implementaci. Dokumentace Open API 3.0 vám pomůže vygenerovat zmíněného CC API klienta a současně poskytne sadu nástrojů Open API.
Aplikace Postman
Instalujte aplikaci Postman nebo využijte možnost online přístupu
Stáhněte si API kolekci do aplikace Postman
Získáte průvodce až k prvnímu volání API
Use case
Zde najdete podrobné popisy konkrétních případů použití pro vaše potřeby. Inspirujte se popisem osvědčených postupů pro integraci rozhraní REST API platformy CareCloud s vaší aplikací a usnadněte si práci. Použití souvisejících Use case vám ušetří čas i peníze!
Operace se zákaznickými účty
- To successfully sign up for a customer, you have to collect all the customer information. That might require using other CareCloud API resources. This process must be done before creating a customer account by POST] /customers.
- We will show you how to use resource stores, customer sources or customer properties for the use case. To get all options for store_id, you should call [GET] /stores. You will get a response containing the list of stores and their unique IDs.
- Use the values in the sign-up form to let the customer pick the correct one. Store it for later use of POST] /customers.
- Now, you need to know what kind of customer source will be set to the customer. The customer source identifies the place/system/business where your customer came from. In short, it is his origin.
For example, one customer source could be an e-shop (the customer was registered through an e-shop), and another could be brick-and-mortar, so you know he was registered in a store.
Every customer source record of the customer can have an external ID. The ID represents the identification of the customer in that system. Later, you can search customers by this ID to synchronize between systems.
You can call [GET]/customer-sources to get a list of customer sources. Pick the one that fits the source and add an ID to the customer creation request in the following steps. - The customer's properties could be set directly in [POST] /customers or afterward if necessary with endpoint [POST] /customers/{customer_id}/property-records. Lists of all properties are available at [GET] /customer-properties.
- Use the method [POST] /customers to create a customer account. Set store_id as the registration branch of a customer account and customer_source_id as a source of the customer registration.
- Repeat POST method calls if you need to set other resources to the customer account.
The use case can apply to e-shop or production system integration, where you need access to all customer's data and request verification from the customer through the login screen.
We recommended customer verification following way:
- Display a sign-in form to the customer.
- You can display a choice of customer identifier. CareCloud API currently supports options for email and customer's card number.
- Alternatively, you can let the customer fills in his identifier without choosing a type and afterward decide on your side(form processing) if he filled email or customer's card. You can use regular expressions to make a decision.
- The customer fills in his credentials and sends the form.
- The application validates inputs (email format, customer's card format, password format) and informs the customer with an appropriate message in case of invalid input.
- If the customer enters all inputs correctly, the application will validate credentials against CareCloud API with the POST /customers/actions/verify-credentials call.
- Suppose CareClould API verifies a customer as a response. In that case, you will get a customer ID from CareCloud API, which you can use for receiving other customer information like purchases, reservations, loyalty information, or customer data.
- If verification is unsuccessful, you will be informed by an appropriate message from CareCloud API. Depending on the message, you can display your message to the customer in your application.
- The essential information is this use case was designed only for verification, so it doesn't mean the customer was logged in to CareCloud. If you want to log in customer, you need to keep this information on your side.
The use case can apply to e-shop or production system integration, where you need access to data of multiple customers or search for a customer by his identifiers (email, phone number, or name).
We recommended searching customer’s data following way:
- If you need to search for data from one or multiple customers, use the resource GET /customers. To find one or more customers, you need to know their email, phone number, first name, last name, or birthdate.
- Add them into query parameters. The more parameters you fill in, the better and more exact the result will be. In this method, you can get multiple results if the parameter’s value is general, like “name=John”.
- The response contains customer information, including ID, personal data, or consent, that you can process as needed.
- If you want to search for one specific customer and expect only one result from searching, please use the action method GET /customers/actions/search-customers.
- Use strict mode in query parameters. In this mode, you must know the first name, last name, birth date, and customer’s card number.
- If CareCloud has this customer, you are going to get an ID.
- To access the customer’s data, you need to do one extra CareCloud API call where you will add the customer ID from the previous call as a path parameter GET /customers/{customer_id}.
- Every resource or method from previous points returns structures with the customer ID. This ID can be used for other resources as a path parameter to limit results tied to the customer. For example, customer vouchers GET /customers/{customer_id}/vouchers or customer card GET /customers/{customer_id}/cards or customer properties GET /customers/{customer_id}/property-records and other you can find in API reference guide: https://developers.crmcarecloud.com/#tag/Customers
The use case is applied if you need to find a customer with external(other than CareCloud API) identification. More information is below:
- To find a customer with an ID from your system, creating a customer with a customer source record containing that ID is crucial. You can do that at https://carecloud.readme.io/reference/postcustomer. See the customer source parameter.
- You can also add a customer source to the existing customer. To do that, you can use https://carecloud.readme.io/reference/postsubcustomersource.
- If you are sure, all the customers have identification from your system. You can find the customer source record with an external ID in the endpoint https://carecloud.readme.io/reference/getcustomersourcerecords. Add an ID and identification of customer source from CareCloud API to request.
- If the customer source record exists, you will receive a structure with the customer ID in the response.
- You can use customer ID for the next API calls, for example, for customer’s data in endpoint https://carecloud.readme.io/reference/getcustomer or update of the customer in endpoint https://carecloud.readme.io/reference/putcustomer.
The use case describes synchronizing customer data between CareCloud and other systems.
- Try to find the customer in CareCloud with a customer ID from your system(e-shop, POS, ERP, accounting systems, and others). You can find the customer source record with that ID in the endpoint https://carecloud.readme.io/reference/getcustomersourcerecords. Add an ID and identification of customer source from CareCloud API to request.
- If the customer source record exists, you will receive a structure with the customer ID in the response. Now you can get existing customer information and synchronize it in your system https://carecloud.readme.io/reference/getcustomer. Or update an existing customer in CareCloud https://carecloud.readme.io/reference/putcustomer.
- If the customer source does not exist, you must create that customer https://carecloud.readme.io/reference/postcustomer with appropriate identification and customer source.
- This use case will work only if you synchronize an external identification from the start. Otherwise, duplications can occur.
Updating the customer is a critical process, and it is crucial to do it right so you keep all the customer's data. For an update, please follow this use case:
- For an update, you need to know your customer first. That means you have to have his ID. The ID could be reached in multiple ways, which you can find in other use cases. Information on how to get all the customer data is available in use cases: Search customers and get customer personal data or Find a customer by production system identification. Customer ID is available after Customer credentials verification. But then make sure you get complete customer data with GET /customers/{customer_id} to be able to modify them in the update call.
- Now you have everything you need and you can update the customer's data with endpoint PUT /customers/{customer_id}. This endpoint has to contain all the customer information. All parameters that won't be set in the request will be lost because of the principle of the HTTP PUT verb.
- The successful update is represented by 204 HTTP code. In case of an error, the error message explains the issue.
- If you need to update a customer’s properties, please use endpoint PUT /customers/{customer_id}/property-records/{property_record_id}. There you can modify existing properties
This use case describes the process of assigning free cards to the existing customer. In this case, the customer holds the card and knows the number of the card. It covers only cards that exist in the database already and are ready to be used.
- Find the card that customers holds by the card number. To do that, search by query parameter `card_number` in GET /cards.
- If you got a successful result, that means the card you are looking for exists in the database. The next step is to check the card's parameters to confirm it is free to use. You need to check the parameter `customer_id` (should have the value `null`) to make sure the card is not assigned to another customer.
- Next step is to add a customer identification to the card. With the following API call from resource PUT /cards. Set the parameter `customer_id` with the customer id. Other parameters stay unchanged.
- After the successful API call, the card has been assigned to the customer, and it's ready to be used. In case of any error, please follow the error message to find the solution.
The use case can apply to e-shop or production system integration, where a customer needs to change his password in CareCloud.
We recommended changing the customer's password in the following way:
- The customer can request a change if he doesn't remember his password.
- The customer fills in the email address to the application form. The application validates the email address structure.
- After the email address validation, the application checks its existence in CareCloud with an API call GET /customers. If the email address is present, the application sends an email with the link to change the password.
- The customer opens an email and clicks on the link.
- The customer is forwarded to the application form for password change.
- The customer fills out the form with a new password, and the application validates the amount and type of the characters in the password(It must follow the CareCloud API restriction for the password PUT /customers/{customer_id}).
- After successful validation, the application has to update a new password in the customer’s account. For that, the application has to do a CareCloud API call PUT /customers/{customer_id} with the new password.
- If successful, the application shows a success message to the customer and forwards him to the login form.
Odesílání nákupů
The use case describes when the POS, e-shop, or other system wants to send a paid purchase/order. All benefits and discounts were applied (or not), and the system needs to send the purchase/order to CareCloud. If this is the case you are dealing with, please follow:
- Before the transaction, please ensure your system has synchronized products, product groups, and brands with CareCloud. Depending on your setup, synchronization could be necessary every time your products changes.
- To send the purchase, please use the following endpoint [POST] /purchases/actions/send-purchase.
- Ensure you set all necessary parameters; the values match current purchase values; lower the price depending on points or credit use and use all benefits returned from CareCloud API in previous steps (if used). Also, make sure to set the payment_type parameter appropriately depending on the type of transaction.
- In case of success, the CareCloud API will return the purchase ID.
If you need to cancel a purchase already sent to CareCloud, please follow these steps:
- For cancelation of an order or a purchase, please use the endpoint for sending purchase: [POST] /purchases/actions/send-purchase.
- Almost all parameters have to be the same as in the original purchase. The only changes are in parameters `canceled`( `true` value if sending canceled purchase), `bill_id`(has to be a unique number), and `bill_number`(please use `bill_id` from the original purchase/order ).
Uzavíraní účtů
The use case can apply to an e-shop or POS where a customer wants to use his benefits (rewards, discounts, coupons, or vouchers). The use case describes only the part with the application of benefits. The other parts, such as sending the final purchase or identification of the customer, are part of checkout use cases, too.
For the proper application of benefits, please follow this:
- The e-shop sends the current content of the customer's shopping cart and the unique voucher (if the customer added some) codes in the benefit_codes parameter through the end-point in [POST] /purchases/actions/accept-payment.
- Please remember to set all the necessary parameters as payment_type and others depending on the API reference guide.
- Different types of benefits could be applied depending on the chosen setup.
- The CareCloud API returns all possible benefits, which you can apply to the customer's shopping cart, the number of loyalty points gained from the potential purchase, or the total amount of the customer's loyalty points after purchase. If the response doesn't contain any rewards or discounts, our algorithm found no benefit that could be applied to the customer.
- The e-shop will keep all the information from the CareCloud API response.
- If the customer changes the shopping cart's content, the e-shop must repeat the request to the endpoint [POST] /purchases/actions/accept-payment with updated shopping card data. The response to the call can be different this time because the customer might fulfill some of the defined conditions (amount of specific product or money threshold and others).
The use case is designed to allow you to use loyalty points for payments. The POS, e-shop, or another system can process point payments when a customer has available points in his account.
- First, you need to know your customer. For that, you can find a customer by one of the identifiers (please check the use case Get customer personal data) or search him (please check the use case Search customers and get customer personal data).
- After identifying the customer, you need to check his point credit and see if he can process a payment or has enough points to cover the purchase. The resource wallet provides the number of available points here: [GET] /wallet/actions/points-overview.
- Depending on the number of points, POS can send the maximum amount of used points at the purchase with all purchase items in the endpoint [POST] /purchases/actions/accept-payment.
- CareCloud API will respond with a list of recommended benefits and discounts and information about the number of points that can be used with that transaction.
- The POS/e-shop will keep that information about the number of purchase points and lower the final purchase price. Both information will be used in the following request to endpoint [POST] /purchases/actions/send-purchase.
- In the case where a customer wants to modify the shopping cart, you can change [POST] /purchases/actions/accept-payment request and repeat it multiple times before sending a final purchase [POST] /purchases/actions/send-purchase.
The use case is designed to allow you to use credit payments. The POS, e-shop, or another system can process credit payments when a customer has available credits in his account.
- First, you need to know your customer. For that, you can find a customer by one of the identifiers (please check the use case Get customer personal data) or search him (please check the use case Search customers and get customer personal data).
- After identifying the customer, you need to check his credit and see if he can process credit payments or has enough credit to cover the purchase. The resource wallet provides the number of available credits here: [GET] /wallet/actions/credits-overview.
- Depending on the available credit and the customer’s decision on how much credit he wants to use, POS can send the maximum amount of used credit at the purchase with all purchase items in the endpoint [POST] /purchases/actions/accept-payment. In case of credit payment, the appropriate payment_type has to be used ( type C; for more details, please see parameter `payment_type` in the documentation).
- CareCloud API will respond with a list of recommended benefits and discounts and information about the credit that can be used with that transaction.
- The POS/e-shop will keep that information about the used credit and lower the final purchase price. Both information will be used in the following request to endpoint [POST] /purchases/actions/send-purchase.
- In the case where a customer wants to modify the shopping cart, you can change [POST] /purchases/actions/accept-payment request and repeat it multiple times before sending a final purchase [POST] /purchases/actions/send-purchase.
This scenario should be used when you want to synchronize products from POS, e-shop, or other production system into CareCloud. This step should be recommended before you start applying rewards and discounts or sending purchases after checkout.
- If you use product brands they should be synchronized with the endpoint POST /product-brands/batch. It allows you to add multiple product brands in one request. Please consider splitting the request if you have more than 1000 records to make sure the synchronization will be successful.
- For product group synchronization CareCloud API provides endpoint POST /product-groups/batch where you can synchronize all product groups from production systems. The batch method allows you to synchronize multiple product groups in a tree structure where you can mark parent groups if needed.
- The last synchronization endpoint is for the products themselves. Please use the API call of the endpoint POST /products/batch. In this endpoint, you can synchronize multiple products and identify their brands and product groups.
- We recommend you synchronize brands, groups, and products depending on your needs (when a new entity appears in your system or when it is changed). Like brands, please consider the amount of records in one request for each endpoint.
- To avoid problems during synchronization, we recommend you keep an order of synchronization this way:
- Product brands
- Product groups
- Products
Přihlášení k odběru novinek a další operace
If you dont have generated card numbers, but you already has cads physically printed, this case help you to insert a new card into CareCloud.
There is a way how to do it through API. Otherwise, you have to import cards manually to the system via CDP administration and than use following use case.
- If you decide to use an API solution, you can create a new card. For that purpose, you need to know a card type. All card types are available in GET /card-types.
- Now you know the card type, card number, and customer id. You can create a new card in the system. For that please call POST /cards.
- If you have done everything right, you will get a card ID in the response.
- In case of any error, please follow the error message to find a solution.
CDP CareCloud creates a customer account if it doesn't exist. And add a customer source dedicated to newsletters. This use case covers existing customers, customers who signed up for the newsletter, and new customers.
Customer source identifies the source of the customer (email, Facebook, registration, campaign summer 2021). It will tell you what the source of sign-up or registration is. Customers can have multiple customer sources.
- You need to decide what customer source you will use for the newsletter sign-up. A list of available customer sources is available in resource [GET] /cusomer-sources.
- If you want to create a new customer source for an existing customer, you can do it at [POST] /customers/{cusomer_id}/customer-source-records.
- When you have all the necessary data, you can call the action method POST /customers/actions/newsletters-sign-up. The method creates a customer if does not exist and sets all concerts passed from the request and contact source.
If it's a customer who has already signed up for the newsletter and wants to register. You don't have to worry. Just follow the sign-up use case. CPD CareCloud will handle this situation.
Marketing automation events are used to launch a scenario connected to an event. The scenario covers any available automation in the CareCloud platform.
Marketing Automation Events has the following structure of resources:
Event group: It is a general definition of an event. As an administrator, you can define event types that describe the behavior and structure of following events.
Event Properties: A list of properties is defined with the event type. It is a good way to extend the event type possibilities.
Event: It is a resource that allows you to create an event for a specific customer. The event starts a Marketing Automation scenario. It can transfer data to the scenario. Marketing automation scenarios can use the data to make better decisions during their run.
Event property record: It contains property values connected with an event.
Create an event
- If you want to create an event through CareCloud REST API, know what event you wish to create. Correctly set it up, and check if it contains all the necessary properties. If you need to create a new event group, you can do it in the events section of the CareCloud administration. You can also create a new event type or property there. When everything is set up in CareCloud administration, we can go to the next step.
- First, you must decide what event type you want to create an event. To help you decide, you might select an event type depending on the event group. List of the groups you can list with API call of resource GET /event-groups.
- Depending on the results, you can select a list of event types that fits your event group or use other criteria from GET /event-types.
- If you decided on an event type that fits your use case, you could check if you need to use any of the available properties here GET /event-properties.
- Now is the time to create an event for a specific customer. The creation of events also contains values of properties. You set property records in events resource because we need to have all data available for the MA scenario in one API call to start immediately after. Call the method POST /events with parameters.
If you want to inform a customer about his abandoned cart, you can trigger a scenario in the Marketing Automation application following the use case Create a marketing automation event.
There are currently two options for how you can deal with it:
- You will make a decision in your application or e-shop when the basket becomes abandoned. After that, you will create a marketing automation event.
- If you can't decide on the e-shop side, you can create a marketing automation event every time the shopping card is updated and resolve the abandoned login directly in the Marketing Automation application scenario in CareCloud.
![kreslo kreslo](https://www.crmcarecloud.com/wp-content/uploads/2020/05/kreslo.png)
PŘIPOJTE SE DO CLOUDU
Chcete vědět více o funkcionalitách CDP & CRM CareCloud?
Vyplňte své kontaktní údaje a my Vám rádi zodpovíme libovolný dotaz o CareCloud - řešení pro Váš obor, cenovou nabídku, přínosy pro Váš business - vše spolu nezávazně prodiskutujeme.
Náš expert se s Vámi brzy spojí!
Odesláním tohoto formuláře potvrzujete svůj souhlas se zpracováním osobních údajů společností Cortex, a.s. a vyjadřujete souhlas s dalším kontaktem. Vaše údaje budou vymazány po ukončení naší komunikace, pokud nedojde k dohodě o jejich uchování. Vaše údaje jsou u nás zabezpečené v souladu s platnou legislativou.