collana pay JS Docs / ExpressButtonsConfig
Interface: ExpressButtonsConfig
Defined in: types.ts:1250
Top-level configuration object passed to ExpressButtons().
Remarks
Combines the list of provider button configurations with lifecycle callbacks and environment settings. The SDK renders all configured providers in parallel via Promise.allSettled.
Example
const config: ExpressButtonsConfig = {
environment: 'sandbox',
locale: 'en-US',
providers: [
{
providerProtocolType: 'PayPal',
paymentMethodType: 'PayPalExpress',
container: '#paypal-container',
style: { color: 'gold', shape: 'rect' },
options: { intent: 'capture', currencyCode: 'USD' },
},
],
onClick: async (identity) => {
const order = await createOrder(identity);
return { orderId: order.id, checkoutData: { id: order.checkoutId } };
},
onApprove: (data) => { window.location.href = `/confirm?order=${data.orderId}`; },
onCancel: (identity) => { console.log('Cancelled', identity); },
onError: (error) => { console.error(error); },
};Extends
Properties
environment?
optionalenvironment?:Environment
Defined in: types.ts:1257
Target environment.
Default Value
'sandbox'
locale?
optionallocale?:string
Defined in: types.ts:1259
IETF locale tag applied to all provider SDKs (e.g. 'en-US').
onApprove
onApprove: (
data) =>void
Defined in: types.ts:1196
Called when the payment is approved by the shopper.
Parameters
data
Approval details including order ID and optional payer info.
Returns
void
Inherited from
onCancel
onCancel: (
identity) =>void
Defined in: types.ts:1202
Called when the shopper cancels the payment flow.
Parameters
identity
Identifies which provider was cancelled.
Returns
void
Inherited from
onClick
onClick: (
identity,paymentMethodData?) =>Promise<OrderResult>
Defined in: types.ts:1190
Called when the shopper clicks a payment button.
Parameters
identity
Identifies which provider button was clicked.
paymentMethodData?
unknown
Provider-specific payment method data (Adyen state.data).
Returns
Promise<OrderResult>
A promise resolving to the created order result.
Remarks
The integrator should create an order on their backend and return an OrderResult. For Adyen providers, paymentMethodData contains the Adyen state.data which should be forwarded to the backend API call.
Inherited from
onError
onError: (
error) =>void
Defined in: types.ts:1213
Called when an error occurs during the payment flow.
Parameters
error
Structured error with code, message, and provider identity.
Returns
void
Remarks
Provider rendering uses Promise.allSettled, so one provider's failure does not prevent other providers from rendering. Each failure triggers a separate onError call.
Inherited from
providers
providers:
ProviderButtonConfig<ProviderKey>[]
Defined in: types.ts:1252
One or more provider button configurations to render.
