Guides

Plaid Integration

If you are using the React component or embed, this will automatically be handled for you.


While some payment methods can be added directly via API, others like credit cards and Plaid require you to host a secure component that allows Mercoa to collect this information from your users in a PCI compliant manner.

Mercoa makes this easy by providing a secure component that you can embed in your app. This component will allow your users to add and manage payment methods in your app.

Generate a user token

Before you can embed the component, you will need to generate a user token. This token will be used to authenticate the user in the iFrame.

Follow this guide to learn how to generate a user token.

Embed the Component

Once you have a user token, you can embed the component in your app.

<script>
// Listen for messages from the iFrame. If the payment method is added successfully, the iFrame will send a message with the payment method response.
window.addEventListener('message', function (event) {
if (event.origin === 'https://mercoa.com') {
console.log(event.data) // PaymentMethodResponse object
}
})
</script>
<iframe
src="https://mercoa.com/embedded/add-bank-account/button?token=<USER_TOKEN>"
width="100%"
height="100%"
style="border: none;"
></iframe>

Open the bank account popup with your own button

<script>
// Listen for messages from the iFrame. If the payment method is added successfully, the iFrame will send a message with the payment method response.
window.addEventListener('message', function (event) {
if (event.origin === 'https://mercoa.com') {
console.log(event.data) //PaymentMethodResponse object
window.mercoaBankPopup.close() // Close the popup
}
})
</script>
<button
onClick="function(){
window.mercoaBankPopup = window.open(
'/embedded/add-bank-account/popup?token=' + <USER_TOKEN>,
'popup',
'width=600,height=600',
)
}"
>
Your button text
</button>

All payment methods screen

<iframe
src="https://mercoa.com/embedded/payment-methods?token=<USER_TOKEN>"
width="100%"
height="100%"
style="border: none;"
></iframe>