Standing Orders

To access standing orders information, additional ReadStandingOrdersBasic or ReadStandingOrdersDetail Open Banking permissions must be requested when creating a new connection or re-authenticating an existing connection. User consent must be given and the connection synced before standing orders will be accessible. Standing orders can be retrieved with basic details or with extra detail information including account details.

🚧

Prerequisites

  • An API Client with standing_orders:read or standing_orders_detail:read scope enabled - if you haven't got this scope enabled, ask us and we can enable it for you
  • An account with a banking provider that supports standing orders (you can use the Moneyhub Open Banking Mock if you don't have an existing real account for a banking provider with this enabled

Synchronising Standing Orders

When you wish to synchronise standing orders when connecting to a bank, you will need to make a slight change when making the auth request URL. You will need to add some additional claims, and they are in this format:

πŸ“˜

On-going access to Standing Orders

Standing orders can only be accessed within the first 10 minutes of consent. On-going access to standing orders is not possible through Open Banking AIS connections

{ 
	"id_token": {
		"mh:consent": {
			"essential": true,
			"value": {
				"permissions": ["ReadStandingOrdersDetail"]
			}
		}
	}
}

If you are using the @mft/moneyhub-api-client NodeJS library we have provided, you can just add the object object to the claims key in the following call:

const data = await moneyhub.getAuthorizeUrlForCreatedUser({
  userId,
  state,
  bankId,
  nonce,
  claims,
})

On code exchange, standing orders should have been synced from the connecting bank connection.

Fetching Standing Orders

When fetching the standing orders from the API, you will need to request an access token with either of the following scopes:

  • standing_orders:read
  • standing_orders_detail:read

The only difference between the detail and non-detail is scope is that the detail scope will return the standing order account details (account number and sort code)

The scopes are scoped to a user.

We expose the following endpoint through our API:

GET /accounts/{accountId}/standing-orders

This will retrieve all standing orders for an account.

Walkthrough Using NodeJS Library Example

🚧

Prerequisites

  • @mft/moneyhub-api-client version 6.1.0

First ensure the example config is set to an API client you own. You'll first need to register a user if you haven't got one already:

node examples/user/register-user.js

Take note of the returned user ID, this will be used for later calls.

Next you'll need to make a call to get an authorisation URL for this user to make a banking connection. The API client has a script that allows to make this request for a URL to include the above ReadStandingOrdersDetail permission in the request. The call to make is shown below:

node examples/auth/get-authorization-url-for-user.js -u <your-user-id> -b <bank-id>

The bank-id in the script call above is one you will find in the list from the following link: https://identity.moneyhub.co.uk/oidc/.well-known/api-connections.

πŸ“˜

Standing Orders support

Please note that not every bank supports standing orders at this time

Navigate to the returned URL and complete the consent for the connection. On successful consent of the banking connection, exchange the authorisation code for access tokens using the following script:

node examples/token/exchange-code-for-token.js -c <code>

Once that is complete, you can fetch the standing orders using the following script

node examples/accounts/get-account-standing-orders-with-detail.js -u <user-id>

Using the Moneyhub API Client in your app

You can make use of the Moneyhub API Client to simplify the process of making a new connection with the ReadStandingOrdersBasic or ReadStandingOrdersDetail permissions.

You can then use the following methods to retrieve the standing orders for an account

getAccountStandingOrders

getAccountStandingOrdersWithDetail