collana pay JS Docs / ExpressButtons
Function: ExpressButtons()
ExpressButtons(
config):ExpressButtonsInstance
Defined in: core/CollanaPay.ts:360
Creates an ExpressButtonsInstance that manages one or more express checkout button providers.
The returned instance is inert until render() is called. Provider SDK loading, telemetry initialization, and button rendering all happen lazily inside render().
Parameters
config
The full configuration object describing which providers to render, the target environment, and the callback handlers (onClick, onApprove, onCancel, onError).
Returns
An ExpressButtonsInstance with render(), teardown(), and teardownProvider() methods.
Example
ts
const buttons = CollanaPay.ExpressButtons({
providers: [
{
providerProtocolType: 'PayPal',
paymentMethodType: 'PayPalExpress',
container: '#paypal-btn',
},
],
environment: 'sandbox',
onClick: async (identity) => {
// create order on backend
return { orderId: '123' };
},
onApprove: (data) => { console.log('Approved', data.orderId); },
onCancel: (identity) => { console.log('Cancelled', identity.paymentMethodType); },
onError: (error) => { console.error(error.code, error.message); },
});
await buttons.render();