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
| PROPERTY | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| containerId | string | Yes | ID of the DOM element that will host the payment UI |
| form | object | No | Card form configuration (see Form Configuration section) |
| apms | object | No | APMs configuration (see APMs Configuration section) |
| language | string | No | Language code (e.g., 'en_EN', 'es_ES'). Defaults to browser language |
Form Configuration
| PROPERTY | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| styles | object | Custom CSS styles for form elements (see Styling and Customization section) | |
| showZipCode | boolean | false | Whether to show the ZIP code field |
| textDirection | string | 'ltr' | Text direction: 'ltr' or 'rtl' |
| collapsed | boolean | true | If true, form is initially hidden with a "Pay with card" entry point |
APMs Configuration
| PROPERTY | TYPE | DESCRIPTION |
|---|---|---|
| enabled | string[] | 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