This page explains how to integrate the capital components into your platform's user interface (UI).
Requirements
Requirement | Description |
---|---|
Integration type | You must have an Adyen for Platforms platform integration. |
API credentials | You must have an API credential for a web service user to access the Session authentication API. Ensure that you have asked your Adyen contact to assign the following role to your API credential:
|
Capabilities | Make sure that your account holders have the following capability:
|
Limitations | With the capital components, you can only pay out the business financing funds to the user's balance account. Payouts to transfer instruments are not supported in this implementation. |
Setup steps | Before you begin:
|
Component instance methods and parameters
By default, the Capital Offer component is embedded in the Capital Overview component, creating a standard user flow. This flow consists of a series of interactive screens that users engage with, all rendered within a single component element on the same UI page.
You can modify this standard user flow to create a more tailored and relevant experience for your users. For example, you may want to show a message about their eligibility for a grant on one page while directing users to complete the remaining steps on another page in your UI. To do this, you can use additional methods and parameters that enable you to register and unregister events, making it easier to manage multiple instances of components. There are various approaches you can take for each of the components.
When integrating the Capital Overview component, you can:
- Change how the component is rendered according to its state. For example, if the state is isUnqualified, then the component is not rendered.
- Interrupt the standard user flow at certain points to redirect a user to a different page in your interface to continue their flow.
When integrating the Capital Offer component, you can:
- Render it as standalone component and place it on a separate page in your UI.
- Configure the component to only show a specific screen.
You can specify the necessary methods and parameters when initializing components. Refer to the use case examples for more details.
How it works
Follow these steps to integrate the capital components:
- Create an authentication session from your server
- Install the component library on your front end
- Initialize the components
- Customize the components
Step 1: Create an authentication session from your server
To ensure secure communication between components and Adyen server, you must configure your server for authentication and create a session token. To create the token:
-
From your server, make a POST /sessions request specifying the following parameters:
To make this API request, your API key must have the Capital Component: Manage role in your Customer Area. Read more in Requirements.
Parameter Required Description allowOrigin
The URL where the component will appear. Must follow the format: https://www.yourcompany.com
, whereyourcompany.com
is the actual web address of your platform. Can also include a subdomain.On live, only the HTTPS protocol is supported.product
The type of component. Set this to platform. policy
An object that contains: resources
: An object that contains:accountHolderId
: The unique identifier of the account holder that is linked to the balance account shown in the component.type
: The type of resource. Set this to accountHolder.
roles
: The role required to use the component. Set this to Capital Component: Manage.
Here is an example request for creating a session token.
-
Note the API response. Later, when initializing the components, you need to create and call a function that passes the entire session object from the response to your front end.
Step 2: Install the component library on your front end
Use the Adyen Platform Experience library in your front-end application as follows:
-
Install the node package.
npm install @adyen/adyen-platform-experience-web
-
Import the node package, the components, and the style sheet.
import { AdyenPlatformExperience, CapitalOverview, CapitalOffer } from '@adyen/adyen-platform-experience-web'; import "@adyen/adyen-platform-experience-web/adyen-platform-experience-web.css";
Step 3: Initialize the components
To initialize the components:
-
Gather the following information to be passed when initializing the library and its components.
-
Gather these parameters to initialize the library.
Parameter Required Descriptionenvironment
The environment for the component integration.The default value is test. Set the parameter to live when you are ready to go live. locale
The language of the component. See the list of the supported languages.For example, use en-US for English. onSessionCreate
The callback function that retrieves an authentication session token and refreshes the current session. -
Gather these parameters to initialize each component.
Select the tab for the component you want to use:
-
(Optional) Define the following component instance method.
Method Description getState
Retrieves the state of the component, which is an object containing a state
field.
The possible values of this field are:- isUnqualified: The user is not yet qualified for a grant.
- isPreQualified: The user is pre-qualified for a grant.
- hasRequestedGrants: The user has previously received and repaid grants.
Read more
-
-
Create a DOM element on your UI page where you want the component to be rendered.
Assign the element a unique and descriptive ID. This unique ID is important to avoid any misconfigurations when integrating multiple components into your UI.
By default, the Capital Offer component is embedded in the Capital Overview component. In this scenario, you only need to create a DOM element for the Capital Overview component. If you want to render the Capital Offer component outside the Capital Overview component, you need to create a separate DOM element for it.
If you are using JavaScript frameworks such as Vue or React, make sure that you use references instead of selectors and that you do not re-render the DOM element.
Select the tab for the component you want to use:
-
Add a function that calls your API to retrieve and refresh an authentication session token.
The following code is the same for both capital components.
-
Initialize the component and mount it to the container you created. In this step, you can localize the components by setting a preferred language.
Select the tab for the component you want to use:
Step 4: (Optional) Customize the components
The capital components have a default appearance with pre-defined styles, such as colors, fonts, and borders. You can customize the appearance of your components by overriding the default values of CSS variables and the class styles:
- Inspect the components using your browser's developer tools.
- Modify the styles in your style sheet file.
The following tabs show examples of how to style the components. The first example shows how to override predefined CSS variables to use different colors and values. The second example demonstrates how to update the CSS class setting to change the layout of the info box element from a prominent blue background to an inline view with a bottom border.
Use case examples
Here you can find code examples demonstrating how to use the component instance methods and parameters for specific use cases in the components' implementation.
Example 1: Show the Capital Overview component based on its state
This example demonstrates how to render the Capital Overview component based on its state. For instance, if the state is isUnqualified, the component will not be rendered. This means that if a user is not yet qualified for grant offers, they will not see the component.
You can use the same approach for the Capital Offer component.
Example 2: Show the Capital Offer component as a standalone
This example demonstrates how to integrate the Capital Overview component and the Capital Offer component on separate pages. This setup allows you to place the Capital Offer component in a more prominent location within your user interface, such as on a dashboard page, which can help improve user conversion rates for grant applications.
When a user apply for a grant from the dashboard page, they will be redirected to the page featuring the Capital Overview component. This component will recognize that a grant has been requested and will show the list of available grants, thus continuing the flow initiated on the previous page. If the user navigates directly to the capital overview page without having requested funds beforehand, the Capital Overview component will instead render the section for requesting grants.
Example 3: Show the pre-qualified screen as a standalone
This example demonstrates how to show an introductory message for pre-qualified users on a dashboard page, while presenting the rest of the flow on a separate page.
Both pages use a separate instance of the Capital Overview component. The dashboard page features only the introductory message for pre-qualified users. When a user selects the button to apply for a grant, they will be redirected to the page containing the rest of the flow, bypassing the introductory message.
Example 4: Show the grant offer selection screen as a standalone
This example demonstrates how to render only the grant offer selection screen of the Capital Offer component, which features a dynamic slider. The rest of the flow will be implemented through direct integration with the Adyen API rather than using components. While this approach is not recommended, it does provide the flexibility to use the Capital Offer component partially to address your specific needs.