Step 3: Frontend Integration
Now that you have the JWT token, you can build your frontend with Mercoa’s React components (recommended) or the embedded iFrame.
The React components give you full control over the design and layout of your frontend as well as an all-in-one experience for a quick start, while the embedded iFrame is a simpler drop-in integration for the Mercoa AP inbox.
Building with React
Mercoa’s React components (documented on react.mercoa.com) enable you to quickly ship and customize your payment platform’s frontend to fit your needs.
To render correctly, all Mercoa-powered frontend elements must be inside a <MercoaSession>
component with a valid JWT token. The <MercoaSession>
component handles authentication and provides a React Context called MercoaContext
to its children, which encodes all the information you need to build your frontend.
To access this information in your frontend, you can drop in and customize Mercoa’s React components or use the useMercoaSession
hook to render a completely custom frontend. For most use cases, the React components are the easiest way to get started.
For more details, see the React SDK documentation.
Customizing the Mercoa iFrame with a JWT Token
Mercoa also supports some customization of the embedded iFrame via a JWT token. When you generate a JWT token, you can pass in additional options in the request body: