Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
nameblue

Table of Contents

...

  • Web API Key
  • Username & Password

Authentication Recommended Recommended Authentication Method

The recommended method of authentication is using Web API Keys of a "System Key" classification. Web API Keys are assigned to specific users in order to access a specific organization and can be used to authenticate users through Web API, resulting to an authentication token that can subsequently be used by other Web API calls, without any data restrictions

...

Web API Key Method Example

Note
iconfalse
titleReference

Visit API Authentication for more information

Using Fields Set

CRM.COM Web APIs offer the possibility ability to select the fields that will be retrieved from each API method by specifying the "fields_set" input parameter.

Using such this parameter provides developers have the ability to filter the response object and retrieve only the fields that will be used for the desired implementation. If "fields_set" is not specified, then all fields of the response will be retrievedUsing

The "fields_set Example" attribute is used for each call throughout the entire integration guide

Note
iconfalse
titleReference

Visit Introduction - Using Fields Sets for more information

Using Pagination

There are some API methods that retrieve a large number of entities, such as list API methods. Some of these CRM.COM API methods provide the option to apply pagination on the results retrieved.

In such cases the API call should be constructed using the following input parameters

  • number_of_results: The number of results that can be retrieved through each call. The maximum number of results can be 50, and objects are returned in chronological order (oldest requests are retrieved fist)
  • offset: Defines the number of entities that should be skipped from the results. During the first call it should be set to 0 and then it should be increased based on the number of results that were retrieved

...

Note
iconfalse
titleReference

Visit Introduction - Using Pagination for more information

Integration Scenarios

Purchase and Spend Award Flow

...

Step 1 - Customer Identification

NoDescriptionWeb API ExamplePOS Conceptual Examples
1

The customer is identified on the POS system by providing an identification mean. Such identification can be an email address, a phone number, a card number, etc

 

Identifying a customer in CRM.COM (also referred as rewards participant) should be performed using the POST rewards_participants/show method

The following identification means can be used to identify a customer in CRM.COM

  • number: A unique number that is related to each rewards participant
  • access_token_identifier: An access token that is related to a rewards participant. An access token is the most common parameter to use for customer identification purpose, because it can be easily assigned to a rewards participant and usually is mapped to the customer's email address, phone number or card number
Code Block
titlePOST Request
https://hostname/crmapi/rest/v2/rewards_participants/show
Code Block
titleBody
linenumberstrue
collapsetrue
{
	"token": "{{token}}",
	"rewards_participant_identifier":{
		"access_token_identifier":{
			"authentication_code":"test@crm.com"
		}
	},
	"fields_set":"accounts_receivable,wallet"
}

Prior Customer Identification

2

Once a customer is identified in CRM.COM, then the full information of the customer is returned

 

The following information can be displayed on the POS screen

  • The name of the customer (accounts_receivable.account_owner.name)
  • The available balance of the customer's wallet (wallet.balance)
Code Block
titleResponse
linenumberstrue
collapsetrue
{
	"data":{
		"wallet": {
			"number": "W0000000001,
			"balance": "5.00",
			...
		},      
		"accounts_receivable":{
			"life_cycle_state": "ACTIVE",
			"number": "400",
			"name": "First Name Last Name",
			"id": "123456789"
			"account_owner":{
				"name": "First Name Last Name",
				"first_name": "First Name"
				"last_name": "Last Name",
				"life_cycle_state": "FINANCIAL",                
				"title": "Ms",
				"type": "PERSON",
				...
			},
			...
		}
	},
	"status":{
		"message": null,
		"description": null,
		"code": "OK"
	}
}

After Customer Identification

Step 2 - Preview Award and Spend Information (Optional)

NoDescriptionWeb API Example

POS Conceptual Examples

1

Prior completing the sales transaction on POS, customer may request to know their available balance and the amount that are eligible to spend on the related transaction. In addition, the preview method will determine whether the purchase customer event that will be submitted can be redeemed by the Front-End System (i.e. POS) or by a Back-End System

 

Previewing such information should be performed using the POST customer_events/purchases/preview method, and the following information should be passed to CRM.COM

  • The related customer (accounts_receivable_identifier)
  • The sales transaction's reference number (reference_number)
  • The sales transaction's date (performed_on)
  • The sales transaction's merchant (performed_by_unit_identifier)
  • The sales transaction's items and the amount per each item (products_set)
