Storeware Docs

Delivery rates

Offer delivery choices at checkout.

import { ... } from '@storeware/plugin-sdk';

verifyRatesRequest

Verifies a delivery-rate request and returns the basket it asks about.

function verifyRatesRequest(options: VerifyWebhookOptions): Promise<DeliveryRatesRequest>

DeliveryRatesRequest

What Storeware posts to your [checkout.delivery_rates] url for a basket with a delivery address, to ask what you would charge to deliver it.

NameTypeDescription
storeIdstring
currencystringISO 4217, upper case. Your amounts are read in it.
destination{ /** ISO 3166-1 alpha-2. */ country: string; region: string | null; postalCode: string | null; city: string | null; }
lines{ variantId: string; sku: string | null; title: string; quantity: number; /** Per unit. */ unitPrice: number; /** Per unit, or null when the merchant has not weighed it. */ grams: number | null; }[]Only the lines that are delivered: a download is left out.
subtotalnumberThe goods, after any discount on them, before delivery and tax.

DeliveryRate

type DeliveryRate = z.infer<typeof deliveryRate>;

DeliveryRatesAnswer

type DeliveryRatesAnswer = z.infer<typeof deliveryRatesAnswer>;

deliveryRate

One rate you offer. id is yours and stable: a shopper's choice is kept by it while the basket changes, as long as you keep answering with it.

const deliveryRate: z.ZodObject<{ id: z.ZodString; name: z.ZodString; amount: z.ZodNumber; description: z.ZodOptional<z.ZodString>; min_days: z.ZodOptional<z.ZodNumber>; max_days: z.ZodOptional<z.ZodNumber>; }, z.core.$strip>

deliveryRatesAnswer

The answer Storeware reads: up to 20 rates. An empty list is a fine answer and means you do not deliver this basket.

const deliveryRatesAnswer: z.ZodObject<{ rates: z.ZodArray<z.ZodObject<{ id: z.ZodString; name: z.ZodString; amount: z.ZodNumber; description: z.ZodOptional<z.ZodString>; min_days: z.ZodOptional<z.ZodNumber>; max_days: z.ZodOptional<z.ZodNumber>; }, z.core.$strip>>; }, z.core.$strip>

On this page