Environments and configurations
Get your web application quickly and seamlessly integrated to our platform by using our drop-in Connect Widget!
Currently available for the following environments:
Navigate to each project to find more detailed usage information in each README. You can also check out our Quickstarts repo to help you get started with your own integration.
Interested in contributing?
Let us know if you require or if you are interested in contributing a library for a language not represented here! Write us to [email protected]
Available configurations
Note: all parameters are optional, except for the connectToken.
Property | Description | Type |
---|---|---|
connectToken | Your Pluggy Connect token, which will be used to access the API. | string |
includeSandbox | Whether to display Sandbox connectors in the Connector selection step (not intended for production use) | boolean |
allowConnectInBackground | If true, Connect can be minimized by the user to continue the connection with the component hidden. | boolean |
allowFullscreen | If set to false, Connect won't be displayed as fullscreen on small/mobile screens, it will be displayed as a modal instead. Default to true | boolean |
updateItem | Item id to update. If specified, the modal will display directly the credentials form of the item to be updated. | string |
selectedConnectorId | If specified, and the Connector is available, after accepting terms, the widget will navigate to this Connector login form directly, skipping connectors selection step. | number |
connectorTypes | List of Connector Types. If defined, only Connectors of the specified connector types will be listed. | ConnectorType[] |
products | If defined, only the products specified in this array will be executed in the item creation (in order to be executed, you should have them enabled in your team subscription). | ProductType[] |
connectorIds | List of Connector IDs. If defined, only Connectors of the specified connector IDs will be listed. | number[] |
countries | List of country codes (ISO-3166-1 alpha 2 format). If defined, only Connectors of the specified countries will be listed. | CountryCode[] |
language | Language ISO string used to display the widget. If not specified, or selected language is not supported, the default language 'pt' will be used. | string |
theme | Theme to use for displaying the UI. Can be 'light' or 'dark' . Defaults to 'light' . | 'light' | 'dark' |
openFinanceParameters | Object with CPF and CNPJ for Open Finance connectors only, the form will be pre-filled with these values. Contains optional cpf and cnpj string fields. | { cpf?: string; cnpj?: string } |
onSuccess | Function to execute when an Item has been created/updated successfully. | (data: { item: Item }) => void | Promise<void> |
onError | Function to execute on a general error loading the widget, or when an Item creation/update status has not been successful. | (error: { message: string; data?: { item: Item } }) => void | Promise<void> |
onOpen | Function to execute when the widget modal has been opened. | () => void | Promise<void> |
onClose | Function to execute when the widget modal has been closed. | () => void | Promise<void> |
onHide | Function to execute when the widget modal has been hidden, it will only call if allowConnectInBackground prop is set as true. | () => void | Promise<void> |
onEvent | Function to execute to handle custom user interaction events. See below for more info. | Function to execute to handle custom user interaction events. See below for more info. Since v2.0.0:(payload: ConnectEventPayload) => void | Promise<void> Until 1.x: (event: string, metadata: { timestamp: number }) => void |
onEvent
Use this callback to handle specific user interaction events.
The property event
inside the payload
of the onEvent
is the current event triggered.
The available events that can be handled through this method are:
Event name | Description |
---|---|
'SUBMITTED_CONSENT' | User has confirmed terms & privacy consent on the first Welcome screen. |
'SELECTED_INSTITUTION' | User has selected an institution to connect to. |
'SUBMITTED_LOGIN' | User has submitted credentials to create the connection Item. |
'SUBMITTED_MFA' | User has submitted an extra parameter that has been requested by the institution to connect. |
'LOGIN_SUCCESS' | User has submitted credentials to create the connection Item successfully. |
'LOGIN_MFA_SUCCESS' | User has submitted an extra parameter that has been requested by the institution to connect successfully. |
'LOGIN_STEP_COMPLETED' | Successful completion of the login. User effectively logged in to the institution. |
'ITEM_RESPONSE' | Called every time the Item object is retrieved from Pluggy API, either when just created, updated, or each time it's retrieved to poll it's connection/execution status. |
payload
object has a property timestamp
and some events extra data:
'SELECTED_INSTITUTION'
has theconnector
property which is the connector selected by the user.'LOGIN_SUCCESS' | 'LOGIN_MFA_SUCCESS' | 'LOGIN_STEP_COMPLETED' | 'ITEM_RESPONSE'
events have theitem
property which is the item data related to the current connection.
Webhooks and callbacks
After a user makes a connection with Pluggy Connect widget, there are 2 ways to get the recently created item ID
Pluggy Connect Widget Callbacks
In the frontend of your application (website, application, etc), when you’re using Pluggy Connect widget, you get access to callbacks. (read callbacks) This way, you can pass the widget a function you need to execute when an event happens (for example an account connected successfully or with an error). What’s important here for you to know is that callbacks are used to improve the user experience, like redirecting users to a success page or showing an error message.
<PluggyConnect
...
onSuccess={({ item }) => console.log(item.id)}
onError={({message, data: {item}}) => showErrorPage(message)}
/>t
This approach is great for handling front-end logic, but it has the problem that it’s inconsistent and you cannot relay your Business Logic or DB integrity to it. Because for example, a user can close the application before the connection finishes successfully, and you will never realize that the connection finished.
To be consistent, we introduce Webhooks!
onSuccess won't always be called!
Caixa Economica Federal (PF & PJ), has authorization flows that will require the user to authorize Pluggy as a trustable device, and the process has a delay of 30'.
In this scenario, you will receive anonError
with the statusUSER_AUTHORIZATION_PENDING
, and the SUCCESS event will be communicated via webhooks.
Webhooks
Webhook (also known as web callback) is a simple method that makes it easy for an app or system to provide real-time information whenever an event happens, that is, it is a way to passively receive data between two systems through an HTTP POST
.
Webhooks will send your API / backend a notification when events related to connections happen. For example, you can get notified when an item is created or updated. (read more here)
You’ll need to create an endpoint to listen to Pluggy’s webhook events and then create a webhook pointing to that endpoint you created. More details about webhooks can be read in the documentation, but what’s important to understand here is that webhooks are the way to get the item ID of a connection for you to work on. Even though you can also retrieve the item ID with callbacks in the frontend, handling business logic with them is a bad practice, for example, a user closing the website they were making the connection on will result in you losing the item ID of that connection, meaning you’ll never be able to retrieve the item data.
Summary
Callbacks | Webhooks | |
---|---|---|
Where to use them | Frontend | Backend |
How is information delivered | Javascript Callback function calls | HTTP POST requests |
Purpose | Improve UX | Deliver notifications to your backend when pluggy related events happen |
Updated 10 days ago