- Accelerates your integration by taking care of fronted interactions and the necessary API calls
- Leverages Mangopay’s data validation features in real time to ensure the user’s data conforms to the expected local bank account format
- Integrates SCA redirection to allow the user to authenticate the account registration
- Performs Verification of Payee checks for EUR local accounts in the SEPA zone and warns the user in case the account name and IBAN don’t match
Key concepts
The Recipients feature is built around key concepts relating to bank account registration. Each Recipient can be used for one combination ofCurrency, Country of registration, and PayoutMethodType, which together determine the account details required from the user.
The PayoutMethodType can be either InternationalBankTransfer or LocalBankTransfer, which determines whether payouts to the account will be attempted using the SWIFT international messaging system to the account’s IBAN, or via local rails to the local account format.
Independent of these values, the Recipient can also have one of two RecipientType values: Individual if registered to a private individual (first name and last name), or Business if registered to a legal entity (using the business name).
Note that the Recipients embedded experience can only be used to register bank accounts that are usable for payouts and therefore must be authenticated using Mangopay’s SCA feature. This means that the Natural User or Legal User must have the UserCategory of OWNER to be able to complete the session. The Recipient created via the embedded experience can also be used for pay-in use cases (read more about Recipient scopes).
User experience
The Recipients experience present the user with an easy-to-complete form:

Authentication
PrerequisitesTo integrate the Recipients experience you need:
- A dedicated Mangopay API key for embedded experiences - contact Mangopay via the Dashboard to get one for your Client ID
- The
UserIdof the user that the Recipient is being created for, which can be a Natural User or Legal User and must have theUserCategoryofOWNER.
clientToken) to authenticate the API calls from your frontend app to Mangopay’s servers.
The clientToken:
- Is specific to the
UserId - Is valid for 15 minutes
- Must be generated using OAuth 2.0 authentication
clientToken using OAuth 2.0 authentication, the steps are as follows:
1. Generate OAuth bearer token with your dedicated API key
To create theclientToken, you need a specific API key that has the required permissions for embedded experiences – if you don’t have one already, contact Mangopay via the Dashboard.
You need to encode the dedicated API key in the usual way for OAuth 2.0, by combining it with the Client ID separated by a colon (ClientId:ApiKey), and then encoding that string using Base64 (see the OAuth 2.0 authentication guide for details).
Once encoded, call the POST Create OAuth bearer token endpoint using Basic authentication (in the Authorization HTTP header, set the value to Basic followed by a space followed by your encoded string).
In the API response, you receive an access_token, which is valid for 1 hour (as shown by the expires_in value).
Use the token for its full lifetime to avoid overuse of the OAuth bearer token endpoint.
2. Obtain client token for the user’s Recipients session
Use your bearer token to call the POST Create an access token for Recipients endpoint, by setting the Authorization HTTP header value toBearer following by a space followed by the bearer token obtained in Step 1.
When you call this endpoint, you also need to specify the UserId of the Natural User or Legal User that the Recipient is being created for.
API request
access_token which you need to use later as the clientToken during initialization.
As shown by the expires_in value, the clientToken is valid for 15 minutes, which means the user must complete the Recipients registration session within this time.
API response
clientToken), you can use it to initialize Mangopay Elements.
Installation
The Recipients experience relies on the Mangopay Elements package. Install the package in your project using your preferred package manager:Integration
To integrate Mangopay Elements in your frontend app, using theclientToken generated by your server during authentication, the steps are as follows:
1. Import the SDK
Import the library into your JavaScript or TypeScript file:2. Fetch your access token from server
Before initializing the package, fetch theclientToken from your server that you generated during authentication:
3. Initialize the package
Use theclientToken to initialize the Mangopay Elements package:
4. Create the Recipients element
Define the default values for the user and customize your theme:5. Set up event listeners
Mangopay’s solution provides event listeners that you can use to insert the experience into your wider user journey. You need to set these up in your app like the example below – see the event handling section for details.6. Insert the container in to your HTML
Ensure your Recipients container is present in your DOM before mounting the element:7. Mount the element
Examples
See below for more complete examples you can adapt to your integration.HTML
JavaScript
TypeScript
Configuration reference
Initialization options
Theme
You can customize the colors and font:Recipient element options
You can use theTheme and RecipientOptions interfaces to customize the appearance and default values of the experience.
Supported currencies
The currencies supported by the experience are:Event handling
The Mangopay Elements package provides the following events that your application can rely on to manage the user’s experience.Ready
Theready event is triggered when the form is fully loaded and interactive.
Event data
Submit
Thesubmit event is triggered when the user has filled out the form and clicks the submit button.
Event data
Success
Thesuccess event is triggered when the Recipient is successfully created in Mangopay’s system:
Event data
The success event returns the unique identifier of the Recipient (RecipientId) that you can store and use to request the User’s payouts.
Error
Theerror event is triggered if the Recipient data is not valid after submission or if the Recipient is not created successfully.
Event data
Element lifecycle methods
| Method | Description | Example |
|---|---|---|
mount(selector) | Mounts element to a container | await element.mount('#container') |
unmount() | Unmounts element from the DOM | element.unmount() |
update(options) | Updates the configuration | element.update({ defaultValues: { currency: 'USD' } }) |
destroy() | Destroys the element | element.destroy() |
on(event, callback) | Registers an event listener | element.on('submit', cb) |
off(event, callback?) | Removes an event listener | element.off('submit') |
Troubleshooting
SDK must be initialized before creating elements
If you attempt to create an element before initialization, the SDK will throw an error. To fix this error, ensure you callMangopay.init() before Mangopay.createElement()
Debugging
Set thedebug property to true when calling MangopayInitOptions to see logs in the browser console: