Back to Arky

Packages

Packages and what they hold: priced items and their prices, automatic items, access rows, offerings, members, revisions, renewals and member changes

A package is a set of things you can buy, get or rent. It’s open to people, or they belong to it. There is no package type: a shop is a package with priced items and everything else empty, a price list is a package only some buyers can reach, and a club is a package whose members get automatic items. One record can be all of these. The Packages guide explains the idea in plain words; this page is the reference.

  • A package item is one thing in a package. A priced item lists a product, a booking service or a package in one market, with its prices inside it: the buyer chooses it and pays. A package’s item, a plan, holds exactly one price. An automatic item (get_product or rent_product) comes with joining, has no price of its own and freezes in the member’s terms.
  • A package access row says who may use a package, in which channels, and whether they browse, see prices or buy.
  • A package offering is a family of plans, such as Basic and Premium: a member holds one plan of it at a time and moves between them.
  • A package member is one customer, company or company location in one package. Members join by buying the package through a priced item, or the team assigns them.
  • A member revision holds, in full, the terms a member accepted when it ordered, and each later change with its kind.

Access rows, promotions, shipping rates and broadcasts name a package or a whole offering, so one rule covers every member of it.

A store might have these packages:

PackagePriced itemsAutomatic itemsWho uses it
publicits products at retail prices, and club at €9 a monthnoneeveryone, through its access row
wholesaleits products at wholesale pricesnoneone company, through its access row
clubthe club’s products at club pricesa gift every montha person who bought it in public

A cart shops in one package in one market, and Arky never merges packages or picks the cheapest. When that person orders for their company’s location, the site names wholesale. When they order for themselves at retail prices, it names public, and at club prices it names club, where a member has buy without an access row. Money off for club members in public is a promotion with a package condition naming club.

Packages

import type { Block, EpochMilliseconds, PackageStayEnd } from "arky-sdk";

type Cadence = { interval: "day" | "week" | "month" | "year"; interval_count: number };

interface Package {
	id: string;
	store_id: string;
	key: string;
	blocks: Block[];
	renewal:
		| { type: "never" }
		| {
				type: "every";
				agreed: {
					cadence: Cadence;
					on_exhaustion: { type: "pause" } | { type: "cancel" };
					unpaid_order: { type: "retain_debt" } | { type: "cancel_unfulfilled" };
				};
				timing: {
					retry_offsets_seconds: number[];
					recovery_window_seconds: number;
					reminder: { type: "none" } | { type: "days_before"; days: number };
				};
		  };
	stay: { type: "any_time" } | { type: "at_least"; length: Cadence; then: PackageStayEnd };
	minimum:
		| { type: "none" }
		| {
				type: "per_month";
				quantity: number;
				counts:
					| { type: "category"; category_id: string }
					| { type: "variants"; variant_ids: string[] };
				scope: { type: "per_location" } | { type: "company_wide" };
		  };
	schedule:
		| { type: "always" }
		| { type: "scheduled"; starts_at: EpochMilliseconds; ends_at: EpochMilliseconds | null };
	status:
		| { type: "draft" }
		| { type: "active" }
		| { type: "closed" }
		| { type: "archived" }
		| { type: "deleting" };
	created_at: EpochMilliseconds;
	updated_at: EpochMilliseconds;
}
POST /v1/stores/{store_id}/packages
SDK: sdk.eshop.package.create()
GET /v1/stores/{store_id}/packages
SDK: sdk.eshop.package.find()
GET /v1/stores/{store_id}/packages/purchasable
SDK: sdk.eshop.package.findPurchasable()
GET /v1/stores/{store_id}/packages/by-key/{key}
SDK: sdk.eshop.package.getByKey()
GET /v1/stores/{store_id}/packages/{id}
SDK: sdk.eshop.package.get()
PUT /v1/stores/{store_id}/packages/{id}
SDK: sdk.eshop.package.update()
DELETE /v1/stores/{store_id}/packages/{id}?expected_updated_at=
SDK: sdk.eshop.package.delete()
const club = await sdk.eshop.package.create({
	store_id: storeId,
	id: crypto.randomUUID(),
	key: "club",
	blocks: [],
	renewal: {
		type: "every",
		agreed: {
			cadence: { interval: "month", interval_count: 1 },
			on_exhaustion: { type: "pause" },
			unpaid_order: { type: "retain_debt" },
		},
		timing: {
			retry_offsets_seconds: [3600, 86400],
			recovery_window_seconds: 604800,
			reminder: { type: "days_before", days: 3 },
		},
	},
	stay: { type: "any_time" },
	minimum: { type: "none" },
	schedule: { type: "always" },
	status: { type: "active" },
	items: [
		{
			action: "create",
			id: crypto.randomUUID(),
			type: {
				type: "get_product",
				variant_ids: [giftVariantId],
				quantity: 1,
				delivery: { type: "once_per_period", offset_days: 0, window_days: 3 },
				allocation_weight: 1,
			},
		},
	],
});
  • Renewal: never, or every with what’s agreed and its live timing. agreed is the cadence, on_exhaustion and unpaid_order: with stay and minimum, each member keeps it as accepted. timing is retry_offsets_seconds, recovery_window_seconds and reminder: every renewal reads it from the live package, so an edit reaches existing members. A package’s renewal kind can’t change while it has members who aren’t cancelled (409 PACKAGE.RENEWAL_TYPE_FIXED).

  • Stay: any_time, or at_least a length, with then saying what happens when that block ends. It works on any package and charges no fee of its own.

    • On an every package length is a whole number of cadences in the same unit family, days and weeks or months and years (409 PACKAGE.STAY_LENGTH), so a block is a number of periods counted from the first. renew commits the next block, renew_once commits one more block and then stops, continue_without_stay renews without a stay and stop renews no more. Inside a started block the customer’s cancel ends renewals at the block’s end, the customer can’t pause, and nobody skips a committed period (409 PACKAGE_MEMBER.IN_STAY).
    • On a never package blocks count from the first revision, by calendar steps of length in the schedule’s timezone, and a move doesn’t restart them. stop sets the member’s access_end at the first block’s end and renew_once at the second’s; renew and continue_without_stay set none. Inside a started block the customer’s cancel sets access_end to that block’s end, under renew in every block and under continue_without_stay in the first.
    • The team can cancel or pause at once. An assigned member has no accepted terms, so a stay doesn’t bind it.
  • Automatic items are saved with their package. create and update take the package’s fields and items, a list of operations: { action: "create", id, type }, { action: "update", id, expected_updated_at, type } and { action: "delete", id, expected_updated_at }. It is one all-or-nothing save, so a swap of one machine for another never reaches a join half done, and automatic items change no other way. A package holds at most 100 of them (409 PACKAGE_ITEM.AUTOMATIC_LIMIT). An every package may have none only while draft: activating it, or removing the last one once it has left draft, is refused (409 PACKAGE.EVERY_NEEDS_ITEM). Each has an allocation_weight that splits a paid package’s price across its automatic items:

    • get_product: 1 to 100 variants of one fulfillment kind and, when physical, one shipping profile (409 PACKAGE_ITEM.VARIANTS_MIXED), with a quantity. With several, the buyer picks one at checkout, and the member’s terms keep only the variant it gets; a later change of choice picks from the variants the live item lists then. delivery is none (never delivered: services, digital variants and an item that only carries a fee), once_per_period in one window per period, or repeating_in_period on its own cadence inside an every period, with count per_period (spread over the windows) or per_delivery. Repeating windows count from the period’s start, except that month and year steps in a month- or year-based package follow the member’s billing day, so an N-month plan with monthly deliveries always gets N windows. Saving is refused when a schedule would open no window in a period, let a window cross the period’s end or give per_period fewer units than windows (409 PACKAGE.DELIVERY_WINDOW), or hold more than 100 deliveries in its longest period (409 PACKAGE.DELIVERY_LIMIT).
    • rent_product: a variant on loan, with its quantity and tax category.
  • A purchase names a quantity. It multiplies the package’s price and every get_product and rent_product quantity. A package with no automatic items, or with a digital get_product, takes quantity 1 (409 PACKAGE.QUANTITY_ONE).

  • A package with no automatic items is free: it is priced zero everywhere it is listed, and saving a price above zero is refused (409 PACKAGE.FREE_PACKAGE_PRICED). A package priced above zero needs at least one automatic item, which carries its price; a paid club whose members get nothing shipped, such as one whose only benefit is its club prices, carries its price on a never-delivered get_product. A newsletter is a free package; see Newsletters.

  • Minimum: none, or per_month with a quantity, what it counts and a scope. counts is one category, where a line matches that exact category and not its children, or variants, a hand-picked list of up to 100 variant_ids, each a current physical variant of the store whose measure counts (409 PACKAGE.MINIMUM_NOT_PHYSICAL and 409 PACKAGE.MINIMUM_NOT_COUNTED otherwise, checked for the variants a save adds). Both count each unit by the measure its order line froze, so a variant counts in the same unit for every package that counts it. It is counted each calendar month per_location or company_wide, from delivered physical lines, and binds members who ordered, never assigned ones. A shortfall is only reported: it never charges, blocks or ships anything. A month needs attention while its delivered units, less returns, stay below 80% of the minimum.

  • Tax. Every line and delivery a package generates is taxed like any other order line, by its own tax category at its own place. A rent_product takes its tax category from the live item at each renewal.

  • Status and schedule stop different things, because one record has both jobs:

    StatusJoiningShopExisting members
    draftNoClosedNone allowed (409 PACKAGE.DRAFT_HAS_MEMBERS)
    activeYesOpenCount and renew
    closedNo, and no move inOpen to anyone with a levelCount and renew
    archivedNo, and hidden from pickersClosedCount and renew
    deletingNoHiddenNone possible

    schedule is { type: "always" } or { type: "scheduled", starts_at, ends_at }. A save that names only an end, with starts_at: null, starts at the save’s own time. Outside its schedule a package takes no joins and no shopping, while its members keep counting and renewing. A store that wants a join window and a shop that outlasts it uses two packages.

  • Opening and selling. A read or a purchase naming a package that isn’t open is refused with 409 PACKAGE.CLOSED. A purchase or move enters a package only while it is active and inside its schedule (409 PACKAGE.NOT_ON_SALE). The team’s assignment needs only an active package (409 PACKAGE.NOT_ACTIVE).

  • Keys are unique in the store and never change (409 PACKAGE.KEY_TAKEN), with one namespace for every package. A store holds at most 2,000 packages (409 PACKAGE.LIMIT). A new store has one, keyed public; that key means nothing special afterwards.

  • The plan counts a package while it holds an automatic item and isn’t archived, so a price list or a newsletter uses none of the plan’s packages limit. 402 STORE.USAGE_LIMIT_EXCEEDED comes from whichever save makes a package count.

  • Deleting is refused while a member, a revision, a live cart, an order, a promotion, a broadcast, a shipping rate, an offering, another package’s item or another package’s access row names it. Otherwise it marks the package deleting and cleans its own items and access rows in batches, even ones that name the package itself. A package that had members is closed or archived instead.

  • Lists. find lists packages with their package_offering_id, automatic_item_count and market_ids, by text, key, status, offering and creation time, and with market_id those usable in that market. get and getByKey also answer items, the automatic items in order. findPurchasable lists what one customer may buy from in a market and channel, for staff building a cart.

