Skip to content

ExternalAccount Reference

Constructor

The externalAccounts array can contain multiple instances of the ExternalAccount class, where each ExternalAccount instance represents an account owned by the user in another bank. TheM.externalAccounts[0] refers to the first external account belonging to the user. If multiple external accounts exist, TheM.externalAccounts[0] could be replaced by TheM.externalAccounts[1], TheM.externalAccounts[2], etc. Alternatively, you could reference the external account based on the AFiExternalAccountId, replacing TheM.externalAccounts[0] with TheM.externalAccounts['PUT_AFiExternalAccountId_HERE'].

A new instance of the ExternalAccount class is initialized when a modelBank external accounts pushed or modelBank external account pushed event occurs. A new ExternalAccount instance can also be instantiated by calling TheM.externalAccounts.new(given) or TheM.externalAccounts.push(given), while passing the external account properties in the given object parameter. When TheM.externalAccounts.push(given) is called, the ExternalAccount instance, if new, will be automatically sent to the server as well.

TheM.externalAccounts.push(given)

Example

TheM.externalAccounts.push({
  type: 'DEBITCARD',
  pan: '4005519200000004',
  cvv: '123',
  expiryYYYYMM: '202610',
  name_on_card: 'SUZY QUEUE TESTER',
  expiryYY: '26',
  expiryMM: '10',
  comment: 'Adding new individual debit card',
  name: 'Individual debit card',
  title: 'Suzy Tester',
  cardImageFront: 'Very_Long_B64_Image_String',
  cardImageBack: 'Very_Long_B64_Image_String',
  networkName: 'Visa',
  dtsModified: new Date()
});

Properties

Property table for ExternalAccount

