Skip to content

getAvailable(): BasketPayment[]

The getAvailable method retrieves the list of payment options that are currently available based on the basket's state and user eligibility.

Returned value

A returned value has a type of BasketPayment[] where BasketPayment represents the BasketPayment model.

Example

In this example, we use the basketPaymentsApi to get the available payment options.

useStorefront(async ({ eventBus, getApi }) => {
    eventBus.on('basket.initialized', async () => {
        const basketPaymentsApi = await getApi('basketPaymentsApi');

        const availablePaymentOptions = basketPaymentsApi.getAvailable();

        console.log('Available payment options:', availablePaymentOptions);
    });
});

Basket Payments API methods reference

Models reference