The Checkout SDK and Server-to-Server (S2S) Checkout V3 APIs have been updated to support Buy Online, Pick up in Store experiences.
When building a Buy Online, Pick up in Store solution, you can allow shoppers to find available pickup options and create checkout consignments that are fulfilled by a pickup method.
As a developer, you may wonder which to choose and when to use the SDK vs the API. If you’re developing:
If you’re dependent on webhook events, all existing Cart webhooks have been updated to support Buy Online, Pick up in Store.
To support Buy Online, Pick up in Store, we would be adding a loadPickupOptions method to the CheckoutService class, allowing you to load pickup options to your storefront checkout. In order to fetch pickup options using the Checkout SDK, you will need to be on SDK version 1.224.0 or above. This applies to existing custom checkouts, as well as new custom checkouts.
You can show pickup method options to customers on a storefront page, such as the Product Detail Page, before having a consignment. For more information, see 4.2.2 Find available pickup methods with stock available.
To create a cart, send a request to the Create a cart endpoint.
For a successfully-created cart, the response will have:
76f1bfe4-dbbe-4018-8ee6-2e3c36bf1518.67642f07-49d1-4501-8b7d-2e589aec34b8.Cart ID is the same as Checkout ID and both represent the same identifier for a cart depending on which API is being consumed: the Cart API uses cart ID and the Checkout API uses Checkout ID.
To find available pickup options, send a request to the Find available pickup options endpoint.
To create the pickup consignment for the checkout, send a request to the Add consignment to checkout endpoint.
From the response we can see the consignment object now has a selected_pickup_option set with the pickup_method_id that you requested.
Currently, Buy Online, Pick up in Store only supports 1 consignment of type Pickup. If you attempt to mix pickup and shipping consignments or create multiple pickup consignments, you will receive an error message.
If you have a change of mind, and you want to change it from pickup to be shipped, then you will need to update the consignment. To update a consignment, send a request to the Update checkout consignment endpoint.
The available_shipping_options is returned if we add the include=consignments.available_shipping_options to the request.
This allows us to select a shipping option as described in the next request:
We can see in the response above the selected_shipping_option contains the shipping method selected, and there is no longer a pickup object.
If you want to update the consignment from shipping to pickup or select another pickup method, you can edit the consignment and send a new pickup method ID. The pickup method ID is retrieved from the api call to the pickup endpoint earlier.
To finalize an order, send a request to the Finalize an order endpoint.
The order ID is 126.