Priced Items And Prices

POST /v1/stores/{store_id}/package-items
SDK: sdk.eshop.packageItem.create()
GET /v1/stores/{store_id}/package-items
SDK: sdk.eshop.packageItem.find()
GET /v1/stores/{store_id}/package-items/{id}
SDK: sdk.eshop.packageItem.get()
PUT /v1/stores/{store_id}/package-items/{id}
SDK: sdk.eshop.packageItem.update()
DELETE /v1/stores/{store_id}/package-items/{id}?expected_updated_at=
SDK: sdk.eshop.packageItem.delete()
POST /v1/stores/{store_id}/package-items/batch
SDK: sdk.eshop.packageItem.batch()
POST /v1/stores/{store_id}/package-items/{id}/prices/all
SDK: sdk.eshop.packageItem.setAllPrices()
POST /v1/stores/{store_id}/package-item-prices
SDK: sdk.eshop.packageItemPrice.create()
GET /v1/stores/{store_id}/package-item-prices
SDK: sdk.eshop.packageItemPrice.find()
GET /v1/stores/{store_id}/package-item-prices/by-choice
SDK: sdk.eshop.packageItemPrice.getByChoice()
GET /v1/stores/{store_id}/package-item-prices/{id}
SDK: sdk.eshop.packageItemPrice.get()
PUT /v1/stores/{store_id}/package-item-prices/{id}
SDK: sdk.eshop.packageItemPrice.update()
DELETE /v1/stores/{store_id}/package-item-prices/{id}?expected_updated_at=
SDK: sdk.eshop.packageItemPrice.delete()
POST /v1/stores/{store_id}/package-item-prices/batch
SDK: sdk.eshop.packageItemPrice.batch()
import { epochMilliseconds } from "arky-sdk/utils";

const partners = await sdk.eshop.package.create({
	store_id: storeId,
	id: crypto.randomUUID(),
	key: "trade-partners",
	blocks: [],
	renewal: { type: "never" },
	stay: { type: "any_time" },
	minimum: { type: "none" },
	schedule: { type: "always" },
	status: { type: "active" },
	items: [],
});

const shirtInPartners = await sdk.eshop.packageItem.create({
	store_id: storeId,
	id: crypto.randomUUID(),
	package_id: partners.id,
	market_id: croatiaMarket.id,
	item: { type: "product", product_id: product.id },
});

