Transaction Events

Create a Transaction Event

POST

POST Transaction Events

/events/transaction endpoint allows you to operate on the Transaction Events entity.

Transaction events are created after the initial POST /transactions call (which creates a transaction) and are used to:

  • Update the STATE of the transaction, using the transactionState field and manage the Transaction Lifecycle
  • Update the transaction details, using the updatedTransactionAttributes field.

If you have neither of the above two use cases, you do not need to use transaction events.

Payload

Each transaction event needs three mandatory fields:

  • transactionState - STATE of the transaction -> value is set to CREATED after POST /transactions call
  • timestamp- the timestamp of when the event was created or occured in your system
  • transactionId - The ID of the transaction for which this event is generated.

In order to make individual events retrievable, you also need to pass in a unique eventId to the request body.

Request

This endpoint expects an object.
transactionState
enumRequired
Model for transaction states. E.g. Processing, Refunded, Successful etc.
timestamp
doubleRequired
Timestamp of the event
transactionId
stringRequired
Transaction ID the event pertains to
eventId
stringOptional
Unique event ID
reason
stringOptional
Reason for the event or a state change
eventDescription
stringOptional
Event description
updatedTransactionAttributes
objectOptional
Model for transaction additional payload
metaData
objectOptional
Model for device data

Response

This endpoint returns an object
eventId
string
transaction
object
executedRules
list of objects
Unique transaction identifier
hitRules
list of objects
Unique transaction identifier
riskScoreDetails
objectOptional

Errors

POST
1curl -X POST https://sandbox.api.flagright.com/events/transaction \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "transactionState": "SUCCESSFUL",
6 "timestamp": 1431231244001,
7 "transactionId": "443dea26147a406b957d9ee3a1247b11",
8 "eventId": "aaeeb166147a406b957dd9147a406b957",
9 "eventDescription": "Transaction created",
10 "metaData": {
11 "batteryLevel": 76.3,
12 "deviceLatitude": 13.009711,
13 "deviceLongitude": 76.102898,
14 "ipAddress": "79.144.2.20",
15 "vpnUsed": true
16 }
17}'
1{
2 "eventId": "7b80a539eea6e78acbd6d458e5971482",
3 "transaction": {
4 "type": "DEPOSIT",
5 "transactionId": "7b80a539eea6e78acbd6d458e5971482",
6 "timestamp": 1641654664000,
7 "originUserId": "8650a2611d0771cba03310f74bf6",
8 "destinationUserId": "9350a2611e0771cba03310f74bf6",
9 "transactionState": "CREATED",
10 "originAmountDetails": {
11 "transactionAmount": 800,
12 "transactionCurrency": "EUR",
13 "country": "DE"
14 },
15 "destinationAmountDetails": {
16 "transactionAmount": 68351.34,
17 "transactionCurrency": "INR",
18 "country": "IN"
19 },
20 "relatedTransactionIds": [
21 "relatedTransactionIds"
22 ],
23 "productType": "productType",
24 "promotionCodeUsed": true,
25 "reference": "loan repayment",
26 "originDeviceData": {
27 "batteryLevel": 95,
28 "deviceLatitude": 13.0033,
29 "deviceLongitude": 76.1004,
30 "ipAddress": "10.23.191.2",
31 "deviceIdentifier": "3c49f915d04485e34caba",
32 "vpnUsed": false,
33 "operatingSystem": "Android 11.2",
34 "deviceMaker": "ASUS",
35 "deviceModel": "Zenphone M2 Pro Max",
36 "deviceYear": "2018",
37 "appVersion": "1.1.0"
38 },
39 "destinationDeviceData": {
40 "batteryLevel": 95,
41 "deviceLatitude": 13.0033,
42 "deviceLongitude": 76.1004,
43 "ipAddress": "10.23.191.2",
44 "deviceIdentifier": "3c49f915d04485e34caba",
45 "vpnUsed": false,
46 "operatingSystem": "Android 11.2",
47 "deviceMaker": "ASUS",
48 "deviceModel": "Zenphone M2 Pro Max",
49 "deviceYear": "2018",
50 "appVersion": "1.1.0"
51 },
52 "tags": [
53 {
54 "key": "customKey",
55 "value": "customValue"
56 }
57 ]
58 },
59 "executedRules": [
60 {
61 "ruleInstanceId": "ruleInstanceId",
62 "ruleName": "Proof of funds for high value transactions",
63 "ruleDescription": "If a user makes a remittance transaction >= 1800 in EUR - ask for proof of funds",
64 "ruleAction": "BLOCK",
65 "ruleHit": true,
66 "ruleId": "R-1a",
67 "vars": [
68 {
69 "value": {}
70 }
71 ],
72 "labels": [
73 "UNEXPECTED_BEHAVIOR"
74 ],
75 "nature": "AML",
76 "isShadow": true
77 }
78 ],
79 "hitRules": [
80 {
81 "ruleInstanceId": "ruleInstanceId",
82 "ruleName": "Proof of funds for high value transactions",
83 "ruleDescription": "If a user makes a remittance transaction >= 1800 in EUR - ask for proof of funds",
84 "ruleAction": "BLOCK",
85 "ruleId": "R-1a",
86 "labels": [
87 "UNEXPECTED_BEHAVIOR"
88 ],
89 "nature": "AML",
90 "isShadow": true
91 }
92 ],
93 "riskScoreDetails": {
94 "trsScore": 1.1,
95 "trsRiskLevel": "VERY_HIGH"
96 }
97}