Additional Methods
Get Available APMs
Query which APMs are available for the current merchant and session:
const availableApms = await revup.getApmsAvailable();
// Returns: ['apple_pay', 'google_pay', 'paypal', 'stripe_link']
This can be called before init() (as in the reference integration).
Note: this method is optional and has an additional loading time, it can be called in parallel to loading the SDK as it is not necessary for its initialization.
Cleanup and Re-initialization
When re-rendering (e.g., new order, page navigation):
- Remove the
onRevupMessagelistener with cleanup function::
cleanup(); // Function returned from onRevupMessage
- Clear the container:
const container = document.getElementById('revup-container');
if (container) container.innerHTML = '';
- When the container is available again and you have a new config/orderId, create a new
Revupinstance and callinit()again:
const revup = new Revup(newConfig);
await revup.init({ containerId: 'revup-container', ... });
Important
Do not reuse the same Revup instance for a different order without clearing the DOM and re-initializing; use a fresh instance per checkout session if your app flow requires it.
const container = document.getElementById('revup-container');
if (container) container.innerHTML = '';
// Later, when sdkLoaded && orderId:
revup = new Revup(config);
await revup.init({ containerId: 'revup-container', form: { ... } });