- Drop-in: an all-in-one payment form to accept payments on your website.
- Elements: modular payment UI components you can assemble to build a modular payment form.
- Secure fields: secure input fields for PCI-compliant cardholder data collection.

Get started with the SDK
Regardless of which SDK components you want, it starts with the same initialization process.Include the SDK
You can install the SDK with your favorite package manager (e.g.,npm):
JavaScript
iOS
React Native
Initialize the SDK
Use theinit() method to initialize a Payrails client as shown below, with configuration. On the web, init() is asynchronous: it loads the SDK bundle and its styles, so await it.
JavaScript
iOS
React Native
Example authorization flow
Here’s a simple authorization flow with the surface covered by the SDK:Example for web
Learn more
After the SDK is initialized, use the SDK features to customize the user experience:- custom field validation and errors
- subscribe and react to events happening inside the form
- customize the look with
appearancerules - save your tokenized card and get a payment instrument for future references
Payment amount update
Our SDK supports the possibility of updating the amount. To achieve that, 2 things have to be done:- Merchant backend must call the lookup action on the execution used for that payment session.
- Merchant client has to update the SDK with the new amount. Moreover, if installments are enabled, the merchant client must also update the installment configuration along with the amount.
JavaScript
401 HTTP error.
Refresh Client Session
When the client session expires, the SDK fires thesessionExpired event. Return a fresh client init response from your handler, and the SDK starts a new session with it.
Example:
BIN lookup
Our SDK supports using our BIN lookup service to fetch card information. This feature is not enabled by default, so please reach out to your account manager to enable. Example:JavaScript
Example on how to allow only credit cards
Installment payments for cards in MX and BR
In certain countries or regions, it’s common for shoppers to pay for purchases in installments using credit cards. This allows them to receive their items right away while spreading the cost over multiple months. The installment payments are automatically charged to the shopper’s credit card every 30 days until the full balance is settled. Our SDK supports collecting installment plan information from the end-user and passing it through to downstream processors. Please contact us if you would like to enable this feature.
Config options for installments dropdown
Accept Customer Address
With dropin it is possible to show address component to the end user. You can use it for collecting billing address which may be needed to tax purposes. Please contact us if you would like to enable this feature.
Example code for billing address config
Performance optimizations
The web SDK loads its bundle when you callinit(), and the secure card fields load when the card form mounts. To show the card form sooner, initialize the SDK and mount the card form early, hidden if necessary, before the shopper reaches the payment step.