Skip to main content

Appendices

Methods

The main methods exposed by the MacroPay class.

NAMEARGUMENTSTYPEDESCRIPTION
initFormformConfigObjectThis function will render the form and receive a config object as a parameter.
submit--In custom mode this method will invoke the submit handler inside the hosted form and return a promise with the submission result.
configUpdateconfigObjectThrough this method it is possible to pass a new config to the form without a page or component refresh. At this moment, only the orderId can be updated.

Configuration object

Description of the formConfig object necessary for a properly initForm method invocation.

PROPERTIESREQUIREDTYPEDESCRIPTION
containerIdYesStringThe ID attribute of the HTML element chosen as a container for the iframe.
formOptionsNoObjectAn optional object with some customization properties for the form initialization. If this is not provided then the form will be rendered in default mode.
onSubmit-FunctionA callback function to inform about the form submission result. Should be defined only in default mode.
onChange-FunctionA callback function to inform about the current form state.

Customization object

Description of the formOptions object necessary to customize the form.

PROPERTIESREQUIREDTYPEDEFAULTDESCRIPTION
showButtonNoBooleantrueIndicates if the submit button must be rendered or not.
showCardTypesNoBooleantrueIndicates if the card types component must be rendered or not.
themeNoString‘bootstrap’Select a theme style: ‘bootstrap’ / ‘material’
languageNoString'en-US'Indicates in what language the form should be rendered (ISO code). Check the languages table for the full list of available languages.
stylesNoObjectundefinedReceive CSS properties for different form elements. You can learn more about these in the styles object table below.
wideLayoutNoBooleanfalseSet wideLayout to true to render a responsive and wide form. In this case, the form will get the container's size and grow/shrink as its container does.
tooltipsNoBoolean/ObjecttrueShow/hide input’s tooltips. Only available at wideLayout mode. true: show a tooltip on each form input. false: hide all tooltips. object: you can select which tooltips show by sending a tooltips object
showZipCodeNoBooleanfalseIndicates if the ZIP code input must be rendered or not.

Tooltips object

This object is optional and is used to render only the selected input tooltips. You can select which ones to render by sending a key pair with a true value, such as in the example below.

{
cardHolder: true,
cardNumber: true
}
PROPERTIESREQUIREDTYPE
cardHolderNoBoolean
cardNumberNoBoolean
cardNumberNoBoolean
cvcNoBoolean

Styling properties

ELEMENTCSS PROPERTYTYPEDEFAULTRANGEDESCRIPTION
typographyfontFamilyString"Roboto", "Helvetica", "Arial", sans-serifRoboto and System fontsSet the fontFamily of the form. Only Roboto and System fonts are available.
primaryColorString"rgba(0, 0, 0, 0.87)"-
secondaryColorString"rgba(0, 0, 0, 0.80)"-
inputcolorString'rgba(0, 0, 0, 0.87)'-The input element css properties. All can be overridden with a value of the indicated type and also using ‘none' or 'unset’ strings. The color css property must have one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(). The input height can be a number between 19 and 60.
fontSizeNumber1610 – 18The input element css properties. All can be overridden with a value of the indicated type and also using ‘none' or 'unset’ strings. The color css property must have one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(). The input height can be a number between 19 and 60.
borderRadiusNumber4-The input element css properties. All can be overridden with a value of the indicated type and also using ‘none' or 'unset’ strings. The color css property must have one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(). The input height can be a number between 19 and 60.
borderString'1px solid #ced4da'-The input element css properties. All can be overridden with a value of the indicated type and also using ‘none' or 'unset’ strings. The color css property must have one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(). The input height can be a number between 19 and 60.
heightNumber1919 – 60The input element css properties. All can be overridden with a value of the indicated type and also using ‘none' or 'unset’ strings. The color css property must have one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(). The input height can be a number between 19 and 60.
backgroundColorString‘white’-The input element css properties. All can be overridden with a value of the indicated type and also using ‘none' or 'unset’ strings. The color css property must have one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(). The input height can be a number between 19 and 60.
inputAdornmentColorString‘#ced4da’-The input icon color (cardType icon and CVC icon).
spacingNumber00 – 30Used to increase the vertical space between inputs. Due to layout, it is not possible to decrease the current space between inputs.
inputFocusborderColorString'#80bdff'-Styles applied to the input element on a focus event.
boxShadowString'none-
backgroundColorString‘white’-The input BackgroundColor, applied on focus event.
inputHoverborderColorString'rgba(0, 0, 0, 0.80)'-Styles applied to the input element on a hover event.
backgroundColorString‘white’-The input BackgroundColor, applied on hover event.
inputValidationcolorString‘none’-Styles applied to the input element on a valid event.
borderColorString‘none’-Styles applied to the input element on a valid event.
inputErrorfontWeightNumber300[300, 400, 500, 700]Styles applied to the input error element on an error event.
fontSizeNumber1210 – 18Styles applied to the input error element on an error event.
colorString‘#db2828’-Styles applied to the input error element on an error event.
borderColorString‘#db2828’-Styles applied to the input error element on an error event.
inputLabelcolorString'rgba(0, 0, 0, 0.80)'Styles applied to the input label element.
fontSizeNumber1210 – 18Styles applied to the input label element.
fontWeightNumber400[400, 500, 700]Set the label font weight
inputLabelFocuscolorString'#80bdff'-Styles applied to the input label element on a focus event.
tooltipiconColorString'rgb(128,128,128)'-Sets the tooltip icon color
iconTextColorString‘white’-Sets the inner icon “?” color.
iconHoverString'rgba(128,128,128, 0.6)'-Sets the tooltip icon color on hover event
backgroundColorString'rgb(128,128,128)'-Sets the background Color of the box with help text, opened when a hover event happens.
textColorString'#FFF-Sets the help text color.
fontSizeNumber1210 – 18Sets the help text size.
fontWeightNumber400[400, 500, 700]Sets the help text weight.
paddingNumber55 – 15Sets the inner padding between help text and its box.

Languages

LANGUAGEISO CODELANGUAGEISO CODE
Arabic‘ar-SA’Dutch'nl-NL'
Czech'cs-CZ'Polish'pl-PL'
German'de-DE'Portuguese'nl-NL'
English'en-US'Russian'ru-RU'
Spanish'es-ES'Thai'th-TH'
French'fr-FR'Turkish‘tr-TR’
Italian'it-IT'Ukrainian'uk-UA'
Japanese'ja-JP'Chinese Simplified'zh-CN'
Korean'ko-KR'Chinese Traditional'zh-TW'