Reads an order from the access token of a guest order link, with no buyer session. Accessible via lynkow.orders; requires publishableKey. A signed-in buyer reads their orders with lynkow.customers.orders() and lynkow.customers.order(id).

Access via: lynkow.orders

Methods

1 method

getGuest

TypeScript
getGuest(token: string): Promise<Order>

Fetches the order a guest order link points to. The token travels in a header, without the customer session, and alone grants access to the order and its address: keep it out of logs and of URLs you build. The order may be 'cancelled'. Throws LynkowError NOT_FOUND (apiCode ORDER_NOT_FOUND) for an unknown or revoked token, or when the site does not offer order history, and VALIDATION_ERROR for an empty token or one over 128 characters.

Parameter

Type

Description

token

string

The access token from the guest order link, exactly as received.

Returns: Promise<Order>

TypeScript
try {
  const order = await lynkow.orders.getGuest(tokenFromTheUrl)
  renderOrder(order)
} catch (err) {
  if (isLynkowError(err) && err.status === 404) {
    // The link is no longer valid: show a "link expired" page.
  }
}