Environments and Configurations

Learn about the available environments and configuration options for the Pluggy Connect widget, including sandbox testing and production setup.

Get your web application quickly and seamlessly integrated with our platform by using our drop-in Connect Widget!

Environments#

The Connect Widget runs on a single Production environment, available at:

https://connect.pluggy.ai

Using the production environment you can access both Live and Sandbox connectors — there is no separate sandbox URL.

Sandbox testing#

For testing purposes, you can experiment with your integration using our Pluggy Bank Sandbox connectors. Pluggy Bank provides everyday updated transactions and lets you test all the login flows and scenarios you would encounter when using any of the available Live connectors.

To display Sandbox connectors in the Connector selection step, set the includeSandbox property to true (not intended for production use):

const pluggyConnect = new PluggyConnect({
  connectToken: 'your-connect-token',
  includeSandbox: true,
  onSuccess: (itemData) => {
    console.log('Success!', itemData);
  },
});

Pluggy Bank test credentials#

For a successful connection with the Pluggy Bank connector, use:

FieldValue
Useruser-ok
Passwordpassword-ok
MFA token (when requested)123456

Any other username will result in an INVALID_CREDENTIALS error. For the full list of test users covering error scenarios (locked account, site not available, MFA flows, Open Finance, and more), check the Sandbox guide.

Available SDKs#

The Connect Widget is currently available for the following environments:

PlatformPackage / Example
Reactreact-pluggy-connect
React Nativereact-native-pluggy-connect
Flutterflutter_pluggy_connect
Vanilla JavaScriptpluggy-connect-sdk
Next.jsQuickstart example
Plain JavaScript (HTML)Quickstart example

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 are interested in contributing, a library for a language not represented here! Write us at hello@pluggy.ai

Available configurations#

Note: all parameters are optional, except for the connectToken.

PropertyDescriptionType
connectTokenYour Pluggy Connect token, which will be used to access the API.string
includeSandboxWhether to display Sandbox connectors in the Connector selection step (not intended for production use).boolean
allowConnectInBackgroundIf true, Connect can be minimized by the user to continue the connection with the component hidden.boolean
allowFullscreenIf set to false, Connect won't be displayed as fullscreen on small/mobile screens; it will be displayed as a modal instead. Defaults to true.boolean
updateItemItem ID to update. If specified, the widget will directly display the credentials form of the Item to be updated.string
selectedConnectorIdIf specified, and the Connector is available, after accepting terms the widget will navigate directly to this Connector's login form, skipping the connector selection step.number
connectorTypesList of Connector Types. If defined, only Connectors of the specified connector types (PERSONAL_BANK, BUSINESS_BANK, etc.) will be listed. Useful for cases of different flows for PF or PJ users.ConnectorType[]
connectorIdsList of Connector IDs. If defined, only Connectors with the specified connector IDs will be listed.number[]
countriesList of country codes (ISO-3166-1 alpha-2 format). If defined, only Connectors of the specified countries will be listed.CountryCode[]
productsIf 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). Important: product types must be specified in uppercase letters (ACCOUNTS, CREDIT_CARDS, TRANSACTIONS, etc.).ProductType[]
languageLanguage ISO string used to display the widget. If not specified, or if the selected language is not supported, the default language 'pt' will be used.string
themeTheme to use for displaying the UI. Can be 'light' or 'dark'. Defaults to 'light'.'light' | 'dark'
openFinanceParametersObject 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 }
forceOauthInBrowserIf set to true, OAuth URLs will always open in the system browser instead of a webview. This helps avoid webview-related issues. This prop takes precedence over the API config value.boolean
forceAskForCredentialsIf set to true, the widget will always prompt for credentials when updating an Item, even if the system would normally attempt to update automatically.boolean
onSuccessFunction to execute when an Item has been created/updated successfully.(data: { item: Item }) => void | Promise<void>
onErrorFunction to execute on a general error loading the widget, or when an Item creation/update status has not been successful. To validate which error happened, check item.executionStatus.(error: { message: string; data?: { item: Item } }) => void | Promise<void>
onOpenFunction to execute when the widget modal has been opened.() => void | Promise<void>
onCloseFunction to execute when the widget modal has been closed.() => void | Promise<void>
onHideFunction to execute when the widget modal has been hidden. It will only be called if the allowConnectInBackground prop is set to true.() => void | Promise<void>
onEventFunction to execute to handle custom user interaction events. See onEvent below for more info.Since v2.0.0:
(payload: ConnectEventPayload) => void | Promise<void>
Until v1.x:
(event: string, metadata: { timestamp: number }) => void

onEvent#

Use this callback to handle specific user interaction events.

The event property inside the payload of onEvent is the current event triggered. The available events that can be handled through this method are:

Event nameDescription
'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 the Pluggy API, either when just created, updated, or each time it's retrieved to poll its connection/execution status.

The payload object has a timestamp property, and some events include extra data:

  • 'SELECTED_INSTITUTION' includes the connector property, which is the connector selected by the user.
  • 'LOGIN_SUCCESS', 'LOGIN_MFA_SUCCESS', 'LOGIN_STEP_COMPLETED' and 'ITEM_RESPONSE' include the item property, which is the Item data related to the current connection.

v2.0.0 signature change

Since widget version 2.0.0, onEvent receives a single payload object: (payload: ConnectEventPayload) => void. In versions 1.x, it received two arguments: (event: string, metadata: { timestamp: number }) => void.

Webhooks and callbacks#

After a user makes a connection with the Pluggy Connect Widget, there are two ways to get the recently created Item ID.

Connect Widget callbacks#

In the frontend of your application (website, application, etc.), when you're using the Connect Widget, you get access to callbacks. This way, you can pass the widget a function to execute when an event happens (for example, an account connected successfully or with an error). What's important for you to know here 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)}
/>

This approach is great for handling frontend logic, but it is inconsistent by nature: you cannot rely on it for your business logic or database integrity. 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, use webhooks.

onSuccess won't always be called!

Caixa Econômica Federal (PF & PJ) has authorization flows that require the user to authorize Pluggy as a trusted device, and the process has a delay of around 30 minutes. In this scenario, you will receive an onError with the status USER_AUTHORIZATION_PENDING, and the SUCCESS event will be communicated via webhooks.

Webhooks#

A webhook (also known as a 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 in the Webhooks reference).

You'll need to create an endpoint to listen to Pluggy's webhook events, and then create a webhook pointing to that endpoint. More details can be found in the Webhooks reference, 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 while making the connection will result in you losing the Item ID of that connection, meaning you'll never be able to retrieve the Item data.

Summary#

CallbacksWebhooks
Where to use themFrontendBackend
How information is deliveredJavaScript callback function callsHTTP POST requests
PurposeImprove UXDeliver notifications to your backend when Pluggy-related events happen