Skip to main content

Initialization

After the container exists in the DOM, call the asynchronous init() method:

await revup.init({
containerId: 'revup-container',
form: { ... }, // Optional - card form configuration
apms: { ... }, // Optional - APMs configuration
language: 'en_EN' // Optional - defaults to browser language
});

Parameters: RevupOptions

PROPERTYTYPEREQUIREDDESCRIPTION
containerIdstringYesID of the DOM element that will host the payment UI
formobjectNoCard form configuration (see Form Configuration section)
apmsobjectNoAPMs configuration (see APMs Configuration section)
languagestringNoLanguage code (e.g., 'en_EN', 'es_ES'). Defaults to browser language

Form Configuration

PROPERTYTYPEDEFAULTDESCRIPTION
stylesobjectCustom CSS styles for form elements (see Styling and Customization section)
showZipCodebooleanfalseWhether to show the ZIP code field
textDirectionstring'ltr'Text direction: 'ltr' or 'rtl'
collapsedbooleantrueIf true, form is initially hidden with a "Pay with card" entry point

APMs Configuration

PROPERTYTYPEDESCRIPTION
enabledstring[]Array of APMs to display and their render order. Use getApmsAvailable() to query supported methods

Supported APM values: 'apple_pay', 'google_pay', 'paypal', 'stripe_link'

Complete Initialization Example

await revup.init({
containerId: 'revup-container',
form: {
collapsed: false,
showZipCode: true,
textDirection: 'ltr',
styles: {
input: {
color: '#333333',
fontSize: 16,
border: '1px solid #cccccc'
}
}
},
apms: {
enabled: ['apple_pay', 'google_pay', 'paypal', 'stripe_link']
},
language: 'en_EN'
});

Minimal Initialization

const revup = new Revup({
apiKey: 'your-api-key',
merchantDomain: window.location.host,
orderId: 'order-12345'
});
await revup.init({
containerId: 'revup-container'
});

Error Handling: If the container ID is not found in the DOM, init() throws:

Container with id: <containerId> not found, please check if the container is present in the DOM