This example describes how to create a payment instrument and make it available for future payments. This is useful when you need to process payments that have a future date. To access this functionality directly, use RebillyInstrument.setup(instrument).
For this example, this is the only the required mounting point.
<html>
<body>
<div id="app">
<div class="form-wrapper">
<section class="rebilly-instruments"></section>
</div>
</div>
</body>
</html>By default transactionType is set to purchase, change this property to setup. You may provide any purchase data available to mount.
RebillyInstruments.mount({
publishableKey: 'pk_sandbox_123',
organizationId: 'org-123',
websiteId: 'my-website-id',
transactionType: 'setup',
money: {
amount: 0,
currency: 'USD',
},
});Use RebillyInstruments.on() to access the setup-completed event and to capture the instrument and the transaction.
RebillyInstruments.on('setup-completed', (setup) => {
// setup will contain instrument and transaction
console.log('setup-completed', setup);
});