Skip to content

Node.js SDK 0.16.0

Choose a tag to compare

@devwatts devwatts released this 23 Oct 20:32
992a59b

Added

  • Plan versions. Plan has version and is_current; plans() returns current versions only.
  • subscribe(customerId, planCode, { planVersion }) sells a chosen version of the plan code instead of the current one (needs Engine 2.7.0). The same customer and code again keep the subscription's version; another version of an existing subscription throws NozleApiError 422 (plan_version_change_not_supported), an unknown version 404 (plan_version_not_found).
  • client.planVersions (secret keys): list(code) lists every version with its price and active subscriptions, get(code, version) reads one, and previewMigration, createMigration, listMigrations, getMigration and cancelMigration move the subscriptions of one version to another, each at the end of its billing period. Migration items carry move_status (pending, moved, canceled). A second migration of a code while one runs throws NozleApiError 409 (plan_version_migration_running).
  • The billing handler's subscription route includes subscription.plan_version, the version the customer is billed on, and subscription.entitlements, that version's entitlements with its usage limits (read from Core with the secret key; null when they cannot be read).