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_productorrent_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:
| Package | Priced items | Automatic items | Who uses it |
|---|---|---|---|
public | its products at retail prices, and club at €9 a month | none | everyone, through its access row |
wholesale | its products at wholesale prices | none | one company, through its access row |
club | the club’s products at club prices | a gift every month | a 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;
}/v1/stores/{store_id}/packages sdk.eshop.package.create() /v1/stores/{store_id}/packages sdk.eshop.package.find() /v1/stores/{store_id}/packages/purchasable sdk.eshop.package.findPurchasable() /v1/stores/{store_id}/packages/by-key/{key} sdk.eshop.package.getByKey() /v1/stores/{store_id}/packages/{id} sdk.eshop.package.get() /v1/stores/{store_id}/packages/{id} sdk.eshop.package.update() /v1/stores/{store_id}/packages/{id}?expected_updated_at= 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, oreverywith what’sagreedand its livetiming.agreedis thecadence,on_exhaustionandunpaid_order: withstayandminimum, each member keeps it as accepted.timingisretry_offsets_seconds,recovery_window_secondsandreminder: 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, orat_leastalength, withthensaying what happens when that block ends. It works on any package and charges no fee of its own.- On an
everypackagelengthis 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.renewcommits the next block,renew_oncecommits one more block and then stops,continue_without_stayrenews without a stay andstoprenews 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
neverpackage blocks count from the first revision, by calendar steps oflengthin the schedule’s timezone, and a move doesn’t restart them.stopsets the member’saccess_endat the first block’s end andrenew_onceat the second’s;renewandcontinue_without_stayset none. Inside a started block the customer’s cancel setsaccess_endto that block’s end, underrenewin every block and undercontinue_without_stayin the first. - The team can cancel or pause at once. An assigned member has no accepted terms, so a stay doesn’t bind it.
- On an
-
Automatic items are saved with their package.
createandupdatetake the package’s fields anditems, 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). Aneverypackage may have none only whiledraft: activating it, or removing the last one once it has leftdraft, is refused (409 PACKAGE.EVERY_NEEDS_ITEM). Each has anallocation_weightthat 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 aquantity. 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.deliveryisnone(never delivered: services, digital variants and an item that only carries a fee),once_per_periodin one window per period, orrepeating_in_periodon its own cadence inside aneveryperiod, withcountper_period(spread over the windows) orper_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 giveper_periodfewer 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_productandrent_productquantity. A package with no automatic items, or with a digitalget_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-deliveredget_product. A newsletter is a free package; see Newsletters. -
Minimum:
none, orper_monthwith aquantity, what itcountsand ascope.countsis onecategory, where a line matches that exact category and not its children, orvariants, a hand-picked list of up to 100variant_ids, each a current physical variant of the store whosemeasurecounts (409 PACKAGE.MINIMUM_NOT_PHYSICALand409 PACKAGE.MINIMUM_NOT_COUNTEDotherwise, checked for the variants a save adds). Both count each unit by themeasureits order line froze, so a variant counts in the same unit for every package that counts it. It is counted each calendar monthper_locationorcompany_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_producttakes its tax category from the live item at each renewal. -
Status and schedule stop different things, because one record has both jobs:
Status Joining Shop Existing members draftNo Closed None allowed ( 409 PACKAGE.DRAFT_HAS_MEMBERS)activeYes Open Count and renew closedNo, and no move in Open to anyone with a level Count and renew archivedNo, and hidden from pickers Closed Count and renew deletingNo Hidden None possible scheduleis{ type: "always" }or{ type: "scheduled", starts_at, ends_at }. A save that names only an end, withstarts_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 isactiveand inside its schedule (409 PACKAGE.NOT_ON_SALE). The team’s assignment needs only anactivepackage (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, keyedpublic; 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’spackageslimit.402 STORE.USAGE_LIMIT_EXCEEDEDcomes 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
deletingand 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.
findlists packages with theirpackage_offering_id,automatic_item_countandmarket_ids, by text, key, status, offering and creation time, and withmarket_idthose usable in that market.getandgetByKeyalso answeritems, the automatic items in order.findPurchasablelists what one customer may buy from in a market and channel, for staff building a cart.
Priced Items And Prices
/v1/stores/{store_id}/package-items sdk.eshop.packageItem.create() /v1/stores/{store_id}/package-items sdk.eshop.packageItem.find() /v1/stores/{store_id}/package-items/{id} sdk.eshop.packageItem.get() /v1/stores/{store_id}/package-items/{id} sdk.eshop.packageItem.update() /v1/stores/{store_id}/package-items/{id}?expected_updated_at= sdk.eshop.packageItem.delete() /v1/stores/{store_id}/package-items/batch sdk.eshop.packageItem.batch() /v1/stores/{store_id}/package-items/{id}/prices/all sdk.eshop.packageItem.setAllPrices() /v1/stores/{store_id}/package-item-prices sdk.eshop.packageItemPrice.create() /v1/stores/{store_id}/package-item-prices sdk.eshop.packageItemPrice.find() /v1/stores/{store_id}/package-item-prices/by-choice sdk.eshop.packageItemPrice.getByChoice() /v1/stores/{store_id}/package-item-prices/{id} sdk.eshop.packageItemPrice.get() /v1/stores/{store_id}/package-item-prices/{id} sdk.eshop.packageItemPrice.update() /v1/stores/{store_id}/package-item-prices/{id}?expected_updated_at= sdk.eshop.packageItemPrice.delete() /v1/stores/{store_id}/package-item-prices/batch 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, abooking_serviceor apackageonce 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_EXHAUSTEDwhen no later position is left), andupdatechanges only itsposition, which orders what buyers see. An item’s package, market and parent never change.findreads a package’s priced items in position order, for all its markets or for one; withitemandmarket_idit answers the one item of that parent. - A price prices one choice of its item, and the item holds it under that choice: a
productitem’spricesare{ variant_id, price }, one for each variant of the listed product it sells, and abooking_serviceitem’s are{ booking_offering_id, price }, one for each offering of the listed service. Avariant_idof another product or abooking_offering_idof another service is refused (409 PACKAGE_ITEM_PRICE.WRONG_CHOICE). The price calls name the choice assellable: a price’screate,packageItemPrice.find,getByChoiceand 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
packageitem,{ type: "package", market_id, package_id, price }, sells the listed package at its oneprice. Listing a plan is onecreatewith its price, zero when the plan is free:item: { type: "package", package_id, price: { id, amount, compare_at, changes, schedule, status } }, with a priceidthe app picks, increateand in abatch. It postspackage_item.createdand thenpackage_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 abatcheither (409 PACKAGE_ITEM_PRICE.REQUIRED): archive the price or remove the item. Editing the price,setAllPricesand removing the item work as for any item. - A price has one
amountat a time, in minor units of the market’s currency, where0is a real price, acompare_at({ type: "none" }or{ type: "amount", amount }, never below the price), and its ownscheduleandstatus. There are no quantity tiers: quantity discounts are promotions. - An item is on sale while one of its prices is
activeand in its schedule; it has no status or schedule of its own. A line naming an item with no price in force is refused with409 PACKAGE.ITEM_NOT_LISTED.setAllPricesarchives 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,updatewith that price’s ownupdated_at,delete,batchandsetAllPrices, never by sending an item’s whole list, so editing one price never gets a false stale error from another. A price answer carriespackage_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 abatch. 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 andpackage_item_price.updatedposts. 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 acompare_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.findpages one item’s prices bypackage_item_id, in creation order, or one choice’s bysellable, and answers{ items, cursor }from Arky’s own records.getByChoicereads one item’s price for one choice exactly, archived or not, or answers404when 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 onepackage_item_price.deletedper 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
/v1/stores/{store_id}/package-accesses sdk.eshop.packageAccess.create() /v1/stores/{store_id}/package-accesses sdk.eshop.packageAccess.find() /v1/stores/{store_id}/package-accesses/{id} 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, apackage, apackage_offering(members of any of its packages), acustomer(verified only,409 PACKAGE_ACCESS.CUSTOMER_NOT_VERIFIED),all_companies, acompanyor acompany_location. Channels arealloronlysome. Levels arebrowse,see_pricesandbuy. 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_atand has no version:deletenames just{ store_id, id }.findlists a package’s rows bycreated_at, newest first unlesssort_directionisasc. 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
buyon 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 asee_pricesteaser 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.findlists 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
/v1/stores/{store_id}/packages/{id}/copy 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_skippedand acursorto send with the next request until it isnull. - 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
packageitem 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
/v1/stores/{store_id}/package-offerings sdk.eshop.packageOffering.create() /v1/stores/{store_id}/package-offerings sdk.eshop.packageOffering.find() /v1/stores/{store_id}/package-offerings/by-key/{key} sdk.eshop.packageOffering.getByKey() /v1/stores/{store_id}/package-offerings/{id} sdk.eshop.packageOffering.update() /v1/stores/{store_id}/package-offerings/{id}?expected_updated_at= 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
packageitem, 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" },
},
},
});/v1/storefront/packages/{identifier} arky.eshop.package.get() /v1/storefront/packages/{identifier}/product-choices/{package_item_id} arky.eshop.package.getProductChoices() /v1/storefront/package-offerings/{identifier} arky.eshop.packageOffering.get() /v1/storefront/carts/{id}/package-items 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_idis the package being joined.pricenames the exact price as{ package_id, package_item_id, price_id }, where itspackage_idis the package holding that price, the one the cart shops in. getreads a package or an offering by{ id }, andgetByKeyby{ key }, each with thepackage_idof the shop it is listed in. A package read answers thepackage_item_idof its ownpackageitem in that shop and market, and404when the shop doesn’t sell it there. It also answers itsrenewal,stayandminimum, its automaticitemsin order as{ id, type },rental_products, the lent product of eachrent_productitem, ornullonce it no longer exists, andpackage_offering_id, the offering it belongs to ornull. An offering read answers itsid,key,blocksandpackage_ids: the plans of it that the shop sells in the current market, in the offering’s order, and404when the shop sells none. A plan’s search answer names its one price asprice_id.choicesnames one variant for eachget_productitem that lists several, and the member’s terms keep only the variant it gets;arky.eshop.package.getProductChoiceslists them with each variant’sproduct_blocksandvariant_blocks.startison_acceptance,scheduledwith astarts_at,switchfor an upgrade or a package change (below), oramendfor the team’s no-charge change of aneveragreement (below).- A package with deliveries asks for them with
setFutureDeliveries, quoted first withquoteFutureDeliveries. - 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 apayment_unavailableblocker with the reason’scode. 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
everypackage that renews or a delivery fee does, checkout saves the buyer’s card for the renewals; the package line’ssaves_cardin 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’ssaved_card_termstext the buyer accepted inpayment_method_terms. Without it checkout is refused with409 CART.CARD_REQUIRED. When the first order has nothing to pay, such as under a first-period promotion, checkout sends the payment option withsave_payment_method: true, and a Stripe card is saved through a setup without a payment, which checkout answers inpayment_method_setupandmountPaymentMethodSetupmounts (409 CART.NOTHING_DUEwhen 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 showspayment_unavailablewithCART.DEDICATED_SETUP_NEEDS_STRIPE. - The member is
awaiting_activationuntil that line is confirmed, thenactive. 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): aswitchline 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’slanguageyou pass, normally the page language, and answers{ type: "joined", order_id }or{ type: "already_member", package_member_id }.package_idnames the shop it is priced in.arky.newsletter.joindoes the same after the email code; see Newsletters.- For a company or location, buying a package needs the
place_ordersandjoin_packagescompany permissions there.
Assigning A Member
/v1/stores/{store_id}/package-members 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
activepackage with no order and no price. The member startsactive, its renewal isneverwhatever the package’s, it has no revision, card or renewal, and it gets the live package’s automatic items. access_endends 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
buywithout 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;
}/v1/stores/{store_id}/package-members sdk.eshop.packageMember.find() /v1/stores/{store_id}/package-members/{id} sdk.eshop.packageMember.get() /v1/stores/{store_id}/package-members/{id}/current sdk.eshop.packageMember.getCurrent() /v1/stores/{store_id}/package-members/{id}/revisions sdk.eshop.packageMember.findRevisions() /v1/stores/{store_id}/package-members/{id}/orders sdk.eshop.packageMember.findOrders() /v1/stores/{store_id}/package-members/{id}/calendar sdk.eshop.packageMember.getCalendar() /v1/stores/{store_id}/package-members/{id}/minimum sdk.eshop.packageMember.getMinimum() - Only an
everymember renews: itsrenewalholds the next period, the card renewals charge, andrenewal_end, the moment renewals stop. Only anevermember carriesaccess_end. A member’s renewal kind never changes. A cancelledeverymember’srenewal_endreadsnever, and a cancellednevermember’saccess_endis itsended_at. - Only an
everymember can beblockedorpaused. 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_unavailableorno_tax_rule. A pause isrequested, with a reason and aresumestime or{ type: "never" }, orrenewal_unpaidwhen a renewal’s retries ran out.purchase_order_number_requiredmeans the buyer now requires a purchase order number that the member’s terms don’t give: the team, or a company member withmanage_company_packages, names one withchangeTerms, andresumethen passes. findfilters bycustomer_id,company_id(the company and its locations) orcompany_location_id, and by package, offering and status.getCurrentanswers the revision in force with its terms, where a frozenget_productholds the onevariant_idthe member gets.findOrderslists 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’scursorback as it is.- Revisions. Every revision holds its accepted
termsin full: the package as accepted, thequantity, thedeliveries, thebilling_addressand thepurchase_order_numberits renewals put on their orders (nullfor a person). Itsoriginisinitial, or achangenaming the revision before it, its reason and its kind:own_terms(aneverymember’s own-terms change),package_change(aneverymove at the next renewal, or a buyer’sneverpackage change),upgrade(aneveryupgrade bought now),amend(the team’s amendment of aneveragreement) orminimum(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
nevermember, before itsaccess_end; an assigned member counts while it isactiveand before itsaccess_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.
| Change | Call | Who |
|---|---|---|
| end renewals (a customer inside a started block ends at the block’s end) | cancel | team and member |
| end at a given moment | scheduleEnd | team |
pause renewals, with a reason and a resumes time | pause | team and member |
| resume a paused or blocked member at its next safe period | resume | team and member |
| skip the next period | skipNext | team and member |
| the card renewals charge | selectPaymentMethod | team and member |
another package of the offering, from the next renewal (every) or the next month (never) | reviewSwitch, then switch | team and member; only the team for a never member |
a never member’s package change, when its order is confirmed | a cart line with start: { type: "switch" } | member |
| quantity, choices, deliveries, billing address or purchase order number | reviewTerms, then changeTerms | team and member |
| take back a future change | withdrawRevision | team and member |
| a minimum | reviewMinimum, then changeMinimum | team |
| end at once and revoke what it bought from now on | revoke | team |
| move a minimum between two members of one company or location | transferMinimum | team |
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
cancelandscheduleEndcarrynotify_customer. With it, an accepted cancellation of a member sends the store’smembership_cancelledemail 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. skipNextnames the period it skips. It skips only a next period that has no order yet, outside a started block and beforerenewal_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
paymentspermission as well asorders. - 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, andresumethen restarts a blocked member. A Stripe card is saved on its own, witharky.eshop.paymentMethod.requestSetup,startSetupandcompleteSetup. A Monri card is saved only in a paid checkout, and that setup under a Monri option is refused with409 PAYMENT_METHOD.DEDICATED_SETUP_NEEDS_STRIPE: the buyer of a Monri member checks out a paid order withsave_payment_method: true, selects thepayment_method_idit answers once its payment succeeds, and resumes. Arky has no payment page for an owed renewal order:resumePaymentreopens only an order’s own checkout payment while its payment window is open. changeTermsapplies from the next safe period. On the storefront,arky.eshop.packageMember.getDeliveryOptionsprices a changed delivery with the method’s rates first, andgetProductChoiceslists the variants the live item lists now, eachavailableonly 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 thepurchase_order_numberits renewals put on their orders, and a person’s carrynull:reviewTerms,changeTermsandgetDeliveryOptionssend it with the rest of the terms, and a new number clears apurchase_order_number_requiredblock.- 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
everymember’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’sswitchandchangeTerms, aswitchline the team places in a cart, and the team’swithdrawRevisionof 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 with409 PACKAGE_MEMBER.HIGHER_PRICE(a cart line shows it aspackage_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
switchline’s checkout saves a card and selects it on the member (its quote line sayssaves_card, and the quote lists only card options), whileswitchandchangeTerms, which have no checkout, are refused with409 PACKAGE_MEMBER.CARD_REQUIREDuntil 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
everypackages 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 whosestartis{ 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.switchrefuses an upgrade withPACKAGE_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
everypackages (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
everypackages names a delivery for each shipping profile the new package ships or lends under and the member’s terms don’t deliver: itspackage_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.reviewSwitchandswitchname them indeliveries,[]when none is needed and always[]for anevermember, and without one are refused with409 PACKAGE_MEMBER.DELIVERY_REQUIRED. Aswitchline names them as a purchase does, withsetFutureDeliveriesand the offersquoteFutureDeliveriesanswers. - A change line’s quote runs the change’s own checks. On a
switchoramendline, a delivery its move still needs shows as apackage_delivery_requiredblocker, and any other refusal of the change aspackage_change_refusedwith that refusal’scode, such asPACKAGE_MEMBER.CHANGE_WAITING; checkout answers that refusal. - A buyer changes a
neverpackage when its order is confirmed. Between twoneverpackages, the buyer checks out a cart line whosestartis{ 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 arewaiting, its other actions are refused with409 PACKAGE_MEMBER.CHANGE_SCHEDULED, and a second switch line with409 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 arewithdrawn. The move postspackage_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 eachrent_productitem of the new package, the rental that continues on it (rental_id, ornullwhen a new rental opens), the units it keeps (kept_quantity) and the units the order ships (shipped_quantity); and inending, each rental of the member that ends, with the units that come back (returned_quantity). Every other package line answersrental_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
neverpackages the team amends a member who ordered from the start of the next calendar month in its schedule’s timezone: withswitch, which only the team takes (409 PACKAGE_MEMBER.TEAM_ONLY), or with an amendment line (below); a team cart’s switch line for anevermember is refused with409 CART.AMENDMENT_REQUIRED. The team never moves anevermember 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 aneverymember the team never makes the next renewal charge more (above). A change that keeps aneveragreement 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
neveragreement, such as changing the items on loan, is a team cart line whosestartis{ type: "amend", package_member_id, expected_updated_at, reason }with the target package’s €0 price under its ownpackageitem. It is reviewed and accepted like any order, takes effect next month, and its reason stays with the team. The rentals its order opens staywaitinguntil that day; withdrawing the amendment before then withwithdrawRevisioncancels the order’s lines and withdraws them. - A move never changes the renewal kind. Between a
neverand aneverypackage a switch line is refused with409 CART.SWITCH_NOT_UPGRADEandswitchwith409 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 with409 PACKAGE_MEMBER.OFFERING_MEMBERwhile 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
waitinguntil the move applies and then turnactive.
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
/v1/storefront/package-members arky.eshop.packageMember.find() /v1/storefront/package-members/{id} arky.eshop.packageMember.get() /v1/storefront/package-members/{id}/cancel 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,
findlists the signed-in customer’s own members. Withcompany_idorcompany_location_idit lists that party’s members, for a customer with theview_company_packagespermission there.view_own_packagesshows 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, withcancel,pause,resume,skipNext,selectPaymentMethod,reviewSwitch,switch,reviewTerms,changeTermsandwithdrawRevision, the same bodies as Admin withoutstore_id. - The storefront gets the customer’s own copies (
PackageMemberSelf): no staff names or internal reasons.getRevisionalso answers thepackageits 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_secondswithinrecovery_window_seconds. When the retries run out, the order followsunpaid_order(retain_debtkeeps it unpaid and unfulfilled until paid;cancel_unfulfilledcancels its unfulfilled lines) and the member followson_exhaustion: paused withrenewal_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 toresolveCharge, 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_upcomingemail goesreminderdays before a renewal,{ type: "days_before", days }with 1 to 365 days (409 PACKAGE.RENEWAL_REMINDER_DAYSotherwise) 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_failedfollows 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.
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.