Skip to content

Transaction Reference

Constructor

The transactions array can contain multiple instances of the Transaction class. TheM.accounts[0].transactions[0] refers to the first locally available transaction for the first account belonging to the user. If multiple transactions for the given account exist, TheM.accounts[0].transactions[0] could be replaced by TheM.accounts[0].transactions.[1], TheM.accounts[0].transactions.[2], etc. Alternatively, you could call the desired transaction based on the transactionId. The following examples will all call the same transaction:

  • TheM.accounts[0].transactions[0]
  • TheM.accounts[0].transactions['PUT_transactionId_HERE']
  • TheM.accounts.account('PUT_AFiAccountId_HERE').transactions[0]
  • TheM.accounts.account('PUT_AFiAccountId_HERE').transactions['PUT_transactionId_HERE']

A new instance of the Transaction class is initialized when a modelBank transactions event occurs.

//A `modelBank transactions` event occurs when a transaction is successful. Below are some examples of when this may occur.

const newTransactionEAPull = TheM.externalAccount.doPull({
    //properties required by the /externalaccount/pull endpoint in order to pull funds from an external account
  });
const newTransactionEAPush = TheM.externalAccount.doPush({
    //properties required by the /externalaccount/push endpoint in order to push funds to an external account.
  });
const newTransactionAcc2Acc = TheM.fundsTransfer.doAcc2Acc({
    //properties required by the /transfer/acc2acc endpoint in order to transfer funds from one account to another.
  });

Example

const newTransactionEAPull = TheM.externalAccount.doPull({
    //calls the /externalaccount/pull ampliFi endpoint, passing the given properties as the request body.
    AFiExternalAccountId: 'PUT_AFiExternalAccountId_HERE',
    AFiAccountId: 'PUT_AFiAccountId_HERE',
    amount: 20,
    currency: 'USD',
    narrative: 'Do top-up',
    comment: 'Transfering funds from an external account',
  });
const newTransactionEAPush = TheM.externalAccount.doPush({
    //calls the /externalaccount/push ampliFi endpoint, passing the given properties as the request body.
    AFiExternalAccountId: 'PUT_AFiExternalAccountId_HERE',
    AFiAccountId: 'PUT_AFiAccountId_HERE',
    amount: 10,
    currency: 'USD',
    narrative: 'Do withdrawal',
    comment: 'Transfering funds to an external account',
  });
const newTransactionAcc2Acc = TheM.fundsTransfer.doAcc2Acc({
    //calls the /transfer/acc2acc ampliFi endpoint, passing the given properties as the request body.
    amount: 10,
    currency: 'USD',
    narrative: 'Do account to account transfer',
    sourceAccount: 'PUT_SOURCE_AFiAccountId_HERE',
    destinationAccount: 'PUT_DESTINATION_AFiAccountId_HERE',
    comment: 'Transfering funds from one account to another',
  });

Properties

Property table for Transaction

