--- title: "Components" slug: "components-integration" updated: 2025-07-31T05:53:12Z published: 2025-07-31T05:53:12Z canonical: "docs.monri.com/components-integration" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.monri.com/llms.txt > Use this file to discover all available pages before exploring further. # Components This documentation provides a comprehensive guide to integrating Monri Components into your web application for secure and flexible payment processing. --- ## 1. Overview Monri Components are a set of UI elements provided by Monri.js that allow you to securely collect sensitive payment information (like card details or cryptocurrency payment initiation) directly from your customers' browsers without compromising PCI DSS compliance. By using Components, you embed hosted fields directly into your payment form, ensuring that sensitive data never touches your servers. ### Key Benefits: * **PCI DSS Compliance:** Sensitive data is handled directly by Monri. * **Customizable UI:** Components can be styled to match your brand. * **Simplified Integration:** Streamlined process for card and crypto payments.
--- ## 2. Requirements ### 2.1. HTTPS All submissions of payment information using Monri Components are made via a secure HTTPS connection. To ensure maximum security and prevent Mixed Content warnings in modern browsers, **the page containing your payment form MUST also be served over HTTPS (`https://`)** rather than just `http://`. For more information on SSL certificates and enabling HTTPS, please refer to our [security documentation](https://ipgtest.monri.com/en/security){target=`_blank`}. ### 2.2. Components script loading from the source Components script **must always load directly from `monri.com`**. For more information please refer to [3.2.1. Set Up Monri Components](/v1/docs/components-integration#321-set-up-monri-components) below.
--- ## 3. Core Integration: Card Payments This section details the primary integration steps for accepting card payments using Monri Components. ### 3.1. Creating a New Payment on Your Backend This is the initial step, ideally executed once you have sufficient information to create a customer's order. You will typically generate a `client_secret` on your backend which is then sent to your frontend for use with Monri Components. For detailed backend integration, refer to the [Payment API documentation](../api-documentation/api-v2/payment-api.md){target=`_blank`}. **Demo:** See a live demonstration of Components integration here: [Demo Components](https://ipgtest.monri.com/services-demo/integration/components-create-payment){target=`_blank`} ### 3.2. Confirming Payment on Your Application (Frontend) After generating the `client_secret` on your backend and sending it to your frontend application, you will use Monri Components to confirm the payment. **Steps:** 1. Ensure you have a valid `client_secret` (obtained from your backend via `payment/new` API call). 2. Set up Monri Components (initialize `Monri.js`). 3. Create the necessary HTML containers for your custom payment form. 4. Confirm payment using `monri.confirmPayment`. 5. Handle the `ConfirmPaymentResponse`. #### 3.2.1. Set Up Monri Components Components are part of the `Monri.js` library. To get started, include the following script on your pages. This script **must always load directly from `monri.com`** to remain PCI compliant; you cannot bundle it or host a copy yourself. ```HTML ``` Next, create an instance of Monri and components: ```JavaScript var monri = Monri(''); var components = monri.components({"clientSecret": ""}); ``` * Replace `` with the value provided in your merchant dashboard. * Replace `` with the value obtained in the "Creating New Payment on Merchant's Backend" step. When ready to accept live payments, ensure you replace the `authenticity-token` and `client-secret` with your production values.
**Monri Constructor Options:** The `Monri` constructor accepts an optional second parameter for customization: `locale`: Sets the language for components (details below). `fonts`: An array of `FontFace` objects for custom styling (explained below). **Localization:** Components can be localized by specifying the `locale` option. For example, to use the Croatian (`hr`) locale: ```JavaScript var monri = Monri('authenticity-token', {locale: 'hr'}); ``` Currently supported locales are: * `hr` (Croatian - ICU `hr_HR`) * `en` (English - ICU `en_US`, default) * `sr` (Serbian - ICU `sr_SR`) :::(Info) (Note:) *"Locale" currently refers to language only; number and date formats are not supported.* ::: **Custom Fonts:** Components can be styled using custom fonts by passing an array of `FontFace` objects to the `fonts` property in `Monri` options: ```JavaScript var monri = Monri('', { fonts: [ { family: 'Rubik-Light', src: '/static/fonts/rubik-light.ttf' }, { family: 'Rubik-Regular', src: '[https://some-site.com/fonts/roboto.ttf](https://some-site.com/fonts/roboto.ttf)', weight: '900' } ] }); ``` The `family` and `src` properties are required. Optional properties include `display`, `weight`, `style`, `stretch`, and `unicode-range`. For `display` values, refer to [MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display#values){target=`_blank`}. Localization and font options can be combined: ```JavaScript var monri = Monri('', { locale: 'hr', fonts: [...] // Your font array }); ``` #### 3.2.2. Create Your Payment Form To securely collect card details, Monri Components create UI elements that are hosted by Monri and then embedded into your form. Create empty DOM elements (containers) with unique IDs within your payment form. We recommend using a `