Insights Data
Assess a consumer’s financial health in real-time.
Use the Trustly Insights APIs to access your users' aggregated financial information, including their account balances, deposits, withdrawals, and related information.
Use the information provided here to learn how to get a user's bank authorization and using Account Data features, which allow you to retrieve aggregated financial information for users’ accounts.
To use the Trustly Insights APIs, you complete the following tasks:
- Integrate the Trustly UI to create a Bank Authorization
- Call the Get account activity summary API to retrieve the user's aggregated financial information.
Create an authorized transaction
Retrieving account data begins with acquiring a bank authorization from a user. This requires integrating the Trustly UI library into your user-facing application client.
- In your website or mobile application, add the Trustly UI SDK to render the Select Bank Widget or launch the Lightbox. See the Trustly SDKs.
- Define the data to be passed to Trustly and set the
paymentTypeproperty to the string"Retrieval"to create the correct transaction type.
When the Trustly Lightbox opens, the user selects their bank from the list, authenticates, and selects their account. After a successful authorization, the Lightbox redirects the user to the returnUrl provided in the Establish Data object.
- Create a Redirect URL to where your application server collects the details of the new Trustly transaction, including the
transactionIdand other important properties to associate with the user who created the authorized transaction.
Retrieve account summary data
Data Ready Event NotificationCalling any of the Account Data APIs for a new authorization transaction prior to receiving the
DataReadyevent can result in partial data being returned.To ensure optimal performance, wait to receive the
DataReadyevent prior to making a request to an calling an Account Data API.The
DataReadyevent is not sent when a customer enters their account and routing number manually.
The Account Summary API allows you to retrieve aggregated financial information (Balances, Deposits, Withdrawals, Overdrafts, non-sufficient funds (NSFs), and NSF fees for a user’s account(s) for periods of 7, 30, and 90 days. You can use this data to inspect spending hygiene, account balance history, NSF risk, and other parameters to simplify the credit application process and make better-informed credit decisions.
To retrieve the specific banking information selected for a given transaction, execute a GET request to the Account Summary endpoint. You must include the Bank Account Authorization transaction ID as a path parameter: /transactions/{transactionId}. For example:
GET https://sandbox.trustly.one/api/v1/transactions/{transactionId}/accountSummary
Example response
The Get Account Summary API returns a JSON response with three top-level properties:
customerId(string): Trustly identifier for the customer record.lastUpdated(integer): Epoch timestamp for when the account summary was last aggregated.summary(array): List of accounts and relevant summary data associated with the customer.
{
"customerId": "780001",
"lastUpdated": 1633471332000,
"summary": [
{
"selectedAccount": true,
"currency": "USD",
"nameOnAccount": "John Doe",
"accountNumber": "67675545",
"routingNumber": "557787",
"aggregations": [
{
"days": 7,
"activityEarliestDate": 1631750403554,
"activityLatestDate": 1632268808707,
"balanceMax": "10320.32",
"balanceMin": "9700.10",
"balanceAvg": "9860.13",
"depositCount": 2,
"depositAmountTotal": "620.22",
"depositAmountMax": "500.00",
"withdrawalCount": 1,
"withdrawalAmountTotal": "299.90",
"withdrawalAmountMax": "299.90",
"overdraftCount": 0,
"overdraftAmountTotal": "0.00",
"nsfCount": 0,
"nsfFeeAmountTotal": "0.00"
},
{
"days": 30,
...
},
{
"days": 90,
...
}
]
}
]
}See the Account Summary API for more information about these parameters. To retrieve the raw account activity data, use the Get Account Activity API.
Updated 12 days ago