Constructor
new Starling(optionsopt)
Create an instance of the starling client
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object
|
<optional> |
configuration parameters |
Methods
addMoneyToSavingsGoal(accessToken, savingsGoalId, transactionId, amount) → {Promise}
Add money to a specific savings goal
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
string
|
the oauth bearer token. |
savingsGoalId |
string
|
the savings goal's ID. |
transactionId |
string
|
a transaction ID for this transaction |
amount |
number
|
an amount in minor unit |
Returns:
- Type:
-
Promise
- the http request promise
createContact(accessToken, name, accountTypeopt, accountNumber, sortCode, customerId) → {Promise}
Creates a contact (payee) for the customer
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
accessToken |
string
|
the oauth bearer token. |
||
name |
string
|
the name of the new contact. |
||
accountType |
string
|
<optional> |
UK_ACCOUNT_AND_SORT_CODE |
the account type (domestic or international), optional and defaults to UK_ACCOUNT_AND_SORT_CODE. |
accountNumber |
string
|
the contact's bank account number. |
||
sortCode |
string
|
the contact's sort code. |
||
customerId |
string
|
the customer's ID. |
Returns:
- Type:
-
Promise
- the http request promise
createSavingsGoal(accessToken, savingsGoalId, name, currency, targetAmount, targetCurrency, base64EncodedPhoto) → {Promise}
Creates a contact (payee) for the customer
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
accessToken |
string
|
the oauth bearer token. |
|
savingsGoalId |
string
|
the savings goal's ID, generate one if creating a goal. |
|
name |
string
|
the name of the new contact. |
|
currency |
string
|
GBP |
the currency of the savings goal. Defaults to 'GBP'. |
targetAmount |
number
|
the target amount in minor units (e.g. 1234 => £12.34). |
|
targetCurrency |
string
|
GBP |
the target currency, also defaults to 'GBP'. |
base64EncodedPhoto |
string
|
base64 encoded image to associate with the goal. (optional) |
Returns:
- Type:
-
Promise
- the http request promise
deleteMandate(accessToken, mandateId) → {Promise}
Deletes specific direct debit mandate
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
string
|
the oauth bearer token. |
mandateId |
string
|
the unique mandate ID |
Returns:
- Type:
-
Promise
- the http request promise
deleteSavingsGoal(accessToken, savingsGoalId) → {Promise}
Deletes specific direct debit mandate
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
string
|
the oauth bearer token. |
savingsGoalId |
string
|
the unique mandate ID |
Returns:
- Type:
-
Promise
- the http request promise
getAccessToken(authorizationCode) → {Promise}
Exchanges the authorization code for an access token
- Source:
Parameters:
Name | Type | Description |
---|---|---|
authorizationCode |
string
|
the authorization code, acquired from the user agent after the user authenticates with starling |
Returns:
- Type:
-
Promise
- the http request promise
getAccount(accessTokenopt) → {Promise}
Gets the customer's account details
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
Returns:
- Type:
-
Promise
- the http request promise
getAddresses(accessTokenopt) → {Promise}
Gets the customer's addresses (current and previous)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
Returns:
- Type:
-
Promise
- the http request promise
getBalance(accessTokenopt) → {Promise}
Gets the customer's balance
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
Returns:
- Type:
-
Promise
- the http request promise
getCard(accessTokenopt) → {Promise}
Gets the customer's card
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
Returns:
- Type:
-
Promise
- the http request promise
getContactAccount(accessToken, contactId) → {Promise}
Gets a specific contact (payee)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
string
|
the oauth bearer token. |
contactId |
string
|
the contact's ID. |
Returns:
- Type:
-
Promise
- the http request promise
getContacts(accessToken) → {Promise}
Gets the customer's contacts (payees)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
string
|
the oauth bearer token. |
Returns:
- Type:
-
Promise
- the http request promise
getCustomer(accessTokenopt) → {Promise}
Gets the customer's details
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
Returns:
- Type:
-
Promise
- the http request promise
getMe(accessTokenopt) → {Promise}
Gets the customer UUID and permissions corresponding to the access token passed
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
Returns:
- Type:
-
Promise
- the http request promise
getSavingsGoal(accessToken, savingsGoalId) → {Promise}
Gets a specific savings goal
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
string
|
the oauth bearer token. |
savingsGoalId |
string
|
the savings goal's ID. |
Returns:
- Type:
-
Promise
- the http request promise
getTransaction(accessTokenopt, transactionId, sourceopt) → {Promise}
Gets the full details of a single transaction
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
transactionId |
string
|
the unique transaction ID |
|
source |
string
|
<optional> |
the transaction type (e.g. faster payments, mastercard). If not specified, only generic transaction information will be returned. |
Returns:
- Type:
-
Promise
- the http request promise
getTransactions(accessTokenopt, fromDate, toDate, sourceopt) → {Promise}
Gets the customer's transaction history
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
fromDate |
string
|
filter transactions after this date. Format: YYYY-MM-DD (optional, defaults to most recent 100 transactions) |
|
toDate |
string
|
filter transactions before this date. Format: YYYY-MM-DD (optional, defaults to current date if not provided) |
|
source |
string
|
<optional> |
the transaction type (e.g. faster payments, mastercard). If not specified, results are not filtered by source. |
Returns:
- Type:
-
Promise
- the http request promise
listMandates(accessTokenopt) → {Promise}
Gets the customer's current direct-debit mandates
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string
|
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
Returns:
- Type:
-
Promise
- the http request promise
listSavingsGoals(accessToken) → {Promise}
Gets a list of the customer's savings goals
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
string
|
the oauth bearer token. |
Returns:
- Type:
-
Promise
- the http request promise
listScheduledPayments(accessToken) → {Promise}
Lists the customer's scheduled payments
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
string
|
the oauth bearer token. |
Returns:
- Type:
-
Promise
- the http request promise
makeLocalPayment(accessToken, destinationAccountUid, reference, amount, currencyopt) → {Promise}
Makes a payment on behalf of the customer to another UK bank account using the Faster Payments network
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
accessToken |
string
|
the oauth bearer token. |
||
destinationAccountUid |
string
|
the account identifier of the recipient |
||
reference |
string
|
The payment reference, max. 18 characters. |
||
amount |
string
|
the amount to be send. |
||
currency |
string
|
<optional> |
GBP |
the currency, optional, defaults to "GBP". |
Returns:
- Type:
-
Promise
- the http request promise
refreshAccessToken(refreshToken) → {Promise}
Exchanges the authorization code for an access token
- Source:
Parameters:
Name | Type | Description |
---|---|---|
refreshToken |
string
|
the oauth refresh token, used to claim a new access token when the access token expires. A new refresh token is also returned. |
Returns:
- Type:
-
Promise
- the http request promise