await sdk.eshop.packageItemPrice.create({
	store_id: storeId,
	id: crypto.randomUUID(),
	package_item_id: shirtInPartners.id,
	sellable: { type: "product_variant", variant_id: variant.id },
	amount: 2100,
	compare_at: { type: "none" },
	changes: [{ starts_at: epochMilliseconds(Date.UTC(2027, 0, 1)), amount: 2400, compare_at: { type: "none" } }],
	schedule: { type: "always" },
	status: { type: "active" },
});
  • One item per thing listed, per market. A priced item lists a product, a booking_service or a package once per package and market (409 PACKAGE_ITEM.ALREADY_LISTED), with all that thing’s prices inside it. A market fixes the item’s currency, and one package can sell in several markets by pricing an item in each. A new item goes after the package’s last one (409 PACKAGE_ITEM.POSITION_EXHAUSTED when no later position is left), and update changes only its position, which orders what buyers see. An item’s package, market and parent never change. find reads a package’s priced items in position order, for all its markets or for one; with item and market_id it answers the one item of that parent.
  • A price prices one choice of its item, and the item holds it under that choice: a product item’s prices are { variant_id, price }, one for each variant of the listed product it sells, and a booking_service item’s are { booking_offering_id, price }, one for each offering of the listed service. A variant_id of another product or a booking_offering_id of another service is refused (409 PACKAGE_ITEM_PRICE.WRONG_CHOICE). The price calls name the choice as sellable: a price’s create, packageItemPrice.find, getByChoice and every price answer. An item holds one price per choice, archived ones included (409 PACKAGE_ITEM_PRICE.ALREADY_EXISTS; restore an archived one instead), and at most 100 prices (409 PACKAGE_ITEM.PRICE_LIMIT). So a product holds at most 100 variants (409 PRODUCT_VARIANT.LIMIT) and a booking service at most 100 offerings (409 BOOKING_OFFERING.LIMIT).
  • A plan’s item holds exactly one price. A package item, { type: "package", market_id, package_id, price }, sells the listed package at its one price. Listing a plan is one create with its price, zero when the plan is free: item: { type: "package", package_id, price: { id, amount, compare_at, changes, schedule, status } }, with a price id the app picks, in create and in a batch. It posts package_item.created and then package_item_price.created, so no plan ever has no price. The item takes no second price (409 PACKAGE_ITEM_PRICE.ALREADY_EXISTS), and its price is never deleted on its own, in a batch either (409 PACKAGE_ITEM_PRICE.REQUIRED): archive the price or remove the item. Editing the price, setAllPrices and removing the item work as for any item.
  • A price has one amount at a time, in minor units of the market’s currency, where 0 is a real price, a compare_at ({ type: "none" } or { type: "amount", amount }, never below the price), and its own schedule and status. There are no quantity tiers: quantity discounts are promotions.
  • An item is on sale while one of its prices is active and in its schedule; it has no status or schedule of its own. A line naming an item with no price in force is refused with 409 PACKAGE.ITEM_NOT_LISTED. setAllPrices archives or schedules all an item’s prices at once, applying started dated changes first. It forgets which were already archived, and a blanket schedule overwrites each price’s own, so bringing a product back means choosing which prices to reactivate.
  • Named operations only. Prices change by create, update with that price’s own updated_at, delete, batch and setAllPrices, never by sending an item’s whole list, so editing one price never gets a false stale error from another. A price answer carries package_item_updated_at, the item’s new version, so a later reorder gives no false stale error either.
  • Dated changes. A price holds up to 20 changes, each { starts_at, amount, compare_at }, in strictly increasing order and starting after the save that adds them (409 PACKAGE_ITEM_PRICE.CHANGE_NOT_AHEAD, CHANGE_ORDER, CHANGE_LIMIT). Every save of a price sends its whole list of changes, on its own or in a batch. A moment after each start Arky applies the item’s started changes in one save: the price takes its amount and comparison, the change leaves the list, the version moves and package_item_price.updated posts. Quotes and checkout always read the stored amount. While a started change waits to be applied an edit is refused (409 PACKAGE_ITEM_PRICE.CHANGE_DUE), and an edit made with the version from before it is stale, so a form read before the start can’t undo it. A timed sale is a change with a compare_at, followed by a change back.
  • Reading prices. A product or booking service item with no price yet is saved but shows nothing to buyers and sells nothing, so give every item its prices. packageItemPrice.find pages one item’s prices by package_item_id, in creation order, or one choice’s by sellable, and answers { items, cursor } from Arky’s own records. getByChoice reads one item’s price for one choice exactly, archived or not, or answers 404 when that choice has no price; decide between creating and editing a price with it.
  • Deleting a price removes the cart lines that name it from active and abandoned carts (an expired cart keeps its lines only as history and never holds a delete up), and is refused while an order line, a member’s terms or a sent offer names it (409 REFERENCE.STILL_REFERENCED), or while more open cart lines name it than one delete may clear (409 PACKAGE_ITEM_PRICE.CART_LIMIT); archive it instead. Deleting an item removes its prices with it, checking each one the same way and posting one package_item_price.deleted per price.
  • Batches. A batch holds at most 1,000 operations and reads and saves each item once, whichever operations touch it. It is refused when it would rewrite more than 8 MiB (409 PACKAGE.BATCH_BYTES).

Access

POST /v1/stores/{store_id}/package-accesses
SDK: sdk.eshop.packageAccess.create()
GET /v1/stores/{store_id}/package-accesses
SDK: sdk.eshop.packageAccess.find()
DELETE /v1/stores/{store_id}/package-accesses/{id}
SDK: sdk.eshop.packageAccess.delete()
await sdk.eshop.packageAccess.create({
	store_id: storeId,
	id: crypto.randomUUID(),
	package_id: wholesale.id,
	audience: { type: "all_companies" },
	channels: { type: "only", sales_channel_ids: [b2bChannel.id] },
	level: { type: "buy" },
});
  • Audiences are everyone, a package, a package_offering (members of any of its packages), a customer (verified only, 409 PACKAGE_ACCESS.CUSTOMER_NOT_VERIFIED), all_companies, a company or a company_location. Channels are all or only some. Levels are browse, see_prices and buy. A buyer’s level is the highest of the rows that match them there; with none, the package is closed to them.
  • A row is created or deleted, never edited, so it keeps only its created_at and has no version: delete names just { store_id, id }. find lists a package’s rows by created_at, newest first unless sort_direction is asc. A customer merge that changes a row deletes it and creates its replacement under a new id, so a later delete that names the old id finds nothing and leaves the replacement in place. An audience appears once per package (409 PACKAGE_ACCESS.AUDIENCE_TAKEN), a package holds at most 1,000 rows (409 PACKAGE_ACCESS.LIMIT), and a row lists at most 100 channels.
  • A member has buy on its own package without a row, in every channel, while that package is open. A row whose audience is the package itself replaces this for its members: its level and channels are what they get, so a members-only list for one channel and a see_prices teaser are both possible. To share a package’s prices with another package’s members, a row names that package or its offering.
  • Rows and status span all of a package’s markets. An audience limited to one market, or a shop closed in one market only, needs one package per market, or archiving that market’s prices.
  • A package is usable in a market when it has an item priced there, or when it has no priced items at all. arky.eshop.package.find lists the open packages usable in the request’s market where the buyer has any level, from access rows and the packages that count for them. A read in a market with nothing priced answers an empty page, not a refusal.

