Skip to end of banner
Go to start of banner

POST /purchases

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Available from CRM.COM R16.12.0

This method is used to create a purchase customer event in a posted life cycle state

Resource URL

Path Variables

N/A

Headers

NameTypeDescription
api_keyString

The api key for API calls to ensure that the client is trusted

  • Providing an API Key, the system should issue an auth token that should be kept until expiration
  • Such auth token should not be passed as part of any of the two APIs, but should be used in order to post such purchase customer event

Body

Name

Type

Description

id

(optional)

String

The customer event unique Identifier (GUID)

  • If not specified, one will be created by the system automatically

contact_id

(semi-optional)

String

The contact unique identifier (GUID) that the customer event is created for

  • Conditions: Either contact_id or cim must be specified
  • If a contact has multiple accounts, then the purchase customer event will be created against the primary one

cim

(semi-optional)

String

The value for a single contact identification medium representing the customer event is created for

  • Conditions: Either contact_id or cim must be specified
  • Customer Identification Medium will be mapped to the Access Token Authentication Code

reference_number

(mandatory)

StringThe external system’s (unique) reference number that submitted the customer event

classification

(optional)

Object
The classification of the customer event
The allowed identifier fields are the following

Name

Type

Description

id

(semi-optional)

String

The ID of the customer event classification

code

(semi-optional)

String

The code of  the customer event classification

currency_code

(optional)

String

The currency code that the customer event is created against

  • Mapped to previous intended_currency_identifier, but only the "code" attribute will be used for identification purposes

payment_medium_identifier

(optional)

String

The payment medium identifier with which the purchase customer event has been made (e.g. first credit card digits)

performed_on

(optional)

Integer

The date that the customer event was actually performed (in epoch format)

  • If not specified, then the current date-time will be set

merchant_tap

(semi-optional)

Object

The merchant that captured the purchase customer event

  • Conditions: At least merchant_tap or outlet_tap should be specified

The allowed identifier fields are the following

Name

Type

Description

id

(semi-optional)

String

The merchant identifier that captured the purchase customer event

  • Mapped to the business unit identifier

code

(semi-optional)

String

The merchant code that captured the purchase customer event

  • Mapped to the business unit code

outlet_tap

(semi-optional)

Object

The merchant's outlet that captured the purchase customer event

  • Conditions: At least merchant_tap or outlet_tap should be specified. The outlet (business unit) should have the specified merchant as parent business unit

The allowed identifier fields are the following

Name

Type

Description

id

(semi-optional)

String

The outlet identifier that captured the purchase customer event

  • Mapped to the business unit identifier

code

(semi-optional)

String

The outlet code that captured the purchase customer event

  • Mapped to the business unit code
productsArray of Objects

The purchased items of this customer event

Name

Type

Description

product_sku

(mandatory)

Products Identifier
The purchased product sku (code)

quantity

(optional)

Number

The quantity of the specified purchase customer event product (defaults to 1, if not specified)

net_amount

(mandatory)

NumberThe net amount of the specified purchase customer event product

tax_amount

(mandatory)

NumberThe Tax amount of the specified purchase customer event product

total_amount

(mandatory)

NumberThe total amount of the specified purchase customer event product
spend_requestObject

Information related with the spend request that should be created as part of the purchase customer event

Name

Type

Description

amount

(semi-optional)

Number
The amount in real currency that is requested to be spend

alternative_amount

(semi-optional)

Number

The amount in alternative currency that is requested to be spend

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

idStringThe purchase customer event identifier (GUID)

Examples

 Example 1

HTTP Method: POST


Request

Header

api_key: 8c54d563-b991-4b76-8a83-557c08166f95

Body

{
    "cim": "4A30966F684B0269AD91",
    "reference_number": "RF000001",
    "classification": {
        "code": "CCC"
    },
    "payment_medium_identifier": "42424242",
    "performed_on": 1572423477,
    "currency_code": "EUR",
    "products": [
        {
            "product_sku": "FREDESPR001",
            "net_amount": 14.15,
            "tax_amount": 1.04,
            "total_amount": 15.19,
            "quantity": 2
        }
    ],
    "spend_request": {
        "amount": 2.12
    },
    "merchant_tap": {
        "code": "EK123456"
    },
    "outlet_tap": {
        "code": "CD123456"
    }
}

Response

{
    "id": "PCE12345678909876544GUID"
}
  • No labels