@haatlabs-core/billing
Payment gateways (Stripe, Razorpay, a manual provider) and the plan Shopify bills a store
for. It throws PAYMENT_PROVIDER_ERROR; a project spreads BILLING_ERRORS into
defineErrors. shopifySubscriptionName and reconcileShopifyPlan take the app's name;
the cancel port is optional, and without it a refused plan cancels nothing.
StoreBillingSync (since 0.5.0) keeps an organization's plan what Shopify charges one of
its stores for; the worker runs it when Shopify says a subscription changed. It is given the
app's repositories and the Shopify calls from @haatlabs-core/shopify. A test charge counts as
paid with acceptTestCharges (SHOPIFY_BILLING_TEST), or in a development store when the
calls include isDevelopmentStore: Shopify is asked only while a test charge is active
(reconcileShopifyPlan's acceptTest takes such a function too).
@haatlabs-core/billing/contracts: the schemas an app's API and pages share: checkout,
Shopify checkout and plan, PLAN_LIMIT_ERRORS, BILLING_ERRORS (0.12.1), and billingSchemas({ metrics, caps, planFeatures }) for the usage, plan list and plan seed file in the app's own lists. Nothing
of Node: an app's contracts, which its pages load, import from here and never the root.
Install
pnpm add @haatlabs-core/billing
It leaves one package to your app, so the app holds one copy: zod.