Copying

POST /v1/stores/{store_id}/packages/{id}/copy
SDK: sdk.eshop.package.copy()

There is no base package: a negotiated price is a company’s own copied package. copy adds another package’s priced items of one market, in position order, with their prices, into this one under a market the request names.

import type { PackageCopyResult } from "arky-sdk";

const shop = await sdk.eshop.package.getByKey({ store_id: storeId, key: "public" });

let cursor: string | null = null;
do {
	const step: PackageCopyResult = await sdk.eshop.package.copy({
		store_id: storeId,
		id: wholesale.id,
		source_package_id: shop.id,
		source_market_id: market.id,
		target_market_id: market.id,
		cursor,
	});
	cursor = step.cursor;
} while (cursor !== null);
  • Both markets need the same currency (409 PACKAGE.COPY_CURRENCY) and tax mode (409 PACKAGE.COPY_TAX_MODE). They may be the same market, and one package may be source and target when they differ, which is how a package copies its prices to a new market.
  • Each request copies a bounded part and answers items_created, items_kept, items_skipped, prices_created, prices_kept, prices_skipped and a cursor to send with the next request until it is null.
  • It keeps what the target already has for the same parent or choice in that market, so it can run again and creates nothing new, skips what can no longer be admitted, and never copies access rows. A copied price keeps its amounts with every started dated change applied, its dated changes still ahead, its schedule and its status. A plan’s package item and its one price are copied or skipped together: when the price can no longer be admitted, such as an archived price above zero for a plan that is now free, the plan counts as one skipped item.

Offerings

POST /v1/stores/{store_id}/package-offerings
SDK: sdk.eshop.packageOffering.create()
GET /v1/stores/{store_id}/package-offerings
SDK: sdk.eshop.packageOffering.find()
GET /v1/stores/{store_id}/package-offerings/by-key/{key}
SDK: sdk.eshop.packageOffering.getByKey()
PUT /v1/stores/{store_id}/package-offerings/{id}
SDK: sdk.eshop.packageOffering.update()
DELETE /v1/stores/{store_id}/package-offerings/{id}?expected_updated_at=
SDK: sdk.eshop.packageOffering.delete()
const memberships = await sdk.eshop.packageOffering.create({
	store_id: storeId,
	id: crypto.randomUUID(),
	key: "memberships",
	blocks: [],
	package_ids: [basic.id, premium.id],
});

An offering is a family of plans: { id, store_id, key, blocks, package_ids, created_at, updated_at }. Its key is unique in the store (409 PACKAGE_OFFERING.KEY_TAKEN). A store holds at most 200 offerings (409 PACKAGE_OFFERING.LIMIT), and an offering lists at most 100 packages.

  • A package is listed by at most one offering (409 PACKAGE_OFFERING.PACKAGE_TAKEN). Packages that need no neighbours, such as a VIP list, need no offering.
  • One package per offering at a time. A customer, company or location holds at most one member that isn’t cancelled per package and per offering. Adding a package to an offering is refused while someone already holds a member in it and in another package of the offering; Arky never cancels one of them on its own.
  • A member can move to any other package of its offering (see Moving).
  • An offering is never an item, and has no status. Adding a package to an offering publishes it nowhere: each plan is sold by its own package item, with its one price, in each package that lists it, and each plan sells, takes joins and moves, and stops under its own status and schedule. A storefront groups the plans it sells by their offering (see Joining By Buying).
  • Deleting an offering leaves its packages and their members, who keep counting and renewing and lose only the moves it gave them; it is refused while anything else names it: an access row, a promotion, a shipping rate or a broadcast.

Joining By Buying

A buyer can buy a package only through a package they may buy from that lists it: a package item that holds the package’s one price, listed together with that price. A plan is sold only by its own item, so one package lists a plan at one price at a time.

const shop = await sdk.eshop.package.getByKey({ store_id: storeId, key: "public" });

await sdk.eshop.packageItem.create({
	store_id: storeId,
	id: crypto.randomUUID(),
	package_id: shop.id,
	market_id: market.id,
	item: {
		type: "package",
		package_id: club.id,
		price: {
			id: crypto.randomUUID(),
			amount: 900,
			compare_at: { type: "none" },
			changes: [],
			schedule: { type: "always" },
			status: { type: "active" },
		},
	},
});
GET /v1/storefront/packages/{identifier}
SDK: arky.eshop.package.get()
GET /v1/storefront/packages/{identifier}/product-choices/{package_item_id}
SDK: arky.eshop.package.getProductChoices()
GET /v1/storefront/package-offerings/{identifier}
SDK: arky.eshop.packageOffering.get()
POST /v1/storefront/carts/{id}/package-items
SDK: arky.eshop.cart(scope).addPackage()

Storefronts find plans with the package search (types: ["package"]), read one like a product, read its one price with packageItem.findPrices, and add it to the cart as a package line with the exact price it is bought at. Its line id comes from the app’s createId unless you pass one. A page that shows a family of plans groups them by their package_offering_id and reads the offering:

const plan = await arky.eshop.package.getByKey({ key: "basic", package_id: shopPackage.id });
const { items: planPrices } = await arky.eshop.packageItem.findPrices({
	package_item_id: plan.package_item_id,
	package_id: shopPackage.id,
	include_price: true,
});
const [planPrice] = planPrices;

if (plan.package_offering_id !== null) {
	const family = await arky.eshop.packageOffering.get({
		id: plan.package_offering_id,
		package_id: shopPackage.id,
	});
	console.log(family.key, family.package_ids);
}

