POS and eCommerce Systems

POS and eCommerce Systems

This integration guide will walk you through the basics of how front-end systems such as point of sales (POS) and eCommerce systems can submit purchase events, spend requests and orders to CRM.COM.
Introduction

Welcome to the CRM.COM API documentation for POS & eCommerce System Integrators!

Throughout this integration guide you will be able to understand the key concepts and methods that are required for a digital integration between a POS & eCommerce System and CRM.COM, enabling transaction and order processing between the two.

The API documentation will start with a quick overview of key POS & eCommerce System/CRM.COM definitions and a few details about design principles that CRM.COM API is based on, followed by reference information about specific endpoints.

Getting Started

The Use Case

CRM.COM is a payments and rewards platform that awards loyal contacts via a broad range of reward offers. An eWallet maintains an open and commerce balance whilst submitted purchases are processed and matched against reward offers and award commerce balance.

Each offer defines a goal that contacts should reach in order to earn an award in the form of cashback, conditional or not, that can be spent on specific products, locations or days/hours.

Contacts can spend their wallet balance (open and commerce) either on request during the purchase submit or by setting auto-spend preferences or as part of an instant discount.

Reduction Method

Reduction method defines how the spend will take place. There are two reduction methods: back-end and front-end, the easier to implement and most commonly deployed being the back-end reduction.

Front-End Reduction

The front-end system submits a purchase event with a spend request and is responsible to reduce the amount of money that the contact should actually pay by the amount to be approved for spent.

Back-End Reduction

The front-end system submits a purchase event with either a spend request or has an auto spend preference matched. In a back-end reduction model the purchase is paid fully and awarded whilst the spend is paid out via a pay-out transaction to the contact’s designated payment method (e.g. PayPal, Card, CRM.COM wallet).

Events and Processes


TRANSACTION ACQUIRING

On checkout, the front-end system submits the purchase transaction to CRM.COM and optionally indicates a spend amount (as per contact request).

VOID TRANSACTION

To void an existing transaction the front-end system submits the purchase transaction that should be voided to CRM.COM.

AD HOC RETURN OF GOODS

When returning products without knowing the initial purchase transaction, the front-end system submits an ad hoc return of goods with the total amount of the returned goods.

PRODUCT SYNCHRONIZATION

Product Synchronization provides the ability for the front-end system to create or update a group of products into CRM.COM. Synchronization can be achieved either during transaction acquiring (creating product skus or product families that do not exist in CRM.COM) or as a dedicated bulk process of creating new or updating existing product skus, families and brands in the CRM.COM.

Core Flows

The following sections cover in detail the core integration flows between CRM.COM and POS & eCommerce System.

ADVANCED FLOWS

Looking for extensive integration flows? For more details, you can checkout our Advanced Flows section.

API SPECIFICATION

For a detailed guideline of our APIs, you can checkout our Back-Office API specification.

Back-End Purchase

The Back-End Purchase flow is the process where the front-end system submits a purchase to be awarded with an optional spend as part of CRM.COM’s back-end rewards reduction process. This typically takes place at the checkout phase of the POS & eCommerce system.

STEP 1 On checkout, the front-end system agent submits the itemized purchase transaction to CRM.COM for Back-End reduction by calling the POST /purchases (example: Back-End Purchase).
On success, CRM.COM provides back to the front-end system a success confirmation and the purchase transaction is closed and contact pays the full purchase amount.
STEP 2 CRM.COM awards and processes any requested spend amount (or automatic spends) real-time based on the provided purchased products.
In the event where any spends were made, CRM.COM will return such amount of money back to the contact’s preferred payment method (e.g. credit card).
STEP 3 Contact is notified via CRM.COM application for any awards/spends due to recent purchase transaction.
DEMO FLOW

Please follow the following link for a quick demonstration of the Back-End Purchase flow.

Purchase with OTP Spend Request

The Purchase with OTP Spend Request flow is the process where the front-end system submits a purchase to be awarded with an optional OTP spend request. This typically takes place at the checkout phase of the POS & eCommerce system.

STEP 1 Contact requests an OTP spend token from CRM.COM. On checkout, the front-end system agent prompts the contact to provide an OTP spend token.
STEP 2 Once provided, the front-end system agent submits the itemized purchase transaction to CRM.COM for Back-End reduction, along with the contact’s OTP by calling the POST /purchases (example: Purchase with OTP Spend Request).
STEP 3 CRM.COM awards and processes any requested spend amount real-time based on the provided purchased products.
In the event where any spend was made, CRM.COM will return such amount of money back to the contact’s preferred payment method (e.g. credit card).
STEP 4 Contact is notified via CRM.COM application for any awards/spends due to recent purchase transaction.
ALTERNATIVE FLOW

In the event where the front-end system wants to apply “Front-End Reduction”, then Step 2 & Step 3 are merged. After submitting the purchase transaction, CRM.COM will award and process any requested spend amount real-time based on the provided purchased products and then provide back to the front-end system the actual spend amount that should be reduced from the total purchase amount. As a result, contact will pay any remaining due amount.

DEMO FLOW

Please follow the following link for a quick demonstration of the OTP Spend Request flow.

Void Purchase

The Void Purchase flow is the process where the front-end system voids an existing purchase transaction.

STEP 1 Agent selects the purchase transaction that wants to cancel.
On confirming such cancellation on the front-end system client, call POST /purchases/{id}/cancel to cancel the purchase transaction on CRM.COM as well (by passing the front-end system purchase transaction id that was used prior on submit purchase flow). On successful cancellation of the purchase, CRM.COM returns back the purchase id.

Any awards/spends related to such purchase are amended as well.
Advanced Flows
Contact Reclaim Purchases

The Contact Reclaim Purchases flow is the process where the front-end system submits a purchase and the contact claims it via applications in order to be awarded.

STEP 1 On checkout, the front-end system agent submits the itemized purchase transaction to CRM.COM for Front-End reduction by calling the POST /purchases (example: Contact Reclaim Purchases). CRM.COM does not award and process any spends.
On success, CRM.COM provides back to the front-end system a success confirmation and the purchase transaction is closed.
STEP 2 The front-end system generates a QR/Barcode and prints it on the contact’s receipt.
STEP 3 Contact scans the QR/Barcode via CRM.COM mobile applications. CRM.COM awards contact’s purchase, but does not trigger any spends.
STEP 4 Contact is notified via CRM.COM application for any awards due to recent purchase transaction.
QR/BARCODE FORMAT

QR CODE FORMAT

QR Code should include the following attributes (order is important & should be semicolon separated)

  • receipt number
  • merchant number
  • venue number
  • purchase amount (x100)

BARCODE FORMAT

Barcode should include the following attributes (order is important & should be semicolon separated)

  • merchant number
  • receipt number
  • purchase amount (x100)
  • venue number
DEMO FLOW

Please follow the following link for a quick demonstration of the QR Code Reclaim flow.

Contact Self-Service Purchases

The Contact Self-Service Purchases flow is the process where the front-end system closes the purchase (without submitting it to CRM.COM) and contact self-submits such purchase in order to be awarded.

STEP 1 On checkout, the front-end system agent does not submit the itemized purchase transaction to CRM.COM. Instead, the contact pays the full purchase amount, the front-end system generates a QR/Barcode and prints it on the contact’s receipt.
STEP 2 Contact scans the QR/Barcode via CRM.COM mobile applications. CRM.COM will award contact’s purchase, but not trigger any spends.
STEP 3 Contact is notified via CRM.COM application for any awards due to recent purchase transaction.
QR/BARCODE FORMAT

QR CODE FORMAT

QR Code should include the following attributes (order is important & should be semicolon separated)

  • receipt number
  • merchant number
  • venue number
  • purchase amount (x100)

BARCODE FORMAT

Barcode should include the following attributes (order is important & should be semicolon separated)

  • merchant number
  • receipt number
  • purchase amount (x100)
  • venue number
DEMO FLOW

Please follow the following link for a quick demonstration of the Self-Service Purchase flow.

Front-End Purchase

