Redeeming an Access Token for CAF

The account information access permissions you specify in your access token request are reflected in the access token generated. Consequently, if you don't ask for access to the FUNDS_CONFIRMATIONS resource type in your access token request, it won't be granted in the access token.

Keeping this in mind, the server-side call forAccessToken() is used to get the object — called a RepresentableClosedInterface representing the part of a Token member's account information that can be accessed based on the permissions granted in an access token.representing your customer-user. You can then make a confirmFunds() call on the Representable object— cbpiiMember — pursuant to the FUNDS_CONFIRMATIONS permission granted in the access token.

The confirmFunds() call generates the Boolean value (true/false) concerning availability of sufficient funds in the user-specified bank account. No other values or conditions are returned.

Here's the form for a funds confirmation access token redemption:

private static boolean confirmFunds(String tokenId) {

    // use access token's permissions from now on, set true if customer initiated request

    String accountId = cbpiiMember.getTokenBlocking(tokenId)

        .getPayload()

        .getAccess()

        .getResources(0)

        .getFundsConfirmation()

        .getAccountId();

    Representable representable = cbpiiMember.forAccessToken(tokenId, false);

    return representable.confirmFundsBlocking(accountId, AMOUNT, CURRENCY);

}

The account number is found in the redemption payload as token.payload.access.resources[0].funds_confirmation.account_id. This will be different than the account you provided in the original token request.

Tip for PISPs: Payment Service Providers are advised to create a standard TransferTokenRequest using the setConfirmFunds() function to indicate that CAFClosedConfirmation of Available Funds – A CBPII begins the Confirmation of Funds journey by registering a request to confirm funds of a PSU. The CBPII must then obtain consent from the PSU in order to authorise the request, enabling it to request the information. Once the request is authorised, the CBPII will be able to invoke Confirmation of Funds API to the confirm availability of funds in the PSU account. should be performed prior to transfer token redemption. However, not all banks support CAF as part of a transfer request. In these cases, setConfirmFunds() is ignored when included in the transfer token request.