How it works
From an implementation perspective, a Drop-in integration contains:- Server-side: a single API call that creates the payment session.
- Client-side: frontend component, which uses the payment session data to make the payment request and to handle any other actions like redirects or 3D Secure authentication.
- Webhook server: receives notifications that inform you about the outcome of each payment.
Get started
Below is a two-step process for starting drop-in for your client.Create the Drop-in component
First, create a Drop-in using thedropin(configuration) method of the Payrails client as shown below:
JavaScript
Mount the Drop-in to the DOM
Now, when themount(containerId) method of the Drop-in is called, the Drop-in will be inserted in the specified div. For instance, the call below will insert the Drop-in into the div with the id #dropin-container.
HTML
JavaScript
unmount method to reset the Drop-in to its initial state.
Payment methods behavior and configurations
Event Listener
Attach your callables to the events emitted by the Drop-in:
The handler
function() => void is a callback function you provide, that will be called when the event is fired.
Style
You can configure the style of the Drop-in and individual elements inside with this configuration object:Typescript
Style non sensitive elements
Drop-in config allows you to pass custom classnames for non-sensitive elements. Allowing to easily change the styling of the entire drop-in form to match your branding. You can customize:- Radio buttons
- Store instrument checkboxes
- Button styles
- Custom font families
- Custom spacing and animations
- Animations after successful/failed payments
- Animation on Payment button
- If you would like to add some possibilities, please contact the Payrails team.
Show payment options logo
Payrails dropin also allows you to optionally show payment method logo alongside each payment method name. You can pass theshowPaymentMethodLogo as true for the payment methods you would want to show this.
By default this is false.
Translations
For the Drop-in, translations are part of thedropin(options) signature, inside the translations. here’s the complete interface:
Handle 3DS
We have 2 modes for handling 3ds -- Iframe based flow - In this flow the user sees the iframe as a popup to validate 3DS. We would recommend this flow to maximise conversion.
- Redirection based flow - In this flow the user is redirected to the new page to validate 3DS. If you have very strong CSP settings which cannot be relaxed to accommodate for 3DS, then we would recommend this flow.
redirectFor3DS to true.
TypeScript