The Front-End Purchase flow is the process where the front-end system submits a purchase to be awarded with an optional spend as part of CRM.COM’s front-end rewards reduction process. This typically takes place at the checkout phase of the POS & eCommerce system.

STEP 1 Contact is prompted to provide an identification mean (e.g. phone number, barcode, loyalty identifier) in order to verify whether he/she is participating to CRM.COM Rewards.
Call GET /customers to identify your contact and keep the contact id to the front-end system.
STEP 2 Once identified, the front-end system agent asks whether the contact wants to redeem any of awards.
The itemized purchase transaction is submitted to CRM.COM for Front-End reduction, along with a contact id, the requested spend amount (optional) and pass code (optional) by calling the POST /purchases (example: Front-End Purchase).
STEP 3 CRM.COM awards and processes any requested spend amount real-time based on the provided purchased products.
On success, CRM.COM provides back to the front-end system the actual spend amount based on pre-configured reward evaluation conditions.
The front-end system reduces the returned spend amount from the total purchase amount, contact pays any remaining due amount and the purchase transaction is closed.

Please note that the spend amount can be deducted from the amount to pay by the front-end system, either as a discount (before VAT) or as a payment method (after VAT).
STEP 4 Contact is notified via CRM.COM application for any awards/spends due to recent purchase transaction.
DEMO FLOW

Please follow the following link for a quick demonstration of the Contact Loyalty Search flow.

Product Synchronization

The Product Synchronization flow is the process where the front-end system synchronizes its products to CRM.COM.

SYNC OPTIONS

Product Synchronization can be achieved either real-time on agent request or offline as a dedicated background process on a scheduled time.

STEP 1 Admin agent requests to synchronize the products from the front-end system to CRM.COM.
On confirming such action, call POST /synchronise_products to create or update any group of products from the front-end system over to CRM.COM.
On successful request of such action, CRM.COM returns back a unique process id that can be used for monitoring the progress of such action.
DEMO FLOW

Please follow the following link for a quick demonstration of the Product Synchronization flow.

Order Provisioning

The Order Provisioning flow is the process where the front-end system retrieves CRM.COM orders placed by contacts in order to fulfil them.

ORDER PROVISIONING OPTIONS

Order Provisioning can be achieved either via a CRM.COM Integration Adaptor, where CRM.COM is integrated with the front-end system and consumes its APIs, or using CRM.COM Webhooks, where CRM.COM fires, real-time, a single webhook request with the order details over to the front-end system and then the front-end system is responsible to interpret such order information and process the order.

STEP 1 Contact places an order via CRM.COM mobile or web applications. CRM.COM provisions such order to external systems (e.g. printers and front-end system).

