This feature improves the user experience by embedding your shipping options directly into the Clearpay Express Checkout flow. It streamlines the checkout process and can be combined with the buyNow flag to create a one-stop checkout that immediately precedes the order confirmation page.
We recommend the Integrated Shipping flow for merchants with:
Multiple button styles are available, each clearly communicating the next step to the customer.

Integrated Shipping is configured in the call to initializeForPopup triggered by the Express Checkout button.
It requires shippingOptionRequired to be true (enabled by default) and an onShippingAddressChange callback must be defined:
Integrated Shipping is enabled by default for Express orders. To disable it, shippingOptionRequired must be set to false.
Integrated Shipping requires the Express Checkout flow to be launched as a popup, due to the way shipping information is communicated over the frontend. The redirect method is not supported.
The Shipping Address Change callback is a feature of the Express Checkout. This callback allows a merchant to dynamically update shipping options and taxes based on the shipping address chosen by the consumer.
The shipping address change callback is required:
To set up the Shipping Address Change callback, implement the onShippingAddressChange function. This function will be passed two arguments: **data **and actions.
How the shipping options are calculated is entirely managed by the merchant. They can be calculated in Javascript or by handing off to an internal API.
If shipping options are available for the given address, they can be returned to Clearpay using the resolve action as shown in the code example below. Similarly, the reject action is used when shipping is unavailable.
Example retrieving shipping options via API
Example calculating shipping options in JS
Clearpay calls your onShippingAddressChange function when:
Clearpay provides the following parameters to your onShippingAddressChange function:
data parameter: This contains the consumer’s selected address with fields:
name, phoneNumber, address1, address2, area2, suburb, state, postcode and countryCodeaction parameter: This object is used to return your response to the Clearpay checkout. It consists of the following methods:
resolve : Call this method to provide the shipping options applicable to the consumers address. Takes an array of Shipping Option objects.reject : Call this method when you are unable to handle the request. Do not throw an error, instead call this method with a Shipping Constant as the first argument to indicate a status, e.g.:To indicate a number of error scenarios, actions.reject() may be invoked with a provided constant.
These are of the form AfterPay.constants.<NAME>, where <NAME> is one of:
Clearpay Express Checkout does not perform any arithmetic. It is the responsibility of your web app to calculate the correct total. Each shipping option must have a total order amount including taxes and shipping.
The onShippingOptionChange callback allows a merchant to track the user’s chosen shipping option as it changes. It is optional, and will be called each time a user selects a shipping option. This function is passed one argument: data
data parameter (object): This contains the consumer’s selected shipping option, as provided in the response from onShippingAddressChange, with fields:
To facilitate handling of logging/warning/error messages, AfterPay.onMessage can optionally be replaced with a custom function. The default function is:
When the Express Checkout is complete, you may either call the Auth endpoint immediately or continue checkout on your review page. If you are authorizing (or capturing) payment immediately, set the buyNow flag to true - this shows the user a “Buy Now” button at the end of their Clearpay journey.

The Express Checkout experience can be tailored for Click & Collect and other pickup flows by following these steps:
shipping body parameter — e.ginitializeForPopupDepending on your configuration, your frontend may have already invoked initializeForPopup before knowing whether the user will opt for pickup.
It is safe to invoke initializeForPopup multiple times; each call will overwrite the previous settings. In this case you may choose to call initializeForPopup in response to the user selecting a pickup option.