Constructor
new Starling(optionsopt)
Create an instance of the starling client
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
options | 
            
            Object | 
                
                    <optional> | 
            
            
            configuration parameters  | 
        
- Source:
 
Methods
createContact(accessToken, name, accountTypeopt, accountNumber, sortCode, customerId) → {Promise}
Creates a contact (payee) for the customer
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.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
deleteMandate(accessToken, mandateId) → {Promise}
Deletes specific direct debit mandate
Parameters:
| Name | Type | Description | 
|---|---|---|
accessToken | 
            
            string | the oauth bearer token.  | 
        
mandateId | 
            
            string | the unique mandate ID  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getAccessToken(authorizationCode) → {Promise}
Exchanges the authorization code for an access token
Parameters:
| Name | Type | Description | 
|---|---|---|
authorizationCode | 
            
            string | the authorization code, acquired from the user agent after the user authenticates with starling  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getAccount(accessTokenopt) → {Promise}
Gets the customer's account details
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
accessToken | 
            
            string | 
                
                    <optional> | 
            
            
            the oauth bearer token. If not specified, the accessToken on the options object is used.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getAddresses(accessTokenopt) → {Promise}
Gets the customer's addresses (current and previous)
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
accessToken | 
            
            string | 
                
                    <optional> | 
            
            
            the oauth bearer token. If not specified, the accessToken on the options object is used.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getBalance(accessTokenopt) → {Promise}
Gets the customer's balance
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
accessToken | 
            
            string | 
                
                    <optional> | 
            
            
            the oauth bearer token. If not specified, the accessToken on the options object is used.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getCard(accessTokenopt) → {Promise}
Gets the customer's card
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
accessToken | 
            
            string | 
                
                    <optional> | 
            
            
            the oauth bearer token. If not specified, the accessToken on the options object is used.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getContactAccount(accessToken, contactId) → {Promise}
Gets a specific contact (payee)
Parameters:
| Name | Type | Description | 
|---|---|---|
accessToken | 
            
            string | the oauth bearer token.  | 
        
contactId | 
            
            string | the contact's ID.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getContacts(accessToken) → {Promise}
Gets the customer's contacts (payees)
Parameters:
| Name | Type | Description | 
|---|---|---|
accessToken | 
            
            string | the oauth bearer token.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getCustomer(accessTokenopt) → {Promise}
Gets the customer's details
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
accessToken | 
            
            string | 
                
                    <optional> | 
            
            
            the oauth bearer token. If not specified, the accessToken on the options object is used.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getTransaction(accessTokenopt, transactionId, sourceopt) → {Promise}
Gets the full details of a single transaction
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.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
getTransactions(accessTokenopt, fromDate, toDate, sourceopt) → {Promise}
Gets the customer's transaction history
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.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
listMandates(accessTokenopt) → {Promise}
Gets the customer's current direct-debit mandates
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
accessToken | 
            
            string | 
                
                    <optional> | 
            
            
            the oauth bearer token. If not specified, the accessToken on the options object is used.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
listScheduledPayments(accessToken) → {Promise}
Lists the customer's scheduled payments
Parameters:
| Name | Type | Description | 
|---|---|---|
accessToken | 
            
            string | the oauth bearer token.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
makeLocalPayment(accessToken, destinationAccountId, reference, amount, currencyopt) → {Promise}
Makes a payment on behalf of the customer to another UK bank account using the Faster Payments network
Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
accessToken | 
            
            string | the oauth bearer token.  | 
        ||
destinationAccountId | 
            
            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".  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise
 
refreshAccessToken(refreshToken) → {Promise}
Exchanges the authorization code for an access token
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.  | 
        
- Source:
 
Returns:
- the http request promise
 
- Type
 - Promise