ALTERNATIVE OPTION
In the event where CRM.COM is not integrated with the front-end system, the front-end system can consume CRM.COM Order APIs or Webhooks in order to retrieve the latest (new) orders. Call GET /orders to retrieve new orders. `
STEP 2 Agent selects a new order from the previously created ones. Agent can fulfil (complete) such order or cancel it (e.g. contact changed his/her mind.
ORDER COMPLETION
STEP 2A In the event that the agent accepts to fulfil such order, the agent prepares the order and once is completed should be updated in CRM.COM as well.
Call PUT /orders/{id}/actions (example: Complete Order) to set the order as completed.
STEP 3 On order completion, contact is notified via CRM.COM application about the order status update and any awards/spends due to recent transaction.
ORDER CANCELLATION
STEP 2B In the event that the agent does not accept to fulfil such order, the agent selects a cancellation reason (provided by CRM.COM) of why the order will be cancelled and then cancels the order.
Call GET /order_cancellation_reasons to retrieve the applicable cancellation reasons.
Call PUT /orders/{id}/actions (example: Cancel Order) to set the order as cancelled, including the cancellation reason.
STEP 3 On order cancellation, contact is notified via CRM.COM application about the order status update.
DEMO FLOW

Please follow the following link for a quick demonstration of the Order Management flow.

API Documentation
API Reference

CRM.COM API is organized around REST. Our API has specific resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses and uses standard HTTP response codes, authentication & verbs.

You can use the entire API in test mode, which does not affect your live data. The API Key used to authenticate any of your requests will determine whether the request is on live mode or test mode.

The API may differ based on each CRM.COM release. For every new release with noticable changes that might alter backwards compatibility, a new version will be created.

API SPECIFICATION

For a detailed guideline of our APIs, you can checkout our Back-Office API specification.

Authentication

CRM.COM API uses either API Keys to authenticate requests or an authentication JWT token obtained from a user successful logging in process.

All API requests made by POS & eCommerce integrators should authenticate using an API (Secret) Key, which can be accessed and managed from the CRM.COM Dashboard.

SECURITY NOTICE

All API requests must be made over HTTPS. Any request made over plain HTTP or without authentication will fail. In addition, API Keys carry many privileges, so be sure to keep them secure! Do not share your secret API Keys in publicly accessible areas, such as GitHub or client-side code.

API KEY AUTHORIZATION HEADER EXAMPLE

curl -X $HTTP_METHOD -H "api_key: 2189341e-981e-9ad5-9912-11101670314a" 
Requests

API requests should be made using the HTTPS protocol so that traffic is encrypted. The interface responds to different methods depending on the action required.

Method Usage
POST To create a new object, your request should specify the POST method. The POST request includes all of the attributes necessary to create a new object to the targeted endpoint.
PUT To update the information on an existing object, the PUT method should be used. This will update the specified object if it is found using the provided values, regardless of their current values. If it is not found, the operation will return a response indicating that the object was not found. This idempotency means that you do not have to check for a resource’s availability prior to issuing an update command, the final state will be the same regardless of its existence. Requests using the PUT method do not need to check the current attributes of the object.
DELETE To remove an existing object from your environment, the DELETE method should be used. Similar to PUT method, the DELETE method is idempotent.
GET For retrieving information about customers, purchases or orders, the GET method should be used. Any requested information will be returned as a JSON object. The attributes defined by the JSON object can be used to form additional requests. Any request using the GET method is read-only and will not affect any of the retrieved objects.
Responses

Along with the HTTP methods that the API responds to, CRM.COM uses conventional HTTP response codes and human-readable messages in JSON format to indicate the success or failure of an API request.

In the event of a problem, the status will contain the error code, while the body of the response will usually contain additional information about the problem that was encountered.

HTTP Status Description
2XX Return codes in the 200 range indicate that the request was fulfilled successfully and that no error was encountered.
4XX Return codes in the 400 range, typically, indicate that there was an issue with the request that was sent. Most common reasons could be an invalid authentication method, unauthorised requests or the object that you are requesting does not exist.
5XX Return codes in the 500 range indicate that there is a server-side problem and CRM.COM cannot fulfill your request at the moment.

Most of our 4XX range errors that could be handled programmatically contain all the necessary details for a better integration handling. Such details are

  • HTTP Status Code & Error are used for programmatic consumption
  • Message is human-readable and can be used as a default error message
  • Parameters are used for programmatic consumption and can be used for enhancing the interface error message with additional information

4XX ERROR RESPONSE EXAMPLE

An example of a customer not found error is as follows

HTTP/1.1 400 Bad Request
    {
        "status": 400,
        "message": "Record not found.",
        "error": "CRM.EXCEPTIONS.NOTFOUNDEXCEPTION",
        "parameters": [
            "contact",
            "789dacae-cf71-414f-9483-ca88acaa46432"
        ]
    }
Response Codes

Below is a list of our common HTTP response codes that can be returned.

200 OK

The request has succeeded

400 Bad Request

The input request was invalid or incorrect, often due to missing a required parameter

401 Unauthorized

The provided API Key or Token is invalid

403 Forbidden

The API key or Token does not have permissions to perform the request

404 Not Found

The requested resource does not exist

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request

502 Bad Gateway

The server received an invalid response from the upstream server it accessed in attempting to fulfill the request

503 Service Unavailable

The server is currently unable to handle the request due to a temporary overloading or maintenance

504 Gateway Timeout

The server did not receive a timely response from the upstream server