Skip to main content
The service point picker is a Sendcloud-hosted interface that lets customers choose a service point during checkout. You add it to your checkout page with a small JavaScript snippet, and it opens as an overlay showing nearby service points on a map and in a list. The picker handles the service point search and selection interface for you. It finds and displays available service points, then returns the customer’s selection to your checkout through a JavaScript callback. This guide is for custom-built checkouts that integrate directly with Sendcloud. If you use one of our plug-and-play integrations, service point selection is already part of the integration.
Service point picker widget
You can try the picker and its configuration options in our interactive example. The example is a single HTML page, so you can view its source and use it as a starting point.
If you need more control over your service point integration, build it around Service Points API v3 instead.

Before you start

The picker uses the carriers enabled for service point delivery in your integration settings. Enable service point delivery and the carriers you want to offer before you start:
  1. In the Sendcloud platform, go to your integration settings
  2. Find your API integration and click Configure
  3. Enable service point delivery
  4. Enable the carriers you want to use for service point delivery and save your changes
You also need the public key of the same integration. You can find it on the integration settings page. See How to create your API keys.
The picker authenticates with the integration public key, which is safe to expose in client-side code. Keep the integration secret key private.

Add the picker script

Add the picker script to your checkout page:
Example: loading the picker script
Once loaded, the script makes sendcloud.servicePoints available to your page. The next section explains how to use this object to display the picker and control its behavior.
If your checkout enforces a Content Security Policy, allow https://embed.sendcloud.sc in both script-src, for the picker script, and frame-src, for the picker overlay itself, which is an iframe served from that origin.

Display the picker

Use sendcloud.servicePoints.open() to display the picker. It takes three arguments:
open() method signature

Configuration options

The carriers option only filters the carriers enabled for service point delivery in your integration settings.
If you already have an address to center the initial search on, pass it using postalCode, city, and address1. The picker then opens near that address instead of requiring the customer to search for it again.

Handle the selection

When the customer selects a service point, the picker checks that it is still available before completing the selection. If the service point is available, the picker closes and calls your success callback with two arguments:

Service point fields

The servicePoint argument contains the selected service point details:
Example: selected service point
The service point object returned in the callback uses a different structure than Service Points API v3 response.
Store the selected service point’s Sendcloud id with the order. If the picker returns a post number, store that as well. You’ll need these values when you create the shipment.

Handle failures

The failure callback receives a single argument, errors, which is an array of strings. Configuration problems can be reported together, so the array may contain more than one value. The failure callback can return values such as: Closed is the only value you should handle as a separate case. It represents normal customer behavior rather than an error. Treat other values as errors to log or report without assuming the list above is exhaustive. Errors handled inside the picker are not passed to your failure callback. For example, if the selected service point is no longer available, a search fails, or a required post number is missing, the picker handles the problem in its own interface and remains open.

Close the picker

The customer can close the picker with its close button or by pressing Esc. Both call your failure callback with ['Closed']. See Handle failures for how to handle this case. You can also close the picker from your code, for example when the customer returns to an earlier checkout step:
Example: closing the picker from your code
Calling close() from your code does not trigger the success or failure callback.

Example integration

The following example puts the pieces together. Replace the public key with the one from your integration settings.
Example: minimal service point picker integration

Next step

Once you have stored the selected service point id and any post number returned by the picker, continue with creating the shipment.

Create a shipment with service point delivery

Use the selected service point to find a compatible shipping option, then create and announce the shipment.