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

PROPERTYTYPEVALUEDESCRIPTION
stylesobject{}Custom CSS styles for form elements (see Styling and Customization section)
showZipCodebooleanfalseWhether to show the ZIP code field
collapsedbooleantrueIf true, form is initially hidden with a "Pay with card" entry point
buttonStylesobject{ backgroundColor: '#FFFFFF', textColor: '#000000', height: 44, borderRadius: 16 }Styles for the primary submit button rendered by the hosted card form. Use these to match your brand while keeping accessible contrast and touch targets
cardBrandsarray['cb1', 'cb2', 'cb3', ...]List of supported card brands used to display brand icons in the card input and to recognize the card type as the user types the card number. Supported Card Brands: "visa", "mastercard", "american_express", "unionpay", "jcb", "discover", "diners_club", "maestro", "elo", "hipercard", "troy", "mir", "cartes_bancaires", "dankort"

APMs Configuration

PROPERTYTYPEVALUEDESCRIPTION
enabledstring[]'[...apms]'Array of APMs to display and their render order. Use getApmsAvailable() to query supported methods
buttonTypesobject{ apple_pay: 'plain', google_pay: 'plain', paypal: 'plain', ... }Defines the visual style variant for each APM button (e.g. plain). Use it to control how individual APM buttons are rendered

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

Complete Initialization Example

await revup.init({
  containerId: 'revup-container',
  form: {
    collapsed: false,
    showZipCode: true,
buttonStyles: {
backgroundColor: '#306de5',
textColor: '#FFFFFF',
height: 44,
borderRadius: 16
},
cardBrands: ['visa', 'masterCard', 'american_express', ...],
  },
  apms: {
    enabled: ['apple_pay', 'google_pay', 'paypal'],
buttonTypes: {
apple_pay: 'book',
google_pay: 'buy',
paypal: 'checkout',
...
}
  }
});

Minimal Initialization

const revup = new Revup({
    apiKey: '...',
    merchantDomain: window.location.host,
    orderId: '...',
});
const revupMessageCleanup = revup.onRevupMessage((event) => {
    console.log('Received Revup event:', event);
});
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