5001: Register a transaction

5001: Register a transaction

Stores information about a transaction made by a person. A transaction may for instance be some kind of action, a purchase, redemption of a coupon or a transaction on a points account or cash account

 

Endpoint ID:

5001

Method:

POST

URL:

/entity/id/{entity-id}/transactions/{transaction-group-id}

/entity/ext-key/{ext-key}/{ext-type}/transactions/{transaction-group-id}

 

 

entity-id

Rubiq entity ID that uniquely identifies an account to register transaction for

 

ext-key

External key that uniquely identifies an account to register transaction for

 

ext-type

Type of external key

 

transaction-group-id

Numeric value identifying the transaction group in which to register the transaction. This ID is documented in the contract between dialogportal™ and the application

Request body:

JSON data with information about the transaction. Most of the values must be agreed upon in advance with Express, and will be documented in the contract between dialogportal™ and the application.

Required fields:



transactionTypeID:

Numeric value identifying the type of transaction. Possible types are documented in the contract between dialogportal™ and the application.



transactionDate:

Date of transaction. Expected format is a standard ISO UTC date – generated in javascript like this: Date().toJSON();

Optional fields:



value:

The numeric value of the transaction. If omitted, the value is set to 0.



reference:

An optional string to associate with the transaction identifying some sort of reference to a product or an offer.



text:

An optional string to describe the transaction.



extra:

An optional object with separate properties for each extra information. Available properties are documented in the contract between dialogportal™ and the application. Please note that these extra properties correspond to the type of transaction (transactionType) and some may be required.

Example 1 – Register a transaction of type 9 with a value of -5. Transaction type 9 is configured to require latitude and longitude as extra data:
{ "transactionTypeID": 9, "transactionDate": "2013-03-25T09:40:22.418Z", "value": -5, "reference": "SomeCouponID", "text": "Redeemed coupon with a value of 5", "extra": { "latitude": 55.692814, "longitude": 12.599205 } }
Example 2 – Register a transaction of type 22 with a value of 1. Transaction type 22 requires no extra data:
{ "transactionTypeID": 22, "transactionDate": "2013-03-25T09:40:22.418Z", "value": 1, "reference": "RegisterSomeVoucherID"

 

Response body:

JSON data with an ID for the newly registered transaction along with the posted information about the transaction.

Example 1 – Transaction specified in example 2 above was just created with success:
{ "transactionID": 12478636, "transactionGroupID": 12478636, "transactionGroupName": "SomeGroupName", "transactionTypeID": 22, "transactionTypeName": "SomeTypeName", "transactionDate": "2013-03-25T09:40:22.418Z", "value": 1, "reference": "RegisterSomeVoucherID" }

 

Status codes:

200

Transaction registered with success

 

400

Request is valid but validation of transaction data failed. This may be because the fields in the payload do not correspond to the contract between dialogportal™ and the application

 

404

Account, transaction group or transaction type were not found

The following sub codes may be returned:

404.1

User not found

404.2

External user could not be found

404.4

Transaction group not found

404.5

Transaction type not found