POST customer_events/purchases/preview

Available from CRM.COM R10.0.0

This method is used to preview the amount that will be awarded, the amount that will be spend instantly and the additional amount that can be spent on a purchase customer event, prior to submitting a purchase customer event.

Resource URL

Parameters

Name

Type

Description

token

String

The token retrieved from the login method

accounts_receivable_identifier

(mandatory)

Accounts receivable Identifier

The related accounts receivable. The allowed accounts receivable identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the accounts receivable

number

(semi-optional)

String

The number of the accounts receivable

name

(semi-optional)

String

The name of the accounts receivable

access_token_identifier

(semi-optional)

Access Token Identifier

The identifier of the access token which is related with the accounts receivable. Only effective access tokens can be used to identify an accounts receivable. The allowed access token identifier fields are the following

Name

Type

Description

authentication_code

(semi-optional)

String

The authentication code of the access token

identifier

(semi-optional)

StringThe identifier of the access token. If the identifier is specified then it will be validated against the specified pass code

pass_code

(mandatory on conditions)

StringThe pass code of the access token, which is applicable and mandatory if the identifier is specified

one_time_password

(semi-optional)

Integer

The one-time password (OTP) of the access token

Available from CRM.COM R13.0.0

Available from CRM.COM R8.0.0

Deprecated from CRM.COM R18.0.0

For releases prior CRM.COM R17.0.0, this field was semi-optional

From CRM.COM R17.0.0, the access token attributes are supported

rewards_participant_identifier

(semi-optional)

Rewards Participant Identifier
The related rewards participant. The allowed rewards participant identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the rewards participant

number

(semi-optional)

String

The number of the rewards participant

access_token_identifier

(semi-optional)

Access Token Identifier

The identifier of the access token which is related with the rewards participant. Only effective access tokens can be used to identify a rewards participant. The allowed access token identifier fields are the following:

Name

Type

Description

authentication_code

(semi-optional)

String

The authentication code of the access token

identifier

(semi-optional)

StringThe identifier of the access token. If the identifier is specified then it will be validated against the specified pass code

pass_code

(mandatory on conditions)

StringThe pass code of the access token, which is applicable and mandatory if the identifier is specified

one_time_password

(semi-optional)

Integer

The one-time password (OTP) of the access token

Available from CRM.COM R13.0.0

Deprecated from CRM.COM R17.0.0

classification_identifier

(optional)

Customer Event Classification Identifier
The classification of the customer event. The allowed customer event classification identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the customer event classification

name

(semi-optional)

String

The name of the customer event classification

alternative_code

(semi-optional)

String

The alternative code of  the customer event classification

performed_by_unit_identifier

(mandatory)

Unit Identifier
The unit that initiated the customer event. The allowed unit identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the Unit

name

(semi-optional)

String

The name of the Unit

alternative_code

(semi-optional)

String

The alternative code of  the Unit

Deprecated from CRM.COM R18.0.0

performed_by_business_unit_identifier

(mandatory)

Business Unit Identifier

The business unit that initiated the customer event. The allowed business unit identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the business unit

name

(semi-optional)

String

The code of the business unit

code

(semi-optional)

String

The code of the business unit

Available from CRM.COM R18.0.0

performed_on

(mandatory)

DateThe date that the customer event was actually performed

description

(optional)

StringA description of the customer event

reference_number

(mandatory)

StringThe reference number of the retrieved purchase customer event

external_system_reference_number

(optional)

StringThe reference number that uniquely identifies the purchase customer event in the external system

payment_medium_brand_identifier

(optional)

Payment Medium Brand Identifier

The identifier of the payment medium brand with which the purchase customer event has been made. The allowed payment medium brand identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the payment medium brand

name

(semi-optional)

String

The name of the payment medium brand

alternative_code

(semi-optional)

String

The alternative code of  the payment medium brand


payment_medium_type_identifier

(optional)

Payment Medium Type Identifier

The payment medium type with which the purchase customer event has been made. The allowed payment medium type identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the payment medium type

name

(semi-optional)

String

The name of the payment medium type

alternative_code

(semi-optional)

