Building and Storing the CAF Request
requests are created with the selected-language variant of the fundsConfirmationRequestBuilder() method. Once the token request is created, you store it, awaiting a corresponding request-id, which is returned by Token.io in a response payload. In addition to the request-id, the response payload reflects all the information you included in your original request. Equipped with the request-id, you can redeem the token, thereby receiving the requested confirmation of available funds.
Note: The bank will not prompt the user to select a specific account (regardless of whether the user has one or multiple accounts with the bank). The bank will create an access consent only for the account provided in the token request, so you must capture the specified user account before populating the token request.
Even though it's really quite simple and incredibly secure, accuracy remains paramount vis-à-vis making the right calls with the right information at the right time.
So, let's examine the key field definitions for an access token request call.
Tip: Classes, methods and parameters are initially presented in their default Java syntax. Select the corresponding tab — Java, JavaScript or C# in the navigation bar of the first code example in the sequence — to display the correct syntax and field names for the SDK language chosen.
Here's the basic structure of the request.
// Entry point
private static final
Member cbpiiMember
= initializeMember
(tokenClient
);
. . .
// Create a token request to be stored
TokenRequest tokenRequest
= TokenRequest
.fundsConfirmationRequestBuilder
(
"iron"
, // set the bankId
BankAccount
.newBuilder()
.setDomestic
(Domestic.newBuilder()
.setAccountNumber
("12345678"
)
.setBankCode
("123456"
)
.setCountry
("US"
))
.build
())
.setToMemberId
(cbpiiMember.memberId
())
.setToAlias
(cbpiiMember.firstAliasBlocking
())
.setRefId
(refId
)
.setRedirectUrl
(redirectUrl
)
.setCsrfToken
(csrfToken
) // validates the session ID
// use keys in bank authorization metadata from getBanks() response
.putAllAuthorizationMetadata
(new
HashMap<>()
)
.build
();
// Store the request
String request-id
= cbpiiMember.storeTokenRequestBlocking
(tokenRequest
);
The key fields comprising a CAF access token request are defined in the following table.
Field | Description | Required/ Optional |
---|---|---|
accountId | Account number being queried; set using the AccountIdentifier object, which allows four types of account identifiers:
Although setting source with the BankAccount object has been deprecated, it is still supported |
Required |
authorizationMetadata | Needed to capture additional information from the user for initial authorization by the bank, thereby allowing the user to proceed with providing consent for the initiation request. Maps the key-value pairs from the getBanks() response, where key is the name of the field and value is the value of the field. | Required |
bankId | Must be specified for CAF requests; indicates you wish to bypass the Token.io bank selection UI and use your own bank selection UI for the request. See Using the getbanks Method | Required |
callBackState | TPP-specified string that persists state between request and callback | Optional, but recommended |
description |
Description of the payment with the following qualifiers:
This description field maps to description in the bank's consentRequest presented to the user. Warning: If description in a subsequent token request for lookups/changes/updates (retrieve, redeem, or cancel) doesn't match the description in the originating token request, an exception will be thrown. |
Optional |
grantee | The "To" TPP member placing the access request, which will receive the information upon successful token redemption | Required |
grantor | User Alias (DOMAIN orEMAIL) of the user member granting access to the specified bank account. To review the methods for finding an alias see Fetching an Alias. | Required |
receiptRequested | Boolean; requests a receipt be sent to the grantor member's default email address | Optional |
redirectUrl | Specifies the callback URL where your server will initiate token redemption | Required |
refId |
Reference identifier for the token; not to be confused with requestId. RefId maps to tppRefId in the bank's consentRequest. It is needed to match/verify the originating token request with the bank's consent request. Warning: A description mismatch between the originating token request and subsequent token lookups/changes/updates (retrieve, redeem, or cancel) will throw an exception. |
Required |
resourceType | Specifies the type of information for which access permission is requested; in this case, FUNDS_CONFIRMATIONS – confirmation of available funds in the specified account | Required |
token_expiration | Sets the expiration date and time for the token request (default is 20 minutes); override of default value is not supported by all banks | Optional |
traceID | TPP-provided unique value captured by Token.io and sent across to the bank to be stored with the request throughout its lifecycle as an audit-trail aid. | Optional |
After storing the transfer token request, you're ready to construct the redirect URL for authorization so the customer can authenticate, provide consent, and authorize account information access for funds confirmation as previously outlined in the CAF communication workflow.
Caution: A is disallowed in the token request payload within the refId and description fields. In accordance with the security standard, is used for pattern matching of numeric strings that intentionally or inadvertently reveal or resemble a PAN in the refId or description of a token request. Potential PAN patterns found will throw an exception.
Tip: When integrating the Token.io SDK with a mobile app, you can initiate the token request in so that the redirect is also in the form of an . However, in terms of activity layout, WebView lacks many features found in a fully developed web browser.
Nevertheless, WebView provides increased control over the UI and advanced configuration options that allow you to embed web pages in a specially-designed environment for your app, but you will forfeit an array of features supported by Chrome, Firefox, and other browsers.