Respond to a change in shipping option when using Apple Pay or Google Pay with the Square payment form.
Square Payment Form

Respond to a Shipping Option Change Deprecated
This component is deprecated. See below for guidance about what to use instead.


The Square payment form is deprecated and replaced by the Web Payments SDK.

You should use the Web Payments SDK to take payments on a web client. The Web Payments SDK uses modern web styling as shown in the following image:

A graphic showing the five visual elements of the Card payment method, which are represented as selectors that you specify in a card option styling object.

Recalculate shipping fees and taxes when a buyer changes the shipping option in the Apple Pay or Google Pay payment sheet.

Before you start Permalink Get a link to this section

Shipping option changes Permalink Get a link to this section

Use the shippingOptionChanged callback to respond to a change in the shipping option selected in the Apple Pay or Google Pay payment sheet.

Add a shippingOptionChanged callback function to the callbacks property of the SqPaymentForm initializing argument. The callback is invoked when a shipping option is changed on the payment sheet. Use the callback to calculate a new shipping cost and other fees. If the calculation results in a line item amount change, update the payment request with the new amounts by calling the done function in the callback.

For an Apple Pay payment request, avoid a timeout by calling done within 30 seconds to respond to the shipping option change. Pass in an optional PaymentDetailsUpdate object to update the payment total or line items.

Google Pay does not timeout the shipping option changed callback.

If you need more assistance, contact Developer Support or ask for help in the Developer Forums.