String

The alternative code of  the payment medium type


payment_medium_identifier

(optional)

String

The payment medium identifier with which the purchase customer event has been made


spend_request_classification_identifier

(optional)

Customer Event Classification Identifier
The classification of the spend request that will possibly be created to spend any amount that will be awarded for this purchase customer event. The allowed customer event classification identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the customer event classification

name

(semi-optional)

String

The name of the customer event classification

alternative_code

(semi-optional)

String

The alternative code of  the customer event classification

Note that this information is required only to calculate the minimum and maximum spend amount per spend request customer event

disable_instant_spend

(optional)

Boolean

It determines if instant spend offers should be disabled (i.e. not applied) or not. By default all instant spend offers are applied if their conditions are met.

Available from CRM.COM R14.4.0

products_set

(mandatory)

Set of  Purchase Product ObjectsThe purchased products, along with the total amount, net amount and VAT amount for each product

fields_set

(optional)

List of Strings, comma separated


A list of fields that should be included in the results. If not specified then all the available fields will be returned


Referred Parameter Objects

 purchase customer event product parameter object data

Name

Type

Description

product_identifier

(mandatory)

Products IdentifierThe purchased product. The allowed product identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the product

code

(semi-optional)

String

The code of the product

alternative_code

(semi-optional)

String

The alternative code of  the product

quantity

(optional)

Number

The quantity of the specified purchase customer event product. If not specified then it automatically defaults to 1

Available from CRM.COM R10.0.0


net_amount

(mandatory)

NumberThe net amount of the specified purchase customer event product

vat_amount

(mandatory)

NumberThe VAT amount of the specified purchase customer event product

total_amount

(mandatory)

NumberThe total amount of the specified purchase customer event product

Restrictions

  • It is mandatory to specify one of the semi-optional parameters. Only one of those parameters is allowed to be specified.

Response Data

Name

Type

Description

total_award_amountNumberThe total amount that will be awarded for that purchase customer event in system currency
total_award_alternative_amountNumber

The total amount that will be awarded for that purchase customer event in alternative currency and only if the awarded amount will be in alternative currency

Available from CRM.COM R14.2.0

total_instant_spend_amountNumberThe total amount that will be spend instantly on that purchase customer event
total_automatic_spend_amountNumber

The total amount that will be spend automatically on that purchase customer event, if the automatic awards spending is allowed. This amount does not include the amount that will be instantly spent on a voucher

Available from CRM.COM R13.0.0

total_additional_spend_amountNumberThe additional amount that is available and can be spend on that purchase customer event. This amount does not include the amount that will be instantly spent on a voucher
minimum_spend_amount_per_transactionNumberThe minimum amount that can be spend per each spend request customer event
maximum_spend_amount_per_transactionNumberThe maximum amount that can be spend per each spend request customer event
reduction_methodString

It defines how the amount that will be spend instantly or automatically will be reduced. The allowed methods are the following:

  • FRONT_END_REDUCTION: If selected then the reduction will be done by the front-end system (for example the POS). This is the default option
  • BACK_END_REDUCTION: If selected then the reduction will be done by a back-end system (for example Paypal). If this option is selected then it is mandatory to specify the back-end reduction settings

Available from CRM.COM R13.0.0


rewards_participant_id

String

The ID of the purchase customer event's rewards participant

Available from CRM.COM R12.2.0 and CRM.COM R13.1.0 onward

rewards_participant_nameString

The full name of the retrieved rewards participant

Available from CRM.COM R12.2.0 and CRM.COM R13.1.0 onward

wallet_balanceNumber

The current wallet balance of the customer in wallet currency

Available from CRM.COM R12.2.0 and CRM.COM R13.1.0 onward

wallet_alternative_balanceNumber

The current wallet balance of the customer in wallet alternative

Available from CRM.COM R14.2.0

allow_spendingBoolean

It determines if spending is allowed to be done on the specific purchase customer event

Available from CRM.COM R14.4.0

voucher_types_setSet of Voucher Types Objects

The set of type of the voucher that will be awarded instantly if such a purchase customer event is performed

Available from CRM.COM R14.2.0

applied_reward_offers_setSet of Applied Reward Offers

A set of reward offers that will be applied on the specific purchase customer event

Available from CRM.COM R14.4.0

 

Referred Objects Response Data

 voucher_type response data object
NameType Description
IdStringThe ID of the retrieved voucher type
nameStringThe Name of the retrieved voucher type
alternative_codeStringThe Alternative Code of the retrieved voucher type
value_optionsString

Defines if the value should be fixed, as defined in the voucher type, or a variable, as defined during the creation of the vouchers. The supported options are FIXED and VARIABLE

From CRM.COM R13.1.0 and onwards for voucher types of classification equal to "Electronic Voucher" the supported option is VARIABLE

From CRM.COM R14.0.0 and onwards for voucher types of classification equal to "Refund Voucher" the supported option is VARIABLE

classificationString

The Classification of the retrieved voucher type

Available from CRM.COM R13.1.0

descriptionStringThe Description of the retrieved voucher type

 applied reward offers short response data object
NameType Description
IdStringThe ID of the applied reward offer
nameStringThe name of the applied reward offer
scheme_nameStringThe reward scheme name of the applied reward offer


Examples

 Example 1

HTTP Method: POST


Request:

Body:

 {
   "token": "618012859",
  "accounts_receivable_identifier":{"number":"ACR0000000265"},
   "classification_identifier":{"name":"Purchase Classification"},
   "performed_by_unit_identifier":{"name":"Admin Unit"},
   "performed_on":"2016-06-22T15:00:00",
   "reference_number":"RF000001",
   "total_amount":900,
   "net_amount":800,
   "vat_amount":100,
   "invoice_identifier":{"number":"I00000733"},
   "payment_medium_brand_identifier":{"name":"VISA"},
   "payment_medium_type_identifier":{"alternative_code":"CC"},
   "payment_medium_identifier":"PI000001",
   "products_set":
   [
     {
       "product_identifier":{"code":"Serendipity"},
       "total_amount":400,
       "net_amount":350,
       "vat_amount":50
     },
     {
       "product_identifier":{"code":"Bronze"},
       "total_amount":500,
       "net_amount":450,
       "vat_amount":50
     }
   ]
 }


Response:

 {
  "data": {
    "total_additional_spend_amount": 673.7,
    "minimum_spend_amount_per_transaction": 10,
    "total_instant_spend_amount": 0,
    "total_award_amount": 43.2,
    "maximum_spend_amount_per_transaction": 3444
  },
  "status": {
    "code": "OK",
    "description": "",
    "message": ""
  }
}
 Example 2

HTTP Method: POST


Request:

Body:

{
"token":"{{token}}",
"accounts_receivable_identifier":{"name":"0000000001 Eleni M"},
"performed_by_unit_identifier":{"name":"Merchant A unit"},
"performed_on":"2018-09-07T13:09:00",
"description":"purchase event",
"process_immediately":true,
"reference_number":"PCE1API32",
"disable_instant_spend":true,
"total_amount":3,
"net_amount":3,
"vat_amount":0,
  "products_set":
   [
     {
       "product_identifier":{"code":"Serendipity"},
      "total_amount":3,
		"net_amount":3,
		"vat_amount":0,
       "quantity":1
     }
   ]
}


Response:

 {
    "data": {
        "total_additional_spend_amount": 0,
        "allow_spending": false,
        "applied_reward_offers_set": [
            {
                "scheme_name": "Sales Scheme",
                "name": "Test",
                "id": "27268409D98F4D408BA056632B9316E9"
            }
        ],
        "minimum_spend_amount_per_transaction": 1,
        "rewards_participant_id": "57A9AC82559149019061B743F13CD39B",
        "total_automatic_spend_amount": 0,
        "wallet_balance": 3256.81,
        "total_instant_spend_amount": 0,
        "rewards_participant_name": "Eleni Mich",
        "total_award_amount": 0.15,
        "reduction_method": null,
        "maximum_spend_amount_per_transaction": 1000000
    },
    "status": {
        "code": "OK",
        "description": "",
        "message": ""
    }
}