Property Description Required Schema
AFiExternalAccountId Gets (returns) the external account ID in ampliFi. No {
  "title":
"TheM.externalAccounts[0].AFiExternalAccountI
d",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) the external
account ID in ampliFi.",
  "$comment": "enumerable getter",
  "examples": [
    "qweealxsye6pizvuubieaoyoe"
  ]
}
type Gets (returns) or sets the external account type. Yes {
  "title": "TheM.externalAccounts[0].type",
  "type": "string",
  "nullable": false,
  "description": "Gets (returns) or sets the
external account type.",
  "$comment": "enumerable getter setter",
  "examples": [
    "CHECKING",
    "SAVINGS",
    "DEBITCARD",
    "CREDITCARD"
  ]
}
subtype Gets (returns) or sets the external account subtype, if any. No {
  "title": "TheM.externalAccounts[0].subtype",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the
external account subtype, if any.",
  "$comment": "enumerable getter setter",
  "examples": [
    "FLW"
  ]
}
name Gets (returns) or sets a name visible to the client, maximum of 25 characters. No {
  "title": "TheM.externalAccounts[0].name",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets a name
visible to the client, maximum of 25 characters.",
  "$comment": "enumerable getter setter",
  "examples": [
    "Individual debit card"
  ]
}
title Gets (returns) or sets the title of the external account owner No {
  "title": "TheM.externalAccounts[0].title",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the title of
the external account owner",
  "$comment": "enumerable getter setter",
  "examples": [
    "Suzy Tester"
  ]
}
comment Gets (returns) or sets a descriptive comment pertaining to the external account. No {
  "title": "TheM.externalAccounts[0].comment",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets a
descriptive comment pertaining to the external
account.",
  "$comment": "enumerable getter setter",
  "examples": [
    "Adding new individual debit card"
  ]
}
validationMessage Gets (returns) a validation message if the external account has invalid properties. No {
  "title":
"TheM.externalAccounts[0].validationMessage",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) a validation
message if the external account has invalid
properties.",
  "$comment": "getter",
  "examples": [
    "Please, select account type",
    "Account type is invalid",
    "The card number is invalid",
    "Date is invalid",
    "CVV is a 3-digit number at the back of the card",
    "Maximum 25 characters length",
    "Select the account type",
    "Enter the account number",
    "Enter the routing number"
  ]
}
toJSON Gets (returns) the ExternalAccount properties in a JSON formatted object. Yes {
  "title": "TheM.externalAccounts[0].toJSON",
  "type": "object",
  "description": "Gets (returns) the
ExternalAccount properties in a JSON formatted
object.",
  "$comment": "getter",
  "examples": [
    {
      "AFiExternalAccountId":
"qweealxsye6pizvuubieaoyoe",
      "comment": "Individual debit card",
      "dtsModified": "Fri Jun 28 2024 07:12:10 GMT-0400
(Eastern Daylight Time)",
      "isActive": true,
      "isSyncedToServer": true,
      "isVerified": true,
      "name": "Individual debit card",
      "name_on_card": "SUZY QUEUE TESTER",
      "panMasked": "4...0004",
      "type": "DEBITCARD"
    },
    {
      "AFiExternalAccountId":
"qweealxszpo0chsufhuxwwesv",
      "accountNumberMasked": "*****3456",
      "bankName": "Bank ABC",
      "comment": "Bank Account",
      "dtsModified": "Fri Jun 28 2024 07:12:10 GMT-0400
(Eastern Daylight Time)",
      "isActive": true,
      "isSyncedToServer": true,
      "isVerified": true,
      "name": "Bank Account",
      "routingNumber": "103112617",
      "title": "Suzy Tester",
      "type": "CHECKING"
    }
  ],
  "nullable": false
}
isSyncedToServer Gets (returns) or sets true if the external account has been synced to the server. No {
  "title":
"TheM.externalAccounts[0].isSyncedToServer",
  "type": "boolean",
  "default": false,
  "description": "Gets (returns) or sets true if the
external account has been synced to the server.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ]
}
isActive Gets (returns) or sets true if the external account is active and ready for transactions. Set this property value to false to disable the external account. No {
  "title": "TheM.externalAccounts[0].isActive",
  "type": "boolean",
  "nullable": true,
  "description": "Gets (returns) or sets true if the
external account is active and ready for
transactions. Set this property value to false to
disable the external account.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ]
}
isPending Gets (returns) or sets true if the external account is still pending. No {
  "title":
"TheM.externalAccounts[0].isPending",
  "type": "boolean",
  "nullable": true,
  "description": "Gets (returns) or sets true if the
external account is still pending.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ]
}
isValid Gets (returns) or sets true if all required properties are present and valid for this type of external account. If missing or invalid external account properties are found, an appropriate validationMessage is set as well. No {
  "title": "TheM.externalAccounts[0].isValid",
  "type": "boolean",
  "nullable": true,
  "description": "Gets (returns) or sets true if all
required properties are present and valid for this
type of external account. If missing or invalid
external account properties are found, an
appropriate validationMessage is set as well.",
  "$comment": "getter",
  "examples": [
    true,
    false
  ]
}
isVerified Gets (returns) true if the TheM.externalAccounts[0].doVerify method was called and the external account was successfully verified. No {
  "title":
"TheM.externalAccounts[0].isVerified",
  "type": "boolean",
  "nullable": true,
  "description": "Gets (returns) true if the
TheM.externalAccounts[0].doVerify method was
called and the external account was successfully
verified.",
  "$comment": "getter",
  "examples": [
    true,
    false
  ]
}
dtsCreated Gets (returns) the date that the external account record was created in ampliFi. No {
  "title":
"TheM.externalAccounts[0].dtsCreated",
  "type": "Date",
  "description": "Gets (returns) the date that the
external account record was created in ampliFi.",
  "$comment": "enumerable getter",
  "examples": [
    "Fri Jun 28 2024 07:12:10 GMT-0400 (Eastern
Daylight Time)"
  ]
}
dtsModified Gets (returns) the date that the external account record was last modified in ampliFi. Yes {
  "title":
"TheM.externalAccounts[0].dtsModified",
  "type": "Date",
  "nullable": false,
  "description": "Gets (returns) the date that the
external account record was last modified in
ampliFi.",
  "$comment": "enumerable getter",
  "examples": [
    "Fri Jun 28 2024 07:12:10 GMT-0400 (Eastern
Daylight Time)"
  ]
}
pan Gets (returns) or sets the 16 digit card PAN. Required for registering DEBITCARD or CREDITCARD type external accounts. No {
  "title": "TheM.externalAccounts[0].pan",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the 16 digit
card PAN. Required for registering DEBITCARD or
CREDITCARD type external accounts.",
  "$comment": "enumerable getter setter",
  "examples": [
    "1234567890123456"
  ]
}
panMasked Gets (returns) the masked card PAN. Present for for DEBITCARD or CREDITCARD type external accounts, only. No {
  "title":
"TheM.externalAccounts[0].panMasked",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) the masked card
PAN. Present for for DEBITCARD or CREDITCARD type
external accounts, only.",
  "$comment": "enumerable getter",
  "examples": [
    "1...3456"
  ]
}
cvv Gets (returns) or sets the 3 digit CVV/CVC card security code. Required for DEBITCARD or CREDITCARD type external accounts, only. No {
  "title": "TheM.externalAccounts[0].cvv",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the 3 digit
CVV/CVC card security code. Required for DEBITCARD
or CREDITCARD type external accounts, only.",
  "$comment": "enumerable getter setter",
  "examples": [
    "123"
  ]
}
expiryYY Gets (returns) or sets the card expiration year in YY format. Required for DEBITCARD or CREDITCARD type external accounts. No {
  "title": "TheM.externalAccounts[0].expiryYY",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the card
expiration year in YY format. Required for
DEBITCARD or CREDITCARD type external accounts.",
  "$comment": "enumerable getter setter",
  "examples": [
    "26"
  ]
}
expiryMM Gets (returns) or sets the card expiration month in MM format. Required for DEBITCARD or CREDITCARD type external accounts. No {
  "title": "TheM.externalAccounts[0].expiryMM",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the card
expiration month in MM format. Required for
DEBITCARD or CREDITCARD type external accounts.",
  "$comment": "enumerable getter setter",
  "examples": [
    "10"
  ]
}
name_on_card Gets (returns) the card holder name as it appears on the card. If not present for DEBITCARD or CREDITCARD type external accounts, the local user's first and last name will be used, separated by a space. No {
  "title":