const cart = arky.eshop.cart({ buyer: { type: "customer" }, package_id: shopPackage.id });
if (planPrice?.price) {
	await cart.addPackage({
		package_id: plan.id,
		quantity: 1,
		choices: [],
		start: { type: "on_acceptance" },
		price: {
			package_id: planPrice.price.package_id,
			package_item_id: planPrice.price.package_item_id,
			price_id: planPrice.price.price_id,
		},
	});
}
  • Two packages in one line. The line’s package_id is the package being joined. price names the exact price as { package_id, package_item_id, price_id }, where its package_id is the package holding that price, the one the cart shops in.
  • get reads a package or an offering by { id }, and getByKey by { key }, each with the package_id of the shop it is listed in. A package read answers the package_item_id of its own package item in that shop and market, and 404 when the shop doesn’t sell it there. It also answers its renewal, stay and minimum, its automatic items in order as { id, type }, rental_products, the lent product of each rent_product item, or null once it no longer exists, and package_offering_id, the offering it belongs to or null. An offering read answers its id, key, blocks and package_ids: the plans of it that the shop sells in the current market, in the offering’s order, and 404 when the shop sells none. A plan’s search answer names its one price as price_id.
  • choices names one variant for each get_product item that lists several, and the member’s terms keep only the variant it gets; arky.eshop.package.getProductChoices lists them with each variant’s product_blocks and variant_blocks.
  • start is on_acceptance, scheduled with a starts_at, switch for an upgrade or a package change (below), or amend for the team’s no-charge change of a never agreement (below).
  • A package with deliveries asks for them with setFutureDeliveries, quoted first with quoteFutureDeliveries.
  • Checkout makes one order. Its package line names the new member and the revision of the terms the buyer accepted. A package line needs a verified customer: a storefront quote and every checkout refuse it otherwise with 409 CART.CUSTOMER_NOT_VERIFIED, so the buyer signs in with the email code first.
  • A paid package is paid by card at checkout. A cart with a package line that charges money or saves a card lists only card options in its quote’s payment_option_ids, and is never paid by cash on delivery or a manual option (409 CART.CARD_REQUIRED) or put on account (409 CART.ON_ACCOUNT_PAID_PACKAGE). This holds for a first purchase, an upgrade and a buyer’s package change. When no option the buyer may use can pay it, the quote shows a payment_unavailable blocker with the reason’s code. A store that sells a membership paid by invoice sells a product, and after payment gives the package through a zero-price order, or assigns it when the package needs no order.
  • When the terms charge again later, as a paid every package that renews or a delivery fee does, checkout saves the buyer’s card for the renewals; the package line’s saves_card in the quote says so, the quote then lists only the card options with saved-card wording in its language, and a package whose stay stops it after its first period saves none: save_payment_method: true, with the option’s saved_card_terms text the buyer accepted in payment_method_terms. Without it checkout is refused with 409 CART.CARD_REQUIRED. When the first order has nothing to pay, such as under a first-period promotion, checkout sends the payment option with save_payment_method: true, and a Stripe card is saved through a setup without a payment, which checkout answers in payment_method_setup and mountPaymentMethodSetup mounts (409 CART.NOTHING_DUE when no line saves a card). Monri saves cards only from a paid checkout, so a Monri store’s quote for that cart offers no payment option and shows payment_unavailable with CART.DEDICATED_SETUP_NEEDS_STRIPE.
  • The member is awaiting_activation until that line is confirmed, then active. Its subject is the order’s buyer: the customer, the company or the company location.
  • Buying a package the subject already holds is refused, and so is buying another package of an offering whose package it holds, whatever either package’s renewal and whoever places it (409 CART.OFFERING_MEMBER): a switch line changes that member instead (see Moving). A free sign-up for a package the buyer already holds makes no order: checkout answers { type: "already_member", package_member_id } and lifts the signed-in customer’s storefront unsubscribe.
  • arky.eshop.package.joinFree({ key, package_id, language }) (or { id, package_id, language }) signs a signed-in customer with a verified email up to a free package in one call, through its own cart, with the order contact’s language you pass, normally the page language, and answers { type: "joined", order_id } or { type: "already_member", package_member_id }. package_id names the shop it is priced in. arky.newsletter.join does the same after the email code; see Newsletters.
  • For a company or location, buying a package needs the place_orders and join_packages company permissions there.

Assigning A Member

POST /v1/stores/{store_id}/package-members
SDK: sdk.eshop.packageMember.assign()
import { epochMilliseconds } from "arky-sdk/utils";

const member = await sdk.eshop.packageMember.assign({
	store_id: storeId,
	id: crypto.randomUUID(),
	package_id: wholesale.id,
	subject: { type: "company", company_id: company.id },
	access_end: { type: "at", at: epochMilliseconds(Date.UTC(2026, 11, 31)) },
});
  • The team assigns a verified customer, an active company or an active company location to an active package with no order and no price. The member starts active, its renewal is never whatever the package’s, it has no revision, card or renewal, and it gets the live package’s automatic items.
  • access_end ends the membership at that moment, such as “VIP until 31 December”; { type: "never" } keeps it until someone ends it.
  • A package that ships, lends or gives downloads, or offers a product choice, needs an order and is refused (409 PACKAGE_MEMBER.NEEDS_ORDER). The team gives it through an order at a €0 price from a package the buyer may use instead.
  • An assigned member buys at its package’s own prices like any member: in a cart of that package, where it has buy without an access row.
  • Assigning a package of an offering is refused while the subject holds a member of another package of that offering that isn’t cancelled (409 PACKAGE_MEMBER.OFFERING_MEMBER): an assignment never ends another member, so staff move or cancel that member first.
  • A retry with the same id and the same request returns the member.

Members

import type {
	Actor,
	EpochMilliseconds,
	PackageMemberBlockCause,
	PackageMemberPauseCause,
	When,
} from "arky-sdk";

