` with the value from your backend's "Creating New Payment" step.
**Monri Options:**
Additional options can be passed to the `Monri` constructor, such as `locale`. For localization details, refer to [section 3.2.1](#3.2.1-set-up-monri-components).
### 4.2. Create Your PayCek Payment Form
Similar to card components, create an empty DOM container with a unique ID for the PayCek component within your payment form.
**Example HTML:**
```HTML
```
:::(Info) (Note:)
*If your inserted payment form is invisible, it might be a CSS issue. Try removing classes like `form-row` for diagnostics.*
:::
Once the form is loaded, create and mount the PayCek Component:
```JavaScript
// Custom styling can be passed to options when creating PayCek Component.
var options = {
payCekOptions: {size: "small"}
};
// Create an instance of the PayCek Component.
var payCek = components.create("pay-cek", options)
.onStartPayment(() => {
// This is invoked after user clicks on PayCek button
// Here you can:
// 1. Collect user's info such as name, email address
// 2. Invoke confirmPayment with PayCek
const transactionParams = {
address: "Adresa",
fullName: "Test Test",
city: "Sarajevo",
zip: "71000",
phone: "+38761000111",
country: "BA",
email: "tester+components_sdk@monri.com",
orderInfo: "Testna trx"
}
monri
// confirmPayment opens a popup window for crypto currency selection
// then displays a QR code with wallet address
// finally, returns an Approved or Declined transaction response as a Promise
.confirmPayment(payCek, transactionParams) // Changed 'params' to 'transactionParams' for consistency
.then(e => {
if (e.error) {
// Inform the customer that there was an error.
alert(e.error.message)
} else {
// Handle approved or declined result
// For secure and stable result, handle on backend via WebHook (section 6)
}
})
.catch(e => {
alert(e);
})
});
// Add an instance of the PayCek component into the `pay-cek-element` .
payCek.mount("pay-cek-element");
```
---
## 5. Customizing Components
Monri Components offer various options for styling and specific functionalities.
### 5.1. Styling Components
Components can be styled via the `style` property in the second parameter of the `create` method (as shown in section 3.2.2).
The `style` object consists of four properties representing component element states, which override the `base` style if specified:
* `base`: Defines the default style applied to each component element.
* `complete`: Style applied when a component element is filled with a valid value.
* `empty`: Style applied when a component element is empty and loses focus.
* `invalid`: Style applied when a component element contains an invalid value and loses focus.
Additionally, `style` properties for `label`, `input`, `rememberCardLabel`, and `selectPaymentMethod` elements can be set explicitly.
Styles are applied to all component elements that have received focus at least once.
**Supported CSS Properties (all string type, all optional):**
| Attribute | CSS attribute | Description |
| :------------------ | :------------------------------ | :----------------------------------- |
| `fontSize` | `font-size` | Size of the font |
| `color` | `color` | Component element color |
| `fontFamily` | `font-family` | Family of the font |
| `fontSmoothing` | `font-smoothing` | Selected font smoothing |
| `fontVariant` | `font-variant` | Variant of the font |
| `fontWeight` | `font-weight` | Font weight |
| `letterSpacing` | `letter-spacing` | Font letter spacing |
| `textDecoration` | `text-decoration` | Component element text decoration |
| `textShadow` | `text-shadow` | Component element text shadow |
| `textTransform` | `text-transform` | Component element text transform |
| `border` | `border` | Component element border |
| `borderTop` | `border-top` | Component element top border |
| `borderRight` | `border-right` | Component element right border |
| `borderBottom` | `border-bottom` | Component element bottom border |
| `borderLeft` | `border-left` | Component element left border |
| `borderRadius` | `border-radius` | Component element border radius |
| `padding` | `padding` | Component element padding |
| `margin` | `margin` | Component element margin |
| `lineHeight` | `line-height` | Component element line height |
| `textIndent` | `text-indent` | Component element text indent |
| `position` | `position` | Component element position |
| `top` | `top` | Component element top |
| `bottom` | `bottom` | Component element bottom |
| `left` | `left` | Component element left |
| `right` | `right` | Component element right |
| `width` | `width` | Component element width |
| `backgroundColor` | `background-color` | Component element background color |
| `height` | `height` | Component element height |
| `boxShadow` | `box-shadow, moz-box-shadow, webkit-box-shadow` | Component element box shadow |
**Example of Custom Style Object:**
```JavaScript
var style = {
base: {
fontFamily: 'Rubik-Regular'
},
invalid: {
color: 'red'
},
complete: {
color: 'blue'
},
label: {
base: {
color: 'blue',
textTransform: 'none'
},
invalid: {
color: 'gray'
},
complete: {
color: 'green'
}
},
input: {
base: {
fontSize: '15px',
color: "#663399",
borderBottom: "1px solid purple"
}
},
rememberCardLabel: {
base: {
fontSize: '15px',
color: "#663399"
}
},
selectPaymentMethod: {
base: {
fontSize: '15px',
color: "#663399"
}
}
};
```
**Style Object Structure (empty fields can be omitted):**
```JavaScript
var style = {
base: {},
invalid: {},
complete: {},
empty: {},
label: {
base: {},
invalid: {},
complete: {},
empty: {}
},
input: {
base: {},
invalid: {},
complete: {},
empty: {}
},
rememberCardLabel: {
base: {},
invalid: {},
complete: {},
empty: {}
},
selectPaymentMethod: {
base: {},
invalid: {},
complete: {},
empty: {}
}
}
```
### 5.2. Component-Specific Options
#### Card Component Options
Card component options extend common component options with:
| Option | Type | Description | Default Value |
| :------------------------ | :------ | :----------------------------------------------------- | :------------ |
| `tokenizePan` | boolean | Tokenizes the PAN when the client enters card info. | `false` |
| `tokenizePanOffered` | boolean | Offers the client the option to tokenize their PAN. | `false` |
| `showInstallmentsSelection` | boolean | Shows the installments selection dropdown if enabled. | `false` |
**`tokenizePan` Option:**
If `true`, the PAN is tokenized upon transaction approval, and the `pan_token` value is populated in the transaction response.
```JavaScript
var style = {} // Define styling options for card component
var card = components.create("card", {
style: style,
tokenizePan: true // This will tokenize the PAN upon transaction approval
});
```
**`tokenizePanOffered` Option:**
If `true`, a "save card for future payments" checkbox is presented to the customer. If checked, the PAN is tokenized upon transaction approval, and `pan_token` is populated.
```JavaScript
var style = {} // Define styling options for card component
var card = components.create("card", {
style: style,
tokenizePanOffered: true // This enables the 'save card for future payments' checkbox in the form
});
```
**Important Notes:**
* If `tokenizePan` is `true`, `tokenizePanOffered` is ignored.
* Setting `tokenizePan` to `true` requires prior user consent (e.g., through accepted terms and conditions).
**`showInstallmentsSelection` Option:**
If `true` and installments are enabled for your merchant account, a dropdown for installment selection will be displayed.
```JavaScript
var style = {} // Define styling options for card component
var card = components.create("card", {
style: style,
showInstallmentsSelection: true // This enables installments selection
});
```
**Important Note:** If `showInstallmentsSelection` is `true` but the dropdown doesn't appear, it means installments are disabled for your merchant account. Contact [support@monri.com](mailto:support@monri.com){target=`_blank`} to enable them.
---
## 6. Transactions API: Variables, Lengths, and Formats
This section defines the variables and their properties used in API calls, particularly for JSON documents.
### Buyer's Profile Fields
| Name | Length | Format | Additional Info |
| :------------- | :------- | :----------- | :----------------------------------------------------------------- |
| `ch_full_name` | 3-30 | alphanumeric | Buyer's full name |
| `ch_address` | 3-100 | alphanumeric | Buyer's address |
| `ch_city` | 3-30 | alphanumeric | Buyer's postal code (ZIP) |
| `ch_zip` | 3-9 | alphanumeric | Buyer's postal code (ZIP) |
| `ch_country` | 2-3 | alphanumeric | Buyer’s country in alpha2, alpha3 letter code, or 3-digit ISO numeric code |
| `ch_phone` | 3-30 | alphanumeric | Buyer's phone number |
| `ch_email` | 3-100 | alphanumeric | Buyer's email address |
### Order Details Fields
| Name | Length | Format | Additional Info |
| :------------- | :--------- | :----------------- | :------------------------------------------------------------ |
| `order_info` | 3-100 | alphanumeric | Short description of the order being processed |
| `order_number` | 1-40 | printable characters | Unique identifier for the order |
| `amount` | 3-11 | integer | Amount in minor units (e.g., 10.24 USD is sent as 1024) |
| `currency` | predefined | alphabetic | Possible values are USD, EUR, or BAM |
---
## 7. Viewport Meta Tag Requirements
To ensure an optimal user experience for 3D Secure (3DS) authentication across all devices, you should set your page’s viewport `width` to `device-width` using the [viewport meta tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag){target=`_blank`}. Other viewport settings can be configured as needed, but `width=device-width` is crucial.
**Example:**
```HTML
```
If this tag is already present on your page and includes `width=device-width`, no further action is required.
---
## 8. API References
* [List of Response Codes](/v1/docs/list-of-response-codes){target=`_blank`}
* [Payment API](/v1/docs/payment-api){target=`_blank`}