"TheM.externalAccounts[0].name_on_card",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) the card holder
name as it appears on the card. If not present for
DEBITCARD or CREDITCARD type external accounts,
the local user's first and last name will be used,
separated by a space.",
  "examples": [
    "SUZY QUEUE TESTER"
  ]
}
cardImageFront Gets (returns) scanned raw image No {
  "title":
"TheM.externalAccounts[0].cardImageFront",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) scanned raw
image",
  "examples": [
    "Very_Long_B64_Image_String"
  ]
}
cardImageBack Gets (returns) scanned raw image No {
  "title":
"TheM.externalAccounts[0].cardImageBack",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) scanned raw
image",
  "examples": [
    "Very_Long_B64_Image_String"
  ]
}
image Gets (returns) an image to be used as an icon, sent by the server. If none is available, will return cardImageFront, if it exists. No {
  "title": "TheM.externalAccounts[0].image",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) an image to be used
as an icon, sent by the server. If none is available,
will return cardImageFront, if it exists.",
  "$comment": "getter",
  "examples": [
    "Very_Long_B64_Image_String"
  ]
}
networkName Gets (returns) the network name (payment system). No {
  "title":
"TheM.externalAccounts[0].networkName",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) the network name
(payment system).",
  "$comment": "enumerable getter",
  "examples": [
    "Amex",
    "Visa",
    "Visa Electron",
    "Mastercard",
    "Maestro",
    "Diners Club",
    "Discover",
    "China UnionPay"
  ]
}
accountNumber Gets (returns) or sets the account number. Required for CHECKING or SAVINGS type external accounts. No {
  "title":
"TheM.externalAccounts[0].accountNumber",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the account
number. Required for CHECKING or SAVINGS type
external accounts.",
  "$comment": "enumerable getter setter",
  "examples": [
    "1234567890123456"
  ]
}
accountNumberMasked Gets (returns) the masked account number (for bank accounts) or masked PAN (for cards). No {
  "title":
"TheM.externalAccounts[0].accountNumberMasked
",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) the masked account
number (for bank accounts) or masked PAN (for
cards).",
  "$comment": "enumerable getter",
  "examples": [
    "...3456"
  ]
}
routingNumber Gets (returns) or sets the routing number. Required for CHECKING or SAVINGS type external accounts. No {
  "title":
"TheM.externalAccounts[0].routingNumber",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the routing
number. Required for CHECKING or SAVINGS type
external accounts.",
  "$comment": "enumerable getter setter",
  "examples": [
    "123456789"
  ]
}
bankName Gets (returns) or sets the name of the external account bank, for CHECKING or SAVINGS type external accounts only. If type is not CHECKING or SAVINGS, will return 'Debit card' or 'Credit card' instead of a bank name, depending on the external account type. No {
  "title": "TheM.externalAccounts[0].bankName",
  "type": "string",
  "nullable": true,
  "description": "Gets (returns) or sets the name of
the external account bank, for CHECKING or SAVINGS
type external accounts only. If type is not CHECKING
or SAVINGS, will return 'Debit card' or 'Credit
card' instead of a bank name, depending on the
external account type.",
  "$comment": "enumerable getter setter",
  "examples": [
    "Bank ABC"
  ]
}
logoB64 Bank logo in base 64 string format No {
  "title": "TheM.externalAccounts[0].logoB64",
  "type": "string",
  "nullable": true,
  "description": "Bank logo in base 64 string
format",
  "$comment": "enumerable getter",
  "examples": []
}

Methods

