Skip to content

getPaymentCostForActiveShippingByPaymentId(): FullPrice | undefined

The getPaymentCostForActiveShippingByPaymentId method allows to get the payment cost for an active shipping method by payment id.

Returned value

A returned value has a type of FullPrice | undefined where FullPrice represents the FullPrice model.

Example

In this example we make a basketShippingsApi call to get the payment cost for an active shipping method by payment id.

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

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

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

    const paymentCostForActiveShipping = basketShippingsApi.getPaymentCostForActiveShippingByPaymentId();
});

Basket Address API methods reference

Models reference