Searches the pickup points of a shipping option that delivers to one, for the buyer to choose at checkout. Accessible via lynkow.pickupPoints; store the choice with lynkow.cart.update({ pickupPointId }).

Requires a publishable key: pass publishableKey to createClient(), or every call throws LynkowError UNAUTHORIZED. With cache: true, responses are cached for 5 minutes.

Access via: lynkow.pickupPoints

Methods

1 method

TypeScript
search(options: PickupPointSearchOptions): Promise<PickupPointList>

Lists the pickup points near a postcode, or near coordinates, for a shipping option that delivers to a pickup point. Nearest first, not paginated. Send countryCode with either postalCode or both latitude and longitude.

Parameter

Type

Description

options

PickupPointSearchOptions

PickupPointSearchOptions: the required shippingOptionId and countryCode, the place, limit and fetchOptions.

Returns: Promise<PickupPointList>

TypeScript
const { data: points } = await lynkow.pickupPoints.search({
  shippingOptionId: option.id,
  countryCode: 'FR',
  latitude: 48.8566,
  longitude: 2.3522,
  limit: 5,
})

// Show the points, then store the buyer's choice on the cart.
const chosen = points[0]
if (chosen) {
  await lynkow.cart.update({ pickupPointId: chosen.id })
}