Property Description Required Schema
AFiAccountId Gets (returns) the account ID in ampliFi. Yes {
  "title":
"TheM.accounts[0].transactions[0].AFiAccountI
d",
  "type": "string",
  "description": "Gets (returns) the account ID in
ampliFi.",
  "examples": [
    "testgalx8wfq4sqfgb"
  ],
  "nullable": false
}
AFiUserId Gets (returns) the user ID in ampliFi. Yes {
  "title":
"TheM.accounts[0].transactions[0].AFiUserId",
  "type": "string",
  "description": "Gets (returns) the user ID in
ampliFi.",
  "examples": [
    "testaurlx8wfimcrw"
  ],
  "nullable": false
}
reference Gets (returns) the reference ID for this transaction. Yes {
  "title":
"TheM.accounts[0].transactions[0].reference",
  "type": "string",
  "description": "Gets (returns) the reference ID
for this transaction.",
  "examples": [
    "testrr8wgyjgssximb"
  ],
  "nullable": false
}
transactionId Gets (returns) the transaction ID for this transaction in ampliFi. Yes {
  "title":
"TheM.accounts[0].transactions[0].transaction
Id",
  "type": "string",
  "description": "Gets (returns) the transaction ID
for this transaction in ampliFi.",
  "examples": [
    "dcuosrklcjxpyzxagroxbbrspacuhiecwfzltzke"
  ],
  "nullable": false
}
transactionIdBO Gets (returns) the transaction ID for this transaction in the back-office. Yes {
  "title":
"TheM.accounts[0].transactions[0].transaction
IdBO",
  "type": "string",
  "description": "Gets (returns) the transaction ID
for this transaction in the back-office.",
  "examples": [
    "F2167329415"
  ],
  "nullable": false
}
transactionState Gets (returns) the current status of the transaction. No {
  "title":
"TheM.accounts[0].transactions[0].transaction
State",
  "type": "string",
  "description": "Gets (returns) the current status
of the transaction.",
  "examples": [
    "complete",
    "pending",
    "declined",
    "reversed",
    "authorization"
  ],
  "default": ""
}
txnType Gets (returns) the type of this transaction Yes {
  "title":
"TheM.accounts[0].transactions[0].txnType",
  "type": "string",
  "description": "Gets (returns) the type of this
transaction",
  "examples": [
    "credit",
    "debit"
  ],
  "nullable": false
}
typeName Gets (returns) a string description of the transaction type, if applicable. No {
  "title":
"TheM.accounts[0].transactions[0].typeName",
  "type": "string",
  "description": "Gets (returns) a string
description of the transaction type, if
applicable.",
  "examples": [
    "ACH Credit",
    "ACH Debit",
    "Card push",
    "Card pull",
    "credit",
    "debit"
  ],
  "nullable": true
}
arn Gets (returns) the transaction acquirer reference number, if it exists. No {
  "title":
"TheM.accounts[0].transactions[0].arn",
  "type": "string",
  "description": "Gets (returns) the transaction
acquirer reference number, if it exists.",
  "examples": [
    "0000000000000006LBor"
  ],
  "nullable": true
}
amount Gets (returns) the amount of the transaction. Yes {
  "title":
"TheM.accounts[0].transactions[0].amount",
  "type": "number",
  "description": "Gets (returns) the amount of the
transaction.",
  "examples": [
    10
  ],
  "nullable": false,
  "default": 0
}
credit Gets (returns) the credit amount of the transaction. If this transaction is a credit, then this property will match amount. Returns 0 if this transaction is a debit. No {
  "title":
"TheM.accounts[0].transactions[0].credit",
  "type": "number",
  "description": "Gets (returns) the credit amount
of the transaction. If this transaction is a credit,
then this property will match amount. Returns 0 if
this transaction is a debit.",
  "examples": [
    10
  ],
  "default": 0
}
debit Gets (returns) the debit amount of the transaction. If this transaction is a debit, then this property will match amount. Returns 0 if this transaction is a credit. No {
  "title":
"TheM.accounts[0].transactions[0].debit",
  "type": "number",
  "description": "Gets (returns) the debit amount of
the transaction. If this transaction is a debit,
then this property will match amount. Returns 0 if
this transaction is a credit.",
  "examples": [
    10
  ],
  "default": 0
}
newBalance Gets (returns) the balance after the transaction, if applicable. No {
  "title":
"TheM.accounts[0].transactions[0].newBalance"
,
  "type": "number",
  "description": "Gets (returns) the balance after
the transaction, if applicable.",
  "examples": [
    10
  ],
  "nullable": true
}
fee Gets (returns) the transaction fee, if applicable. No {
  "title":
"TheM.accounts[0].transactions[0].fee",
  "type": "number",
  "description": "Gets (returns) the transaction
fee, if applicable.",
  "examples": [
    0
  ],
  "default": 0
}
currency Gets (returns) the 3 character currency code. No {
  "title":
"TheM.accounts[0].transactions[0].currency",
  "type": "string",
  "description": "Gets (returns) the 3 character
currency code.",
  "examples": [
    "USD",
    "EUR",
    "KZT",
    "JPY",
    "GBP"
  ],
  "default": "USD"
}
attachments Gets (returns) an attachments object, if any. The attachments object consists of key: value pairs and may vary by transaction. No {
  "title":
"TheM.accounts[0].transactions[0].attachments
",
  "type": "object",
  "description": "Gets (returns) an attachments
object, if any. The attachments object consists of
key: value pairs and may vary by transaction.",
  "examples": [
    {}
  ],
  "nullable": true
}
attachmentsArray Gets (returns) an array of attachments objects, if any. No {
  "title":
"TheM.accounts[0].transactions[0].attachments
Array",
  "type": "array",
  "description": "Gets (returns) an array of
attachments objects, if any.",
  "examples": [
    []
  ],
  "nullable": true
}
comment Gets (returns) or sets a comment regarding the transaction. No {
  "title":
"TheM.accounts[0].transactions[0].comment",
  "type": "string",
  "description": "Gets (returns) or sets a comment
regarding the transaction.",
  "examples": [
    "Bill payment"
  ],
  "nullable": true
}
narrative Gets (returns) the narrative description for this transaction. No {
  "title":
"TheM.accounts[0].transactions[0].narrative",
  "type": "string",
  "description": "Gets (returns) the narrative
description for this transaction.",
  "examples": [
    "🎁 Welcome bonus"
  ],
  "default": ""
}
stateId Gets (returns) the state ID corresponding to the transactionState, if applicable. 400 = 'pending', 200 = 'pending', 100 = 'reconciled' or 'complete', 0 = 'complete', -1 = 'declined', -2 = 'reversed' No {
  "title":
"TheM.accounts[0].transactions[0].stateId",
  "type": "string or number",
  "description": "Gets (returns) the state ID
corresponding to the transactionState, if
applicable. 400 = 'pending', 200 = 'pending', 100 =
'reconciled' or 'complete', 0 = 'complete', -1 =
'declined', -2 = 'reversed'",
  "examples": [
    400,
    200,
    100,
    0,
    -1,
    -2,
    "authorization",
    "completed",
    "reversed"
  ],
  "nullable": true
}
internal Gets (returns) an object containing internal properties, if applicable. The properties present are dependent upon the type of transaction. No {
  "title":
"TheM.accounts[0].transactions[0].internal",
  "type": "object",
  "description": "Gets (returns) an object
containing internal properties, if applicable.
The properties present are dependent upon the type
of transaction.",
  "examples": [
    {
      "reversalTransactionId": "",
      "approvalCode": ""
    },
    {
      "AFiBeneficiaryId": "",
      "beneficiaryMaskedNum": "",
      "beneficiaryBankName": "",
      "transactionReceiptId": ""
    },
    {
      "AFiBeneficiaryId": "",
      "beneficiaryAccountNumber": "",
      "beneficiaryRoutingNumber": "",
      "beneficiaryAccountType": "",
      "beneficiaryTitle": "",
      "beneficiaryBankName": "",
      "transactionReceiptId": ""
    },
    {
      "AFiExternalAccountId": "",
      "externalAccountNumber": "",
      "externalAccountRouting": "",
      "externalAccountType": "",
      "externalAccountTitle": "",
      "externalAccountBank": ""
    },
    {
      "legalName": "",
      "address": {}
    },
    {
      "cFiCardId": ""
    },
    {
      "accountNumber": "",
      "routingNumber": "",
      "destinationName": "",
      "bankName": ""
    }
  ],
  "nullable": true
}
dtsBooked Gets (returns) the date this transaction was created. No {
  "title":
"TheM.accounts[0].transactions[0].dtsBooked",
  "type": "Date",
  "description": "Gets (returns) the date this
transaction was created.",
  "examples": [
    "Mon Jun 10 2024 07:37:55 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": true
}
dtsValue Gets (returns) the date time stamp of the transaction. Yes {
  "title":
"TheM.accounts[0].transactions[0].dtsValue",
  "type": "Date",
  "description": "Gets (returns) the date time stamp
of the transaction.",
  "examples": [
    "Mon Jun 10 2024 07:37:55 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": false
}
dtsAtMerchant Gets (returns) the local date time stamp of the merchant when the transaction was recorded. Yes {
  "title":
"TheM.accounts[0].transactions[0].dtsAtMercha
nt",
  "type": "Date",
  "description": "Gets (returns) the local date time
stamp of the merchant when the transaction was
recorded.",
  "examples": [
    "Mon Jun 10 2024 07:37:55 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": false
}
dtsRecorded Gets (returns) the date that this transaction was recorded. Yes {
  "title":
"TheM.accounts[0].transactions[0].dtsRecorded
",
  "type": "Date",
  "description": "Gets (returns) the date that this
transaction was recorded.",
  "examples": [
    "Mon Jun 10 2024 07:38:51 GMT-0400 (Eastern
Daylight Time)"
  ],
  "nullable": false
}
toJSON Gets (returns) the transaction properties in a JSON formatted object. Yes {
  "title":
"TheM.accounts[0].transactions[0].toJSON",
  "type": "object",
  "description": "Gets (returns) the transaction
properties in a JSON formatted object.",
  "examples": [
    {
      "AFiAccountId": "testgalx8wfq4sqfgb",
      "AFiUserId": "testaurlx8wfimcrw",
      "amount": 10,
      "arn": "0000000000000006LBor",
      "attachments": {},
      "credit": 10,
      "currency": "USD",
      "debit": 0,
      "dtsAtMerchant": "Mon Jun 10 2024 07:37:55
GMT-0400 (Eastern Daylight Time)",
      "dtsBooked": "Mon Jun 10 2024 07:37:55 GMT-0400
(Eastern Daylight Time)",
      "dtsRecorded": "Mon Jun 10 2024 07:38:51 GMT-0400
(Eastern Daylight Time)",
      "dtsValue": "Mon Jun 10 2024 07:37:55 GMT-0400
(Eastern Daylight Time)",
      "fee": 0,
      "internal": {},
      "is3DSecure": false,
      "isComplete": true,
      "isDigitalWalletTrans": false,
      "isPaymentTrans": true,
      "isRecurring": false,
      "narrative": "🎁 Welcome bonus",
      "newBalance": null,
      "reference": "testrr8wgyjgssximb",
      "transactionId":
"dcuosrklcjxpyzxagroxbbrspacuhiecwfzltzke",
      "transactionIdBO": "F2167329415",
      "transactionState": "complete",
      "txnType": "credit",
      "typeName": ""
    }
  ],
  "nullable": false
}
is3DSecure Gets (returns) true if the transaction used 3DSecure security protocol. No {
  "title":
"TheM.accounts[0].transactions[0].is3DSecure"
,
  "type": "boolean",
  "description": "Gets (returns) true if the
transaction used 3DSecure security protocol.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isComplete Gets (returns) true if the transaction is completed. No {
  "title":
"TheM.accounts[0].transactions[0].isComplete"
,
  "type": "boolean",
  "description": "Gets (returns) true if the
transaction is completed.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isDigitalWalletTrans Gets (returns) true if the transaction is a digital wallet transfer. No {
  "title":
"TheM.accounts[0].transactions[0].isDigitalWa
lletTrans",
  "type": "boolean",
  "description": "Gets (returns) true if the
transaction is a digital wallet transfer.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isPaymentTrans Gets (returns) true if the transaction is a payment. No {
  "title":
"TheM.accounts[0].transactions[0].isPaymentTr
ans",
  "type": "boolean",
  "description": "Gets (returns) true if the
transaction is a payment.",
  "examples": [
    true,
    false
  ],
  "default": false
}
isRecurring Gets (returns) true if the transaction is recurring. No {
  "title":
"TheM.accounts[0].transactions[0].isRecurring
",
  "type": "boolean",
  "description": "Gets (returns) true if the
transaction is recurring.",
  "examples": [
    true,
    false
  ],
  "default": false
}