Code Block
titlePOST Request
https://hostname/crmapi/rest/v2/customer_events/purchases/preview
Code Block
titleBody
linenumberstrue
collapsetrue
{
	"token": "{{token}}",
	"rewards_participant_identifier":{
		"access_token_identifier":{
			"authentication_code": "test@crm.com"
		}
	},

	"reference_number": "Ref101",
	"performed_by_unit_identifier":{
		"name" : "Unit"
	},
	"performed_on": "2017-06-22T15:00:00",
	"products_set":[
		{
			"product_identifier":{
				"code": "Soft Drinks"
			},
			"quantity": 1,
			"total_amount": 10,
			"net_amount": 8,
			"vat_amount": 2
		},
		{
			"product_identifier":{
				"code":"Sandwiches"
			},
			"quantity": 10,
			"total_amount": 20,
			"net_amount": 26,
			"vat_amount": 4
		}
	],
	"fields_set": "total_additional_spend_amount,
		total_automatic_spend_amount,reduction_method,
		total_instant_spend_amount,
		total_award_amount"
}

Not Applicable

2

Once a customer is identified in CRM.COM, then the full information of the customer is returned

 

The following information can be displayed on the POS screen

  • The name of the customer (accounts_receivable.account_owner.name)
  • The available balance of the customer's wallet (wallet.balance)
Code Block
titleResponse
linenumberstrue
collapsetrue
{
	"data":{
		"total_additional_spend_amount": 7.9,
		"total_automatic_spend_amount": 0,
		"total_instant_spend_amount": 0,
		"total_award_amount": 0.08,
		"reduction_method": "FRONT_END_REDUCTION"
	},
	"status":{
		"message": null,
		"description": null,
		"code": "OK"
	}
}

After Preview


 

Step 3 - Submitting Sales Transaction for Awarding Customer

NoDescriptionWeb API ExamplePOS Conceptual Example
1

Once all products are registered in the POS, the sales transaction should be submitted in CRM.COM in the form of a purchase customer event. Creating such customer event, CRM.COM will validate whether the purchased items are eligible to be awarded by a reward offer and credit the customer's wallet balance

 

Submitting a purchase event in CRM.COM should be performed using the POST customer_events/purchases/create method, and capture the following information

  • The related customer (accounts_receivable_identifier)
  • The sales transaction's reference number (reference_number)
  • The sales transaction's date (performed_on)
  • The sales transaction's merchant (performed_by_unit_identifier)
  • The sales transaction's items and the amount per each item (products_set)
  • Whether the customer event should be processed immediately, depending various business processes or not (process_immediately) - in most cases processing is immediately
  • Optionally, the identifier of the POS can be specified (external_system)

 

Note

Products should already exist in CRM.COM in order for the POS to make transactions for them. In the event that a POS integration requires to perform transactions for such items, CRM.COM provides the ability to allow such transaction submission using a default product (everything is handled by CRM.COM without additional changes from the POS system)

Code Block
titlePOST Request
https://hostname/crmapi/rest/v2/customer_events/purchases/create
Code Block
titleBody
linenumberstrue
collapsetrue
{
	"token": "{{token}}",
	"accounts_receivable_identifier":{
		"number": "001"
	},


	"performed_by_unit_identifier":{
		"name":"Unit"
	},
	"performed_on":"2017-05-22T16:05:00",

	"process_immediately": true,
	"external_system": "POSID01",
	"reference_number":"REF00001",

	"products_set":[
		{
			"product_identifier":{
				"code": "Soft Drinks"
			},
			"quantity": 1,
			"total_amount": 10,
			"net_amount": 8,
			"vat_amount": 2
		},
		{
			"product_identifier":{
				"code": "Sandwiches"
			},
			"quantity": 4,
			"total_amount": 10,
			"net_amount": 8,
			"vat_amount": 2
		}
	],
	"fields_set":"number,total_awarded_amount,reference_number"
}
Not Applicable
2

Once the sales transaction submission is performed (purchase customer event creation), the POS system can proceed to the redemption step

 

The following information can be displayed on the POS screen

  • The amount that was awarded from the purchase (total_award_amount)
  • The amount that was automatically spend from the purchase (total_spend_amount)
  • The available balance of the customer's wallet after the purchase (initial wallet balance + total_award_amount - total_spend_amount)
Code Block
titleResponse
linenumberstrue
collapsetrue
{
	"data":{
		"number": "111",
		"total_awarded_amount": 20,
		"reference_number": "REF00001"
	},
	"status":{
		"message": null,
		"description": null,
		"code": "OK"
	}
}

After Customer is Awarded

Step 4 - Redeem

NoDescriptionWeb API ExamplePOS Conceptual Example
1

Customer may want to spend some of the available wallet amount on the previously created transaction, submitting a spend customer event in CRM.COM

 

The following information can be displayed on the POS spend request form

  • The amount that can be requested to be spent on that transaction (total_additional_spend_amount)
  • The minimum spend amount allowed to be spend per transaction (minimum_spend_amount_per_transaction)
  • The maximum spend amount allowed to be spend per transaction (maximum_spend_amount_per_transaction)

 

