Skip to content

get(): BasketPayment[]

The get method retrieves all basket payment options associated with the current shipping configuration.

Returned value

A returned value has a type of BasketPayment[] where BasketPayment represents the BasketPayment model, which is an array of available payment methods.

Example

In this example, we use the basketPaymentsApi to retrieve all available payment options for the basket shipping.

useStorefront(async (storefront) => {
    let basketPaymentsApi = storefront.getApiSync('basketPaymentsApi');

    if (!basketPaymentsApi) {
        const featureSystemApi = this.getApiSync('FeatureSystemApi');
        await featureSystemApi.registerDynamic('basket');

        basketPaymentsApi = storefront.getApiSync('basketPaymentsApi');
    }

    const allPaymentOptions = basketPaymentsApi.get();

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

Basket Payments API methods reference

Models reference