Method Name Parameter Descriptions Description Example
isPullValid
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"amount": {
"title": "amount",
"type": "number",
"nullable": false,
"example": 20.01
},
"currency": {
"title": "currency",
"type": "string",
"nullable": false,
"example": "USD"
}
},
"example": {
"amount": 20.01,
"currency": "USD"
}
}
]
Checks the given pull amount and currency for the specified external account and returns a boolean indicating whether the pull data is valid. The specified external account must first be verified (otherwise this method will automatically return false). TheM.externalAccounts[0].isPullValid(
  {
   "amount": 20.01,
   "currency": "USD"
  }
);
doPull
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"AFiAccountId": {
"title": "AFiAccountId",
"type": "string",
"nullable": true,
"example":
"testgalx8wfq4sqfgb",
"$comment": "The account ID in
ampliFi in which to deposit the
pull amount. If no AFiAccountId is
specified, the amount will be
deposited into the user's main or
first account."
},
"amount": {
"title": "amount",
"type": "number",
"nullable": false,
"example": 20.01,
"$comment": "Can configure a
minTopup and/or maxTopup amount
using
TheM.fdrs.externalAccountsConf
ig."
},
"currency": {
"title": "currency",
"type": "string",
"nullable": false,
"example": "USD"
},
"narrative": {
"title": "narrative",
"type": "string",
"nullable": true,
"example": "Pull"
},
"comment": {
"title": "comment",
"type": "string",
"nullable": true,
"example": "Pull money from
external account to ampliFi
account"
}
},
"example": {
"AFiAccountId":
"testgalx8wfq4sqfgb",
"amount": 20.01,
"currency": "USD",
"narrative": "Pull",
"comment": "Pull money from
external account to ampliFi
account"
}
}
]
This method pulls a specified amount of money from the external account. The external account must be previously verified. The amount is deposited in an account specified by AFiAccountId or in the user's main account. It may be subject to a pre-specified maximum and minimum which can be configured using TheM.fdrs.externalAccountsConfig.minTopup and TheM.fdrs.externalAccountsConfig.maxTopup. If successful a 'modelBank external account pull success' event occurs. TheM.externalAccounts[0].doPull(
  {
   "AFiAccountId": "testgalx8wfq4sqfgb",
   "amount": 20.01,
   "currency": "USD",
   "narrative": "Pull",
   "comment": "Pull money from external account to ampliFi account"
  }
);
isPushValid
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"amount": {
"title": "amount",
"type": "number",
"nullable": false,
"example": 10
},
"currency": {
"title": "currency",
"type": "string",
"nullable": false,
"example": "USD"
}
},
"example": {
"amount": 10,
"currency": "USD"
}
}
]
Checks the given push amount and currency for the specified external account and returns a boolean indicating whether the push data is valid. The specified external account must first be verified (otherwise this method will automatically return false). TheM.externalAccounts[0].isPushValid(
  {
   "amount": 10,
   "currency": "USD"
  }
);
doPush
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"AFiAccountId": {
"title": "AFiAccountId",
"type": "string",
"nullable": true,
"example":
"testgalx8wfq4sqfgb",
"$comment": "The account ID in
ampliFi from which to withdraw the
push amount. If no AFiAccountId is
specified, the amount will be
withdrawn from the user's main or
first account."
},
"amount": {
"title": "amount",
"type": "number",
"nullable": false,
"example": 10
},
"currency": {
"title": "currency",
"type": "string",
"nullable": false,
"example": "USD"
},
"narrative": {
"title": "narrative",
"type": "string",
"nullable": true,
"example": "Push"
},
"comment": {
"title": "comment",
"type": "string",
"nullable": true,
"example": "Push money to
external account from ampliFi
account"
}
},
"example": {
"AFiAccountId":
"testgalx8wfq4sqfgb",
"amount": 10,
"currency": "USD",
"narrative": "Push",
"comment": "Push money to
external account from ampliFi
account"
}
}
]
This method pushes a specified amount of money to the external account. The external account must be previously verified. The amount is withdrawn from an account specified by AFiAccountId or from the user's main account. If successful a 'modelBank external account push success' event occurs. TheM.externalAccounts[0].doPush(
  {
   "AFiAccountId": "testgalx8wfq4sqfgb",
   "amount": 10,
   "currency": "USD",
   "narrative": "Push",
   "comment": "Push money to external account from ampliFi account"
  }
);
doVerify
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"amount1": {
"title": "amount1",
"type": "number",
"nullable": false,
"example": 1.01
},
"amount2": {
"title": "amount2",
"type": "number",
"nullable": false,
"example": 1.01
}
},
"example": {
"amount1": 1.01,
"amount2": 1.01
}
}
]
This method will verify the account if possible. If succesful, a 'modelBank external account was verified' event will occur. TheM.externalAccounts[0].doVerify(
  {
   "amount1": 1.01,
   "amount2": 1.01
  }
);
isValidField
[
{
"title": "fieldName",
"type": "string",
"nullable": false,
"example": "accountNumber"
},
{
"title": "value",
"type": "string",
"nullable": false,
"example": "1234567890123456"
}
]
Checks to make sure the given value is valid for the given fieldName. Possible fieldNames to check are 'pan', 'date', 'cvv', 'name', 'bankName', 'type', 'accountNumber', and 'routingNumber'. Returns true if valid. TheM.externalAccounts[0].isValidField("accountNumber","1234567890123456");