interface PackageMember {
	id: string;
	store_id: string;
	package_id: string;
	subject:
		| { type: "customer"; customer_id: string }
		| { type: "company"; company_id: string }
		| { type: "company_location"; company_location_id: string };
	renewal:
		| { type: "never"; access_end: When }
		| {
				type: "every";
				next_occurrence_index: number;
				payment_method:
					| { type: "none" }
					| { type: "card"; payment_method_id: string; by: Actor; accepted_at: EpochMilliseconds };
				renewal_end: When;
		  };
	status:
		| { type: "awaiting_activation" }
		| { type: "active" }
		| { type: "blocked"; cause: PackageMemberBlockCause; blocked_at: EpochMilliseconds }
		| { type: "paused"; cause: PackageMemberPauseCause; paused_at: EpochMilliseconds }
		| { type: "cancelled"; ended_at: EpochMilliseconds };
	created_at: EpochMilliseconds;
	updated_at: EpochMilliseconds;
}
GET /v1/stores/{store_id}/package-members
SDK: sdk.eshop.packageMember.find()
GET /v1/stores/{store_id}/package-members/{id}
SDK: sdk.eshop.packageMember.get()
GET /v1/stores/{store_id}/package-members/{id}/current
SDK: sdk.eshop.packageMember.getCurrent()
GET /v1/stores/{store_id}/package-members/{id}/revisions
SDK: sdk.eshop.packageMember.findRevisions()
GET /v1/stores/{store_id}/package-members/{id}/orders
SDK: sdk.eshop.packageMember.findOrders()
GET /v1/stores/{store_id}/package-members/{id}/calendar
SDK: sdk.eshop.packageMember.getCalendar()
GET /v1/stores/{store_id}/package-members/{id}/minimum
SDK: sdk.eshop.packageMember.getMinimum()
  • Only an every member renews: its renewal holds the next period, the card renewals charge, and renewal_end, the moment renewals stop. Only a never member carries access_end. A member’s renewal kind never changes. A cancelled every member’s renewal_end reads never, and a cancelled never member’s access_end is its ended_at.
  • Only an every member can be blocked or paused. A renewal that can’t be made blocks the member with its cause: period_missed, order_unpaid, payment_method_not_ready, company_not_active, company_location_not_active, purchase_order_number_required, item_unavailable or no_tax_rule. A pause is requested, with a reason and a resumes time or { type: "never" }, or renewal_unpaid when a renewal’s retries ran out. purchase_order_number_required means the buyer now requires a purchase order number that the member’s terms don’t give: the team, or a company member with manage_company_packages, names one with changeTerms, and resume then passes.
  • find filters by customer_id, company_id (the company and its locations) or company_location_id, and by package, offering and status. getCurrent answers the revision in force with its terms, where a frozen get_product holds the one variant_id the member gets. findOrders lists the orders whose package line names the member, newest first by when their lines start, each order once, a page at a time; pass the answer’s cursor back as it is.
  • Revisions. Every revision holds its accepted terms in full: the package as accepted, the quantity, the deliveries, the billing_address and the purchase_order_number its renewals put on their orders (null for a person). Its origin is initial, or a change naming the revision before it, its reason and its kind: own_terms (an every member’s own-terms change), package_change (an every move at the next renewal, or a buyer’s never package change), upgrade (an every upgrade bought now), amend (the team’s amendment of a never agreement) or minimum (a minimum change or transfer). A revision names no order: an order’s package line names its revision.
  • When a member counts for prices, access rows, promotions and shipping rates: a member who ordered counts while a confirmed package line covers now and, for a never member, before its access_end; an assigned member counts while it is active and before its access_end. So while a renewal’s payment is retried, rules naming the package stop applying until it is paid, and a member who cancelled keeps the period it paid for.
  • Whose packages count: a person’s own when they buy for themselves; a location’s own and its company’s on orders for that location (within one offering, the location’s own package wins); a company’s own on orders for the company.
  • A rented machine maps to a new package’s terms by variant, because item ids are unique records: an offering whose plans should look alike repeats the same variants, not the same item ids.

Member Changes

Every change carries the member’s expected_updated_at, so a repeated change is refused once the first one applied. Changes that make a revision are reviewed first with the same request.

ChangeCallWho
end renewals (a customer inside a started block ends at the block’s end)cancelteam and member
end at a given momentscheduleEndteam
pause renewals, with a reason and a resumes timepauseteam and member
resume a paused or blocked member at its next safe periodresumeteam and member
skip the next periodskipNextteam and member
the card renewals chargeselectPaymentMethodteam and member
another package of the offering, from the next renewal (every) or the next month (never)reviewSwitch, then switchteam and member; only the team for a never member
a never member’s package change, when its order is confirmeda cart line with start: { type: "switch" }member
quantity, choices, deliveries, billing address or purchase order numberreviewTerms, then changeTermsteam and member
take back a future changewithdrawRevisionteam and member
a minimumreviewMinimum, then changeMinimumteam
end at once and revoke what it bought from now onrevoketeam
move a minimum between two members of one company or locationtransferMinimumteam
await sdk.eshop.packageMember.reviewSwitch({
	store_id: storeId,
	id: member.id,
	expected_updated_at: member.updated_at,
	to_package_id: basic.id,
	choices: [],
	price: {
		package_id: basicPrice.package_id,
		package_item_id: basicPrice.package_item_id,
		price_id: basicPrice.id,
	},
	deliveries: [],
	reason: "Customer asked for the smaller box",
});

await sdk.eshop.packageMember.switch({
	store_id: storeId,
	id: member.id,
	expected_updated_at: member.updated_at,
	to_package_id: basic.id,
	choices: [],
	price: {
		package_id: basicPrice.package_id,
		package_item_id: basicPrice.package_item_id,
		price_id: basicPrice.id,
	},
	deliveries: [],
	reason: "Customer asked for the smaller box",
});
  • The team’s cancel and scheduleEnd carry notify_customer. With it, an accepted cancellation of a member sends the store’s membership_cancelled email once, when that email is selected: to a person member’s current verified contact, or to the company’s contact for a company or location member. A member without a contact gets none.
  • skipNext names the period it skips. It skips only a next period that has no order yet, outside a started block and before renewal_end, and waives no debt.
  • A card belongs to the member’s subject; a card of another customer, company or location is refused. A team card selection that charges an owing renewal at once needs the payments permission as well as orders.
  • Replacing a card. A member replaces its card by saving a new one and selecting it with selectPaymentMethod: the selection charges any renewal that’s owed, and resume then restarts a blocked member. A Stripe card is saved on its own, with arky.eshop.paymentMethod.requestSetup, startSetup and completeSetup. A Monri card is saved only in a paid checkout, and that setup under a Monri option is refused with 409 PAYMENT_METHOD.DEDICATED_SETUP_NEEDS_STRIPE: the buyer of a Monri member checks out a paid order with save_payment_method: true, selects the payment_method_id it answers once its payment succeeds, and resumes. Arky has no payment page for an owed renewal order: resumePayment reopens only an order’s own checkout payment while its payment window is open.
  • changeTerms applies from the next safe period. On the storefront, arky.eshop.packageMember.getDeliveryOptions prices a changed delivery with the method’s rates first, and getProductChoices lists the variants the live item lists now, each available only when it fits the member’s accepted terms; when the live item is gone there are none, and the member keeps its variant. A company or location member’s terms carry the purchase_order_number its renewals put on their orders, and a person’s carry null: reviewTerms, changeTerms and getDeliveryOptions send it with the rest of the terms, and a new number clears a purchase_order_number_required block.
  • At most one accepted future change waits at a time; withdraw it before making another. Only a change that hasn’t started can be withdrawn. A package change waiting for its order’s payment ends only through that order. Withdrawing the team’s amendment cancels the lines of its €0 order in the same save and withdraws the rentals it opened, and ending the member before the amendment’s date does the same, so no confirmed order is left with nothing to ship.
  • The team never makes a renewal charge more. The team never makes an every member’s next renewal charge more than its accepted terms charge for that renewal. A renewal charges what its renewal order charges: the package price times the quantity, plus each delivery’s fee once for each of its windows in that renewal, and once for a delivery with no window there, such as one that only lends, when that renewal ships newly rented units under it. This covers the team’s switch and changeTerms, a switch line the team places in a cart, and the team’s withdrawRevision of a waiting change. Each is compared at the first renewal it changes, with each terms priced over one of its own renewals, so a move to another cadence compares one renewal of each. One whose renewal would charge more is refused with 409 PACKAGE_MEMBER.HIGHER_PRICE (a cart line shows it as package_change_refused), whatever raised it: a pricier package, another cadence that charges more per renewal, a larger quantity, a new delivery with a fee, a fee re-priced at a higher current rate, newly rented units under a delivery with a fee, or a withdrawal that brings back terms that charge more, such as withdrawing the buyer’s accepted move to a cheaper package. The buyer makes such a change or withdrawal itself. When the terms in force lend under a delivery with a fee and a lent item’s rental has ended, a team change is refused as that renewal would be (409 RENTAL.AGREEMENT_CHANGED). A team change sends no email.
  • A move to renewals that charge needs a card. A buyer’s move from terms whose renewals charge nothing to terms whose renewals charge follows a first purchase’s card rule, so no renewal waits on a card: a switch line’s checkout saves a card and selects it on the member (its quote line says saves_card, and the quote lists only card options), while switch and changeTerms, which have no checkout, are refused with 409 PACKAGE_MEMBER.CARD_REQUIRED until the member renews with a ready card, which the buyer saves and selects first.

Moving Between Packages

A member moves only to another package of its offering, and only at a price: switch and reviewSwitch name the to_package_id and the price of the new package’s own package item, in a package the member may buy from. That price must be in the market of the member’s first order: a switch line in another market’s cart is refused with 409 CART.SWITCH_OTHER_MARKET, and the member’s own switch with 409 PACKAGE_MEMBER.PRICE_OTHER_MARKET. A move keeps the member’s quantity and names the choices the new package needs.

  • An upgrade happens now. Between two every packages with the same cadence, to a higher price, when the new package gives something at once (a service or a digital variant), the buyer checks out a cart line whose start is { type: "switch", package_member_id }. The order charges the price difference, times the quantity, for the rest of the current period, and the member moves at once. The upgrade’s order ships nothing: what the new package ships or lends starts with the next renewal order. An upgrade that is never paid is undone. switch refuses an upgrade with PACKAGE_MEMBER.UPGRADE_IS_BOUGHT. A switch line is refused for a member the team assigned without an order (409 CART.SWITCH_ORDERED_TERMS_REQUIRED) and outside a paid period of the membership (409 CART.SWITCH_PERIOD).
  • Any other move between two every packages (down, at the same price, to a package that only ships or lends, or to another cadence) starts at the next renewal and charges nothing before it.
  • A renewing move names its new deliveries. A move between two every packages names a delivery for each shipping profile the new package ships or lends under and the member’s terms don’t deliver: its package_item_ids (the new package’s shipped items of that profile, in item order), an address or a pickup, its shipping method and its fee (base_fee), priced at the method’s current rate for the windows of the first renewal the new terms ship in. The member’s other deliveries carry over as accepted, and a delivery for a profile the terms already deliver is refused. reviewSwitch and switch name them in deliveries, [] when none is needed and always [] for a never member, and without one are refused with 409 PACKAGE_MEMBER.DELIVERY_REQUIRED. A switch line names them as a purchase does, with setFutureDeliveries and the offers quoteFutureDeliveries answers.
  • A change line’s quote runs the change’s own checks. On a switch or amend line, a delivery its move still needs shows as a package_delivery_required blocker, and any other refusal of the change as package_change_refused with that refusal’s code, such as PACKAGE_MEMBER.CHANGE_WAITING; checkout answers that refusal.
  • A buyer changes a never package when its order is confirmed. Between two never packages, the buyer checks out a cart line whose start is { type: "switch", package_member_id }, and the line may share its cart with other lines. The order charges the new package’s price times the member’s quantity and gives what the package gives when it starts, apart from the rented units the member keeps. Checkout accepts the change as a revision of the same member, with the order as its reason, and the member moves when its package line is confirmed: at placement when the change charges nothing for its package (a free checkout, or one that pays only its deliveries on account, by cash on delivery or by a manual option), and when the payment confirms it for a card checkout. Until then the member keeps its package, terms, minimum and rentals, the rentals its order opened are waiting, its other actions are refused with 409 PACKAGE_MEMBER.CHANGE_SCHEDULED, and a second switch line with 409 PACKAGE_MEMBER.CHANGE_WAITING. A line cancelled before it is paid ends the change unapplied: its revision is withdrawn and the rentals its order opened are withdrawn. The move posts package_member.switched; no member is activated or cancelled, so read a package change from that event.
  • The quote states what happens to the rentals. A package change’s package line, like the team’s amendment line, answers rental_change: for each rent_product item of the new package, the rental that continues on it (rental_id, or null when a new rental opens), the units it keeps (kept_quantity) and the units the order ships (shipped_quantity); and in ending, each rental of the member that ends, with the units that come back (returned_quantity). Every other package line answers rental_change: null. A cart delivery names only the shipped units.
const premiumPlan = await arky.eshop.package.get({ id: premium.id, package_id: shopPackage.id });
const { items: premiumPrices } = await arky.eshop.packageItem.findPrices({
	package_item_id: premiumPlan.package_item_id,
	package_id: shopPackage.id,
	include_price: true,
});

const changing = arky.eshop.cart({ buyer: { type: "customer" }, package_id: shopPackage.id });
await changing.addPackage({
	package_id: premium.id,
	quantity: 1,
	choices: [],
	start: { type: "switch", package_member_id: member.id },
	price: {
		package_id: shopPackage.id,
		package_item_id: premiumPlan.package_item_id,
		price_id: premiumPrices[0].price_id,
	},
});
const changeQuote = await changing.quote();
for (const line of changeQuote.lines) {
	if (line.type !== "package" || !line.rental_change) continue;
	const staying = line.rental_change.items.filter((item) => item.rental_id !== null);
	const shipped = line.rental_change.items.reduce((sum, item) => sum + item.shipped_quantity, 0);
	const returned = line.rental_change.ending.map((item) => item.rental_id);
	console.log(staying.length, shipped, returned);
}
  • Between two never packages the team amends a member who ordered from the start of the next calendar month in its schedule’s timezone: with switch, which only the team takes (409 PACKAGE_MEMBER.TEAM_ONLY), or with an amendment line (below); a team cart’s switch line for a never member is refused with 409 CART.AMENDMENT_REQUIRED. The team never moves a never member to a higher-priced package without a charge (409 PACKAGE_MEMBER.HIGHER_PRICE): that is the buyer’s package change, which its order prices. For an every member the team never makes the next renewal charge more (above). A change that keeps a never agreement in its own package keeps the agreement’s accepted terms and price, so a later rise of the listed price never refuses it.
  • A no-charge amendment of a €0 never agreement, such as changing the items on loan, is a team cart line whose start is { type: "amend", package_member_id, expected_updated_at, reason } with the target package’s €0 price under its own package item. It is reviewed and accepted like any order, takes effect next month, and its reason stays with the team. The rentals its order opens stay waiting until that day; withdrawing the amendment before then with withdrawRevision cancels the order’s lines and withdraws them.
  • A move never changes the renewal kind. Between a never and an every package a switch line is refused with 409 CART.SWITCH_NOT_UPGRADE and switch with 409 PACKAGE_MEMBER.RENEWAL_TYPE_CHANGE: end the member first, then buy the other package. The team’s assignment of another package of the offering is refused with 409 PACKAGE_MEMBER.OFFERING_MEMBER while the subject holds a member of it. Arky never ends one member because another starts.
  • Rentals move with the member. When a move to another package applies, a rental of a machine the new package lends again, the same variant, keeps its rental and its unit; another machine’s rental ends and its units come back through returns; and the new package’s other machines ship with the move’s order, whose rentals wait as waiting until the move applies and then turn active.

On the storefront, arky.eshop.packageMember.getSwitchDeliveryOptions (POST /v1/storefront/package-members/{id}/switch-delivery-options/{delivery_id}) lists the methods and fees a renewing move’s new delivery can take. It takes the move as switch does, without reason, with the current revision_id, the page’s language and the delivery_id it asks about, and answers each method’s offer for the windows of the renewal that delivery starts in: a base_fee when every window costs the same, and its window_amounts either way. It prices a delivery from its destination and items and reads no delivery’s method or fee, so before the buyer picks a method, name the delivery you ask about with any canonical method id and base_fee: 0; then send reviewSwitch and switch with the chosen shipping_method_id and its base_fee. It saves nothing.

const plan = await arky.eshop.package.get({ id: premium.id, package_id: shopPackage.id });
const { items: planPrices } = await arky.eshop.packageItem.findPrices({
	package_item_id: plan.package_item_id,
	package_id: shopPackage.id,
	include_price: true,
});
const [planPrice] = planPrices;
const { revision } = await arky.eshop.packageMember.getCurrent({ id: member.id });
if (revision && planPrice?.price) {
	const move = {
		id: member.id,
		expected_updated_at: member.updated_at,
		to_package_id: plan.id,
		choices: [],
		price: {
			package_id: planPrice.price.package_id,
			package_item_id: planPrice.price.package_item_id,
			price_id: planPrice.price.price_id,
		},
	};
	const print = {
		id: crypto.randomUUID(),
		package_item_ids: [printItemId],
		destination: { type: "delivery" as const, address: homeAddress },
		shipping_method_id: crypto.randomUUID(),
		shipping_profile_id: printProfile.id,
		base_fee: 0,
	};
	const { offers } = await arky.eshop.packageMember.getSwitchDeliveryOptions({
		...move,
		revision_id: revision.id,
		language: "en",
		delivery_id: print.id,
		deliveries: [print],
	});
	const offer = offers.find((candidate) => candidate.base_fee !== null);
	if (offer?.base_fee != null) {
		const chosen = { ...print, shipping_method_id: offer.shipping_method_id, base_fee: offer.base_fee };
		const deliveries = [chosen];
		await arky.eshop.packageMember.reviewSwitch({ ...move, deliveries, reason: "Add the print edition" });
		await arky.eshop.packageMember.switch({ ...move, deliveries, reason: "Add the print edition" });
	}
}

Storefront Members

GET /v1/storefront/package-members
SDK: arky.eshop.packageMember.find()
GET /v1/storefront/package-members/{id}
SDK: arky.eshop.packageMember.get()
POST /v1/storefront/package-members/{id}/cancel
SDK: arky.eshop.packageMember.cancel()
const mine = await arky.eshop.packageMember.find({ status: "active" });
const member = mine.items[0];

const calendar = await arky.eshop.packageMember.getCalendar({ id: member.id });
console.log(calendar.next, calendar.after_skip);

if (member.renewal.type === "every") {
	await arky.eshop.packageMember.skipNext({
		id: member.id,
		expected_updated_at: member.updated_at,
		occurrence_index: member.renewal.next_occurrence_index,
	});
}
  • Without filters, find lists the signed-in customer’s own members. With company_id or company_location_id it lists that party’s members, for a customer with the view_company_packages permission there. view_own_packages shows the members whose first order the customer placed.
  • A customer changes their own members, and those of a company or location where they have manage_company_packages, with cancel, pause, resume, skipNext, selectPaymentMethod, reviewSwitch, switch, reviewTerms, changeTerms and withdrawRevision, the same bodies as Admin without store_id.
  • The storefront gets the customer’s own copies (PackageMemberSelf): no staff names or internal reasons. getRevision also answers the package its terms name, { id, key, blocks }, whatever that package’s status, so a past order can name what it bought.

Renewals

Each period of an every member is an order Arky makes at the start of the period, under the revision for that period. It copies the first order’s buyer, market, channel, currency, tax mode and language, uses the billing address and purchase order number of the terms that apply, and charges the member’s card.

  • While the store’s Arky plan has no access, Arky makes no renewal order: the renewal waits, checks again every hour and goes ahead as soon as the store pays inside the member’s period. A lapse that outlasts the period blocks the member with period_missed, which a resume clears.
  • At most one renewal order is made per period. A renewal that costs money without a ready card blocks the member with payment_method_not_ready; a €0 renewal is free.
  • A failed charge is retried at retry_offsets_seconds within recovery_window_seconds. When the retries run out, the order follows unpaid_order (retain_debt keeps it unpaid and unfulfilled until paid; cancel_unfulfilled cancels its unfulfilled lines) and the member follows on_exhaustion: paused with renewal_unpaid, or cancelled. The retries run out only once the window has passed and the order’s latest charge has an outcome: while that charge is still pending, charging, closing or unknown, such as a Monri charge waiting for staff to resolveCharge, recovery checks again every hour. A charge that then fails runs the retries out at the next check, and one confirmed as made settles the renewal.
  • A renewal order has no checkout deadline, so it never expires: its recovery decides what happens to it.
  • The store’s renewal_upcoming email goes reminder days before a renewal, { type: "days_before", days } with 1 to 365 days (409 PACKAGE.RENEWAL_REMINDER_DAYS otherwise) or { type: "none" }, at most once per period and never at or after the renewal itself; an edit to the setting reaches upcoming renewals. renewal_payment_failed follows the retry schedule.
  • A person’s renewal email goes to the member’s current verified contact; a company or location member’s to the company’s contact. Each renewal order keeps the contact it was made for.
Note

Webhooks: package.created, updated and deleted (the last when the package is marked deleting), package_item.created, updated and deleted, package_item_price.created, updated and deleted, package_access.created and deleted, package_offering.created, updated and deleted, and package_member.activated, paused, blocked, resumed, cancelled, renewed, payment_failed, switched, renewal_skipped and payment_method_changed. package.updated is the record alone, a price change posts only package_item_price.*, and a created or updated price’s event names its choice as sellable. Listing a plan posts package_item.created and then its price’s package_item_price.created, and removing an item posts one package_item_price.deleted per price. A person member’s timeline records package_member_activated, package_member_cancelled and package_member_switched.