Skip to content

getSectionValidation(): TSectionValidation

The getSectionValidation method validates the payment section of the basket's shipping configuration, ensuring that all payment-related information meets the required validation rules.

Returned value

A returned value has a type of TSectionValidation, which contains validation results and statuses for the payment section.

Example

In this example, we use the basketPaymentsApi to validate the payment section of the basket's shipping configuration.

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

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

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

    const validationResults = basketPaymentsApi.getSectionValidation();

    console.log('Payment section validation:', validationResults);
});

Basket Payments API methods reference

Objects reference