Submitting a spend request in CRM.COM should be performed using the POST customer_events/spend_requests/create method, and capture the following information

  • The related customer (accounts_receivable_identifier)
  • The related purchase customer event that was created above (purchase_customer_request_identifier)
  • The amount that is requested to be spend (spend_amount)
  • The sales transaction's date (performed_on)
  • The sales transaction's merchant (performed_by_unit_identifier)
  • Whether the customer event should be processed immediately, depending various business processes or not (process_immediately) - in most cases processing is immediately
  • Optionally, the identifier of the POS can be specified (external_system)
Code Block
titlePOST Request
https://hostname/crmapi/rest/v2/customer_events/spend_requests/create
Code Block
titleBody
linenumberstrue
collapsetrue
{
	"token": "{{token}}",
	"accounts_receivable_identifier":{
		"number": "001"
	},


	"performed_by_unit_identifier":{
		"name": "Unit"
	},
	"performed_on": "2017-05-12T11:41:00",


	"external_system": "POSID01",
	"process_immediately": true,


	"spend_amount": 10,
	"purchase_customer_request_identifier":{
		"number": "936"
	},

	"fields_set":"number,
		spend_amount,
		reduction_method,
		spend_reward_transaction"
}

Spend Request Form

2

Once the spend request is performed, it will return back the actual amount that was spent, which might be different than the amount that was requested to be spend

 

The following information will be used in the next step of reducing and closing the sales transactions

  • The actual amount that was spent (spend_reward_transaction.total_amount)
Code Block
titleResponse
linenumberstrue
collapsetrue
{
	"data":{
		"number": "294",
		"spend_amount": 10,
		"reduction_method": "FRONT_END_REDUCTION",
		"spend_reward_transaction":{
			"number": "205",
			"total_number": 7.9,
			"net_amount": 7.9,
			"vat_amount": 0,
			"life_cycle_state": "POSTED",
			...
		}
	},
	"status":{
		"message": null,
		"description": null,
		"code": "OK"
	}
}

After Spend Request

Step 5 - Closing the sales transaction

NoDescriptionWeb API ExamplePOS Conceptual Example
1

Once the sales transaction (purchase customer event) and spend transaction (spend request customer event) are submitted successfully , then the POS system can calculate the redemption amount, reduce it from the total amount of the sales transactions, and close the sales transaction with the customer's payment

 

The redemption amount is calculated as the sum of the following attributes

  • The actual amount that was spent (spend_reward_transaction.total_amount), as retrieved from the "spend_request/create" method, and
  • The amount that was spent automatically, which is the total_spend_amount as retrieved by the "purchases/create" method or from the sum of total_instant_spend_amount, total_additional_spend_amount and total_automatic_spend_amount as retrieved from the "purchases/preview" method

 

Note

The total_spend_amount is also the sum of total_instant_spend_amount, total_additional_spend_amount and total_automatic_spend_amount as retrieved by the "purchases/create"  (all these three values are retrieved from the same method as well)

 

The calculated redemption amount is deducted from the POS sales transaction by applying a discount on the sales transaction

 

Upon completion, the following information is displayed and printed on the customer's receipt

  • The amount that was awarded from the purchase (total_award_amount retrieved by the "purchases/preview" or "purchases/create")
  • The wallet balance after the purchase. The new balance is calculated as the wallet's initial balance + awarded amount - redemption amount

Not Applicable

Receipt

 

 

...

Product Synchronization Flow

The flow described below is an example of synchronizing products from a POS in CRM.COM. Product Synchronization can be achieved using existing CRM.COM Web API methods, where product information (as described previously) can be passed through a product set parameter

Note that there is a maximum number of products that can be synchronized per call, which is up to 1,000




 

 

Additional Documentation

Visit CRM.COM Manuals in order to find more information related to the areas / concepts mentioned in above scenarios

ModuleDescriptionManuals' Link
Rewards ParticipantManage the customers who have signed up for Rewards or have been automatically selected to participateManaging Rewards Participants
Rewards Participating Merchants

Rewards Participating Merchants are merchants that have a partnership with the business that owns the Rewards platform and can participate in the provided Reward Schemes
Reward Participating Merchants contribute to the amount awarded to Rewards Participants, based on rules which are agreed and defined between the Merchant and the business

The Reduction Method that will be used to process the sales it is defined through the Participating Merchant

Managing Rewards Participating Merchants
Rewards Offers

Reward Offers are used to

  • Define a financial amount to be awarded to Rewards Participants, based on their actions
  • Define the conditions for an Award to be given
  • Define the conditions that should be met for the awarded amount to be spent
Managing Rewards Offers
Purchase Customer EventsEvents linked with the purchase of goodsPurchase Customer Event
Spend Request Customer EventsEvents linked with the spending of Award points of Participantsawarded amountSpend Request Customer Event
Access TokensAccess Tokens are used to identify and authenticate customersManaging Access Tokens
ProductsProducts are goods that used by business transactions in the SystemManaging Products