@antelopejs/payment-subscriptions 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,17 +1,20 @@
1
- # @antelopejs/payment-subscriptions
1
+ # `@antelopejs/payment-subscriptions`
2
2
 
3
3
  <div align="center">
4
- <a href="https://www.npmjs.com/package/@antelopejs/payment-subscriptions"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/payment-subscriptions?style=for-the-badge&labelColor=000000&color=000000"></a>
5
- <a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/payment-subscriptions?style=for-the-badge&labelColor=000000&color=000000"></a>
6
- <a href="https://discord.gg/sjK28QHrA7"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
7
- <a href="./docs/1.introduction.md"><img alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
4
+ <a href="https://www.npmjs.com/package/@antelopejs/payment-subscriptions"><img data-illustration alt="npm" src="https://img.shields.io/npm/v/@antelopejs/payment-subscriptions?style=for-the-badge&labelColor=000000&color=000000"></a>
5
+ <a href="./LICENSE"><img data-illustration alt="License" src="https://img.shields.io/npm/l/@antelopejs/payment-subscriptions?style=for-the-badge&labelColor=000000&color=000000"></a>
6
+ <a href="https://discord.gg/g4pFt6eXqu"><img data-illustration alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
7
+ <a href="./docs/1.introduction.md"><img data-illustration alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
8
8
  </div>
9
9
 
10
- Subscriptions for any AntelopeJS payment provider. Implements
11
- `@antelopejs/interface-subscriptions` on top of `@antelopejs/interface-payment`,
12
- using saved payment methods and off-session charges, and runs the renewal clock
13
- itself — for the providers that leave each renewal to the merchant (Adyen,
14
- Checkout.com, Mangopay), and for any provider at all.
10
+ Subscriptions for any AntelopeJS payment provider. This module implements
11
+ `@antelopejs/interface-subscriptions` on top of `@antelopejs/interface-payment`.
12
+ It charges saved payment methods off-session and runs the renewal clock itself.
13
+ It is the implementation for providers that leave each renewal to the merchant,
14
+ such as Adyen, Checkout.com, and Mangopay, and it works with any payment
15
+ provider.
16
+
17
+ Part of [AntelopeJS](https://github.com/AntelopeJS/antelopejs), the TypeScript framework where modules depend on contracts and the application chooses the provider. Built by the team behind [AntelopeJS DMS](https://github.com/AntelopeJS/dms).
15
18
 
16
19
  ## Installation
17
20
 
@@ -20,15 +23,19 @@ ajs project modules add @antelopejs/payment-subscriptions
20
23
  ajs project modules install
21
24
  ```
22
25
 
23
- Wire it alongside:
26
+ Wire it with these modules:
24
27
 
25
- - a module implementing `@antelopejs/interface-payment` (the one that charges);
26
- - a module implementing `@antelopejs/interface-database` (where every
27
- subscription lives — `@antelopejs/mongodb`, for instance);
28
- - optionally, `@antelopejs/redis`, for renewals charged on time rather than
29
- within one poll.
28
+ - A module that implements `@antelopejs/interface-payment`. That module makes
29
+ the charges.
30
+ - A module that implements `@antelopejs/interface-database`, such as
31
+ `@antelopejs/mongodb`. Every subscription lives there.
32
+ - Optionally, `@antelopejs/redis`, which implements both
33
+ `@antelopejs/interface-redis` and `@antelopejs/interface-redis-scheduler`.
34
+ With it, a renewal is charged when it is due instead of at the next poll.
30
35
 
31
- The example below deliberately selects the generic scheduler with Stripe payments and MongoDB storage. For Stripe-native billing, use Stripe alone instead. Supply the three environment variables before startup.
36
+ The example below selects this module's renewal clock on purpose, with Stripe
37
+ payments and MongoDB storage. For Stripe's own billing, wire Stripe alone
38
+ instead. Set the three environment variables before startup.
32
39
 
33
40
  ```typescript [antelope.config.ts] docs-check
34
41
  import { defineConfig } from "@antelopejs/interface-core/config";
@@ -40,7 +47,7 @@ export default defineConfig({
40
47
  source: {
41
48
  type: "package",
42
49
  package: "@antelopejs/payment-subscriptions",
43
- version: "^0.0.2",
50
+ version: "^0.0.3",
44
51
  },
45
52
  },
46
53
  stripe: {
@@ -72,91 +79,103 @@ export default defineConfig({
72
79
  ### With a payment module that has subscriptions of its own
73
80
 
74
81
  `@antelopejs/stripe` implements `@antelopejs/interface-subscriptions` natively.
75
- Wire it alone for Stripe's own subscriptions. Wiring this module beside it makes
76
- two providers of the interface, and the core picks one by module id, not by
77
- intent. To use this module's clock with Stripe charges, say so: add
78
- `disabledExports: ["@antelopejs/interface-subscriptions"]` to the Stripe module's
79
- entry, or an `importOverrides` entry on each consumer.
82
+ Wire it alone for Stripe's own subscriptions. If you wire this module beside it,
83
+ two modules implement the interface, and the core picks one by module ID. It
84
+ does not guess which one you meant. To use this module's clock with Stripe
85
+ charges, make the choice explicit. Add
86
+ `disabledExports: ["@antelopejs/interface-subscriptions"]` to the entry of the
87
+ Stripe module, or add an `importOverrides` entry on each consumer.
80
88
 
81
89
  ## How it works
82
90
 
83
- - **The database is the only source of truth.** Each subscription is one record
84
- holding its period, its status, when it next needs attention and the events it
85
- has yet to deliver. A renewal is recoverable from the database alone.
86
- - **The clock is only a trigger.** With a Redis scheduler wired, each subscription
87
- is one task fired when it is due, and a slow database sweep catches anything
88
- Redis loses. Without one, the database is polled. Redis is optional, and nothing
89
- ever waits on it: a module with no Redis wired starts and renews. The suite
90
- verifies normal Redis interface routing under AntelopeJS core 1.16.0.
91
- - **Charge recovery is bounded.** An instance claims a due renewal with a
92
- conditional write before charging it, so of several racing instances one
91
+ - **The database is the only source of truth.** Each subscription is one record.
92
+ The record holds its period, its status, when it next needs attention, and
93
+ the events it has not delivered yet. The database alone is enough to recover
94
+ a renewal.
95
+ - **The clock only triggers work.** With a Redis scheduler wired, each
96
+ subscription is one Redis task that fires when it is due, and a slow database
97
+ sweep catches any task that Redis loses. Without one, the module polls the
98
+ database. Redis is optional, and nothing waits on it. A module with no Redis
99
+ wired starts and renews. The suite checks the Redis scheduler through normal
100
+ interface routing, with the `@antelopejs/core` version that `devDependencies`
101
+ pins.
102
+ - **Charge recovery has a limit.** An instance claims a due renewal with a
103
+ conditional write before it charges it. Of several instances that race, one
93
104
  charges and the rest stand down. The charge also carries an idempotency key
94
- derived from the subscription, the period and the attempt, so an instance that
95
- takes over an abandoned claim can replay only within the configured provider
96
- guarantee. Without that protection, an unknown result halts for reconciliation.
105
+ built from the subscription, the period, and the attempt. An instance that
106
+ takes over an abandoned claim can replay that key only within the configured
107
+ provider guarantee, `guaranteedReplayMs`. Without that protection, an unknown
108
+ result halts the subscription for reconciliation.
97
109
 
98
110
  ## Configuration
99
111
 
100
112
  Every field is optional.
101
113
 
102
- | Field | Default | Meaning |
103
- | -------------------- | ------------------------- | ----------------------------------------------------------------------------------- |
104
- | `pollIntervalMs` | 60 000 | How often the database is polled when no Redis scheduler is wired |
105
- | `sweepIntervalMs` | 900 000 | How often the database is swept when one is |
106
- | `leaseMs` | 300 000 | How long a claim on a renewal lasts before another instance may take it over |
107
- | `retryDelaysMs` | one, three and seven days | The failed-renewal policy: one retry per entry, then the subscription ends |
108
- | `settlementPollMs` | 3 600 000 | How often a charge that is still settling is read again |
109
- | `errorBackoffMs` | 300 000 | How long to wait when the payment provider cannot be reached at all |
110
- | `batchSize` | 100 | How many due subscriptions one sweep takes on |
111
- | `providerSchedule` | `payment-interface` | How the schedule is mirrored with the provider; see the provider schedule document |
112
- | `guaranteedReplayMs` | `0` | Guaranteed provider idempotency retention, with safety margin; zero disables replay |
113
-
114
- Use Stripe's native subscriptions by default for Stripe users; this module is an
115
- explicit fallback. Before enabling retries of uncertain requests, verify the
116
- provider's retention guarantee for every wired account. There is no portable
117
- capability API and no assumed Stripe-style 24-hour window. See
118
- [safe recovery](./docs/3.failed-renewals.md#reconciliation-and-operational-recovery).
114
+ | Field | Default | Meaning |
115
+ | -------------------- | -------------------------- | --------------------------------------------------------------------------------------------------- |
116
+ | `pollIntervalMs` | 60 000 | How often the module polls the database when no Redis scheduler is wired |
117
+ | `sweepIntervalMs` | 900 000 | How often the module sweeps the database when a Redis scheduler is wired |
118
+ | `leaseMs` | 300 000 | How long a claim on a renewal lasts before another instance can take it over |
119
+ | `retryDelaysMs` | one, three, and seven days | The failed-renewal policy. One retry per entry, then the subscription ends |
120
+ | `settlementPollMs` | 3 600 000 | How often the module reads a charge that is still settling again |
121
+ | `errorBackoffMs` | 300 000 | How long to wait when the payment provider cannot be reached at all |
122
+ | `batchSize` | 100 | How many due subscriptions one sweep processes |
123
+ | `providerSchedule` | `payment-interface` | How the module mirrors the schedule with the provider. See the provider schedule page |
124
+ | `guaranteedReplayMs` | `0` | The idempotency retention that the provider guarantees, minus a safety margin. Zero disables replay |
125
+
126
+ Durations are in milliseconds. A `guaranteedReplayMs` that is negative or not
127
+ finite makes the module throw
128
+ `guaranteedReplayMs must be a finite non-negative duration` at construction.
129
+ An unknown `providerSchedule` name also throws at construction.
130
+
131
+ For Stripe, use Stripe's native subscriptions by default. This module is a
132
+ fallback that you choose explicitly. Before you allow retries of uncertain
133
+ requests, check the retention guarantee of the provider for every wired account.
134
+ No portable API reports that capability, and the module does not assume a
135
+ Stripe-style 24-hour window. See
136
+ [reconciliation and operational recovery](./docs/3.failed-renewals.md#reconciliation-and-operational-recovery).
119
137
 
120
138
  ## Documentation
121
139
 
122
- | Document | Contents |
123
- | ------------------------------------------------------ | ----------------------------------------------------------- |
124
- | [Introduction](./docs/1.introduction.md) | What it implements, what it needs, what it records |
125
- | [The renewal clock](./docs/2.renewal-clock.md) | Polling and Redis, claims, idempotency, several instances |
126
- | [Failed renewals](./docs/3.failed-renewals.md) | The retry policy, settling charges, an unreachable provider |
127
- | [The provider schedule](./docs/4.provider-schedule.md) | The seam for providers that store a schedule (Mangopay) |
140
+ | Document | Contents |
141
+ | ------------------------------------------------------ | ------------------------------------------------------------------------- |
142
+ | [Introduction](./docs/1.introduction.md) | What it implements, what it needs, what it records |
143
+ | [The renewal clock](./docs/2.renewal-clock.md) | Polling and Redis, claims, idempotency, several instances |
144
+ | [Failed renewals](./docs/3.failed-renewals.md) | The retry policy, settling charges, an unreachable provider |
145
+ | [The provider schedule](./docs/4.provider-schedule.md) | The extension point for providers that store a schedule, such as Mangopay |
128
146
 
129
147
  ## Compatibility
130
148
 
131
- <!-- docs-compat: ./package.json#dependencies -->
132
-
133
- | Package | Range |
134
- | ------------------------------------- | ---------------- |
135
- | `@antelopejs/interface-core` | `>=0.0.5 <1.0.0` |
136
- | `@antelopejs/interface-database` | `>=0.2.0 <1.0.0` |
137
- | `@antelopejs/interface-payment` | `>=0.0.2 <1.0.0` |
138
- | `@antelopejs/interface-subscriptions` | `>=0.1.0 <0.2.0` |
149
+ <!-- antelopejs-docs-compat:start -->
139
150
 
140
- <!-- docs-compat: ./package.json#optionalDependencies -->
151
+ | Package | Supported | Tested with |
152
+ | --------------------------------------- | ---------------- | ----------- |
153
+ | `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` | `0.4.0` |
154
+ | `@antelopejs/interface-database` | `>=0.2.0 <1.0.0` | `0.2.0` |
155
+ | `@antelopejs/interface-payment` | `>=0.0.2 <1.0.0` | `0.0.2` |
156
+ | `@antelopejs/interface-redis` | `>=0.0.9 <1.0.0` | `0.0.9` |
157
+ | `@antelopejs/interface-redis-scheduler` | `>=0.0.9 <1.0.0` | `0.0.9` |
158
+ | `@antelopejs/interface-subscriptions` | `>=0.1.0 <0.2.0` | `0.1.0` |
141
159
 
142
- | Package | Range |
143
- | --------------------------------------- | ---------------- |
144
- | `@antelopejs/interface-redis` | `>=0.0.6 <1.0.0` |
145
- | `@antelopejs/interface-redis-scheduler` | `>=0.0.9 <1.0.0` |
160
+ <!-- antelopejs-docs-compat:end -->
146
161
 
147
- These are the manifest's interface requirements. Provider modules can impose additional requirements; the example above uses Stripe 1.1 and MongoDB 1.6.
162
+ The table lists the interface requirements in `package.json`. Provider modules
163
+ can add requirements of their own. Check the compatibility table of each
164
+ provider module that you wire.
148
165
 
149
166
  ## Testing
150
167
 
151
- `pnpm test` runs the suite twice, once per clock, against a real MongoDB and —
152
- for the second run — a real Redis, both started by the suite. The interface's
153
- conformance suite runs in both. A test-only payment provider in
154
- `test/payment-provider` stands in for the payment module; it is never published.
155
- The scripts use the local AntelopeJS core 1.16.0 runner (`ajs module test .`).
168
+ `pnpm test` runs the suite twice, once per clock. Both runs use a real MongoDB,
169
+ and the second run also uses a real Redis. The suite starts both. The
170
+ conformance suite of the interface runs in both. A test-only payment provider in
171
+ `test/payment-provider` stands in for the payment module, and it is never
172
+ published. The scripts run `ajs module test .` from the `@antelopejs/core`
173
+ version that `devDependencies` pins.
156
174
 
157
175
  ## Contributing
158
176
 
159
- Read [CONTRIBUTING.md](./CONTRIBUTING.md). Use Node.js 24 and pnpm 10.6.5:
177
+ Read [CONTRIBUTING.md](./CONTRIBUTING.md). Use the Node.js version in `.nvmrc`
178
+ and the pnpm version in the `packageManager` field of `package.json`:
160
179
 
161
180
  ```bash
162
181
  pnpm install --frozen-lockfile
@@ -199,9 +199,9 @@ const CANCELLATIONS = {
199
199
  period_end: () => ({ patch: { cancelAtPeriodEnd: true }, events: [] }),
200
200
  };
201
201
  async function CancelSubscription(id, idempotencyKey, timing, provider) {
202
- const cancel = CANCELLATIONS[timing];
203
- if (!cancel)
202
+ if (!Object.prototype.hasOwnProperty.call(CANCELLATIONS, timing))
204
203
  throw new interface_subscriptions_1.InvalidSubscriptionRequestError(`Unknown cancellation timing: ${timing}`);
204
+ const cancel = CANCELLATIONS[timing];
205
205
  const canceled = await changeLive(id, idempotencyKey, provider, (record, now) => {
206
206
  assertNotEnded(record);
207
207
  return cancel(record, now);
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.js","sourceRoot":"","sources":["../src/implementation.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,mDAA2D;AAC3D,qEAIuC;AACvC,iFAU6C;AAE7C,mCAA8B;AAC9B,qCAAoC;AACpC,uCAAoC;AACpC,iCAAwC;AACxC,uCAA0C;AAC1C,+CAAwD;AACxD,qCAA0E;AAC1E,uCAKmB;AAEnB,MAAM,cAAc,GAAG,CAAC,CA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22
  charge: chargeOffSession,
23
23
  release: () => Promise.resolve(),
24
24
  });
25
- const SCHEDULES = {
26
- "payment-interface": PAYMENT_INTERFACE_SCHEDULE,
27
- };
28
- function lookup(table, key) {
29
- return table[key];
30
- }
25
+ const SCHEDULES = new Map([
26
+ ["payment-interface", PAYMENT_INTERFACE_SCHEDULE],
27
+ ]);
31
28
  function ResolveSchedule(name) {
32
- const schedule = lookup(SCHEDULES, name);
29
+ const schedule = SCHEDULES.get(name);
33
30
  if (!schedule) {
34
- throw new Error(`Unknown providerSchedule "${name}"; known: ${Object.keys(SCHEDULES).join(", ")}`);
31
+ throw new Error(`Unknown providerSchedule "${name}"; known: ${[...SCHEDULES.keys()].join(", ")}`);
35
32
  }
36
33
  return schedule;
37
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schedule.js","sourceRoot":"","sources":["../src/schedule.ts"],"names":[],"mappings":";;AA6DA,0CAQC;AArED,qEAA4E;AAC5E,iFAAgF;AAwBhF,SAAS,gBAAgB,CAAC,MAAuB;IAC/C,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAChC,OAAO,IAAA,iCAAa,EAClB;QACE,MAAM,EAAE,YAAY,CAAC,MAAM;QAC3B,SAAS,EAAE,YAAY,CAAC,SAAS;QACjC,QAAQ,EAAE,YAAY,CAAC,QAAQ;QAC/B,aAAa,EAAE,YAAY,CAAC,aAAa;QACzC,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE;YACR,GAAG,YAAY,CAAC,QAAQ;YACxB,CAAC,mDAAyB,CAAC,EAAE,YAAY,CAAC,EAAE;SAC7C;KACF,EACD,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,QAAQ,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,0BAA0B,GAAqB,MAAM,CAAC,MAAM,CAAC;IACjE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1C,MAAM,EAAE,gBAAgB;IACxB,OAAO,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OAAO,CAAC,SAAS,CAAC;IAC1C,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;CACjC,CAAC,CAAC;AAEH,MAAM,SAAS,GAA0C,IAAI,GAAG,CAAC;IAC/D,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;CAClD,CAAC,CAAC;AAEH,SAAgB,eAAe,CAAC,IAAY;IAC1C,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,6BAA6B,IAAI,aAAa,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACjF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,11 +1,16 @@
1
- # Introduction
1
+ ---
2
+ title: Introduction
3
+ description: What the generic subscriptions module implements, which interfaces it needs, how it charges, and what it stores.
4
+ mode: reference
5
+ ---
2
6
 
3
7
  `@antelopejs/payment-subscriptions` implements
4
8
  `@antelopejs/interface-subscriptions` for any provider wired behind
5
9
  `@antelopejs/interface-payment`. It is the implementation for providers that
6
- leave each renewal charge to the merchant — Adyen, Checkout.com, Mangopay — and
7
- it is an explicit fallback. Stripe users should use Stripe's native subscription
8
- implementation by default rather than run two competing renewal engines.
10
+ leave each renewal charge to the merchant, such as Adyen, Checkout.com, and
11
+ Mangopay. It is a fallback that you choose explicitly. Stripe users should use
12
+ the native subscription implementation of Stripe by default, so that two
13
+ renewal engines never compete.
9
14
 
10
15
  ## What it needs
11
16
 
@@ -13,49 +18,57 @@ implementation by default rather than run two competing renewal engines.
13
18
  | --------------------------------------- | ------------------------------------------------------------- | -------- |
14
19
  | `@antelopejs/interface-payment` | Every charge is an off-session payment against a saved method | Yes |
15
20
  | `@antelopejs/interface-database` | Every subscription is a record there, and nowhere else | Yes |
16
- | `@antelopejs/interface-redis-scheduler` | Fires each renewal on time instead of within one poll | No |
21
+ | `@antelopejs/interface-redis-scheduler` | Fires each renewal when it is due instead of at the next poll | No |
22
+ | `@antelopejs/interface-redis` | The module uses the scheduler only when Redis is also wired | No |
17
23
 
18
- The database adapter must implement `atomicMutation`, the interface-database
19
- conditional single-record write. `@antelopejs/mongodb` 1.6 does, and the suite
20
- runs against it.
24
+ The database adapter must implement `atomicMutation`, the conditional
25
+ single-record write of `@antelopejs/interface-database`. `@antelopejs/mongodb`
26
+ implements it, and the suite runs against it.
21
27
 
22
28
  ## What it charges
23
29
 
24
- Each period is one `CreatePayment` with `offSession: true` against the
25
- subscription's saved method, under the subscription's `reference`, with the
26
- subscription's metadata plus `antelopeSubscription` set to its identifier. The
27
- idempotency key is
28
- `payment-subscriptions:<subscription>:<period>:<attempt>`: stable across
29
- anything that might repeat a charge, and different for each deliberate retry.
30
-
31
- The optional `provider` passed when a subscription is created selects the
32
- payment account, exactly as on the payment interface, and is stored with the
33
- subscription: every later charge goes to the same account, because the
34
- customer and the method exist only there. Reading the subscription back needs
30
+ Each period is one `CreatePayment` call with `offSession: true` against the
31
+ saved method of the subscription. The call carries the `reference` of the
32
+ subscription and its metadata, plus `antelopeSubscription` set to the
33
+ subscription ID. The idempotency key is
34
+ `payment-subscriptions:<subscription>:<period>:<attempt>`. The key stays the
35
+ same for anything that might repeat a charge, and changes for each deliberate
36
+ retry.
37
+
38
+ The optional `provider` that you pass when you create a subscription selects
39
+ the payment account, as on the payment interface. The module stores it with
40
+ the subscription, and every later charge goes to the same account, because the
41
+ customer and the method exist only there. To read the subscription back, pass
35
42
  the same `provider`.
36
43
 
37
44
  ## What it records
38
45
 
39
- One record per subscription, in the schema `payment-subscriptions`, table
40
- `subscriptions`, default instance:
46
+ The module keeps one record per subscription, in the schema
47
+ `payment-subscriptions`, table `subscriptions`, on the default instance. The
48
+ record holds:
41
49
 
42
- - the request — customer, method, amount, interval, reference, metadata;
43
- - the billing state — anchor, current period, status, attempt, the latest
44
- charge and any charge still settling;
45
- - `nextActionAt`, when it next needs attention, and `dueAt`, what the sweep
46
- queries: the same, or now while events are waiting;
47
- - the claim — which instance holds it, and until when;
48
- - the attempt's persisted start and replay deadline, and any reconciliation hold;
49
- - the outbox — events raised but not yet delivered;
50
- - the idempotency keys of recent cancellations and method changes.
50
+ - The request: customer, method, amount, interval, reference, description, and
51
+ metadata.
52
+ - The billing state: anchor, current period, status, attempt, the latest
53
+ charge, and any charge still settling.
54
+ - `nextActionAt`, when the subscription next needs attention, and `dueAt`, the
55
+ field that the sweep queries. `dueAt` equals `nextActionAt`, or now while
56
+ events wait for delivery.
57
+ - The claim: which instance holds it, and until when.
58
+ - The persisted start and replay deadline of the current attempt, and any
59
+ reconciliation hold.
60
+ - The outbox, which holds the events raised but not delivered yet.
61
+ - The idempotency keys of the last 50 cancellations and payment method changes.
51
62
 
52
- A subscription's identifier is derived from the creation's idempotency key and
53
- the `provider`, which is what lets two racing creations with one key find each
54
- other.
63
+ The subscription ID is `sub_` followed by a hash of the idempotency key of the
64
+ creation and the `provider`. Two creations that race with one key therefore
65
+ find the same record.
55
66
 
56
67
  ## Events
57
68
 
58
- Each change records its events in the same write as the change itself, and they
59
- are delivered from there to the handlers registered on `SubscriptionEvents`.
60
- Delivery is retried until every handler accepts, so it is at least once, and an
61
- event survives a crash between the change and its delivery.
69
+ Each change records its events in the same write as the change itself. The
70
+ module delivers them from there to the handlers registered on
71
+ `SubscriptionEvents`, in order. If a handler rejects an event, delivery stops
72
+ at that event and the module tries again after `errorBackoffMs`, until every
73
+ handler accepts. Delivery is at least once, and an event survives a crash
74
+ between the change and its delivery.
@@ -1,95 +1,111 @@
1
- # The renewal clock
1
+ ---
2
+ title: The renewal clock
3
+ description: How the module decides when to charge, picks polling or Redis, claims a renewal, and stays safe when several instances run or one dies mid-charge.
4
+ mode: explanation
5
+ ---
2
6
 
3
- The module decides on its own when a subscription needs charging. That is the
4
- whole reason it exists, and the part that has to be right when several instances
5
- run at once and when any of them can die mid-charge.
7
+ The module decides on its own when a subscription needs a charge. That is the
8
+ reason it exists. It is also the part that has to be right when several
9
+ instances run at once and any of them can die in the middle of a charge.
6
10
 
7
- ## The database decides, the clock only knocks
11
+ ## The database decides and the clock only triggers
8
12
 
9
- Every subscription record carries `dueAt`: when it next needs attention. A
10
- trigger's only job is to make an instance look at records whose `dueAt` has
11
- passed. What to do is read from the record — charge the next period, retry a
12
- failed one, read a settling charge again, end it at period end — never from the
13
- trigger.
13
+ Every subscription record carries `dueAt`, the time when it next needs
14
+ attention. A trigger has one job: make an instance look at the records whose
15
+ `dueAt` has passed. The instance reads what to do from the record, never from
16
+ the trigger. It charges the next period, retries a failed one, reads a
17
+ settling charge again, or ends the subscription at period end.
14
18
 
15
- So whichever trigger runs, the database holds the same information, and a
16
- renewal Redis never fires is still made by the next sweep.
19
+ Whichever trigger runs, the database holds the same information. If Redis
20
+ never fires a renewal, the next sweep still makes it.
17
21
 
18
22
  ## Choosing the trigger
19
23
 
20
- At start, before touching Redis at all:
21
-
22
- 1. If no module implements both `@antelopejs/interface-redis` and
23
- `@antelopejs/interface-redis-scheduler`, **poll**: sweep the database every
24
- `pollIntervalMs`. A renewal is charged at most one interval late.
25
- 2. Otherwise **use the Redis scheduler**: each subscription is one task, named
26
- after it and fired at its `dueAt`. Rescheduling replaces the task. A sweep
27
- still runs every `sweepIntervalMs`, because the scheduler drops a task whose
28
- handler dies mid-run and the database alone must be enough.
29
-
30
- The Redis interfaces are optional dependencies, imported lazily after the wiring
31
- check. Nothing on a request path or in `start()` awaits a Redis connection. A
32
- Redis that is wired but unreachable delays renewals until the next database
33
- sweep; it blocks nothing.
34
-
35
- With AntelopeJS core 1.16.0 and `@antelopejs/redis` 1.0.3, the suite verifies
36
- the published scheduler through normal interface routing, without a test-only
37
- handler-registration bypass. If a scheduler refuses handler registration, the
38
- module logs a warning and falls back to polling.
24
+ At start, before the module touches Redis at all, it picks one of two
25
+ triggers:
26
+
27
+ 1. If `@antelopejs/interface-redis` or `@antelopejs/interface-redis-scheduler`
28
+ has no implementation wired, the module **polls**. It sweeps the database
29
+ every `pollIntervalMs`, so a renewal is charged at most one interval late.
30
+ 2. Otherwise the module **uses the Redis scheduler**. Each subscription is one
31
+ task, named after the subscription and fired at its `dueAt`. When `dueAt`
32
+ changes, the module schedules the task again, and when `dueAt` is cleared, it
33
+ removes the task. A sweep still runs every `sweepIntervalMs`, because the
34
+ scheduler drops a task whose handler dies mid-run, and the database alone
35
+ must be enough.
36
+
37
+ The Redis interfaces are optional dependencies, and the module imports them
38
+ lazily after the wiring check. Nothing on a request path or in `start()` waits
39
+ for a Redis connection. A Redis that is wired but unreachable delays renewals
40
+ until the next database sweep, and it blocks nothing.
41
+
42
+ The suite checks the Redis scheduler through normal interface routing, without
43
+ a test-only bypass for handler registration. If the scheduler refuses to
44
+ register the handler, the module logs a warning and falls back to polling. At
45
+ start, the module logs which clock it chose, and `ActiveClock()` returns
46
+ `"polling"` or `"redis"`.
39
47
 
40
48
  ## Claiming a renewal
41
49
 
42
- Several instances may find the same renewal due. Each record is changed only by
43
- a conditional write against its current revision (`atomicMutation`), and
44
- charging starts with one:
50
+ Several instances can find the same renewal due. The module changes each record
51
+ only with a conditional write against its current revision (`atomicMutation`),
52
+ and a charge starts with one:
45
53
 
46
- 1. Read the record. If it is not due, or another instance's claim on it has not
47
- expired, leave it.
48
- 2. Write a claim — this instance, until now plus `leaseMs` — against the revision
49
- just read. Of several instances that read the same revision, exactly one
50
- succeeds. The rest stand down without reaching the provider.
54
+ 1. Read the record. If it is not due, or the claim of another instance on it
55
+ has not expired, leave it.
56
+ 2. Write a claim against the revision just read. The claim names this instance
57
+ and lasts until now plus `leaseMs`. Of several instances that read the same
58
+ revision, exactly one write succeeds. The others stand down without a call
59
+ to the provider.
51
60
  3. Charge.
52
- 4. Write the outcome against the claimed revision, then deliver the events and
53
- release the claim.
61
+ 4. Read the record again and write the outcome against its current revision.
62
+ Then deliver the events and release the claim.
54
63
 
55
- If a cancellation lands between 2 and 4, the write in 4 conflicts. The record is
56
- read again and the outcome applied to what is there now: a charge that went
57
- through on a subscription just cancelled is recorded and reported, and the
58
- subscription stays cancelled.
64
+ If a cancellation lands between step 2 and step 4, step 4 applies the outcome
65
+ to the record as it is now. A charge that went through on a subscription that
66
+ was just cancelled is recorded and reported, and the subscription stays
67
+ cancelled.
59
68
 
60
69
  ## When an instance dies mid-charge
61
70
 
62
- Its claim expires after `leaseMs`, and another instance claims the renewal.
63
- Before the first provider call, the module persists the payment method,
64
- `attemptStartedAt` and `attemptReplayUntil`. A takeover sends the same key only
65
- strictly before that deadline. The deadline uses `guaranteedReplayMs` (default
66
- zero) and is never extended by later configuration changes. A lease is not an
67
- idempotency guarantee. Configure a conservative retention duration with enough
68
- margin for clock skew, request latency and process stalls across all instances.
69
-
70
- If the result is unknown after protection expires, processing halts with
71
- `vendorData.reconciliationRequired: true` and a log containing the subscription
72
- ID. Legacy records without attempt timing are treated conservatively, not given
73
- a new replay window. A known pending payment is read by ID, even after expiry;
74
- reading it never submits a charge. See the operational recovery procedure in
75
- [Failed renewals](./3.failed-renewals.md#reconciliation-and-operational-recovery).
76
-
77
- That is the second guard. The first, the claim, means the provider normally never
78
- sees the second request at all.
71
+ The claim of that instance expires after `leaseMs`, and another instance claims
72
+ the renewal. Before the first provider call, the module persists the payment
73
+ method, `attemptStartedAt`, and `attemptReplayUntil`. A takeover sends the same
74
+ idempotency key only strictly before that deadline. The deadline comes from
75
+ `guaranteedReplayMs`, which defaults to zero, and a later configuration change
76
+ never extends it. A lease is not an idempotency guarantee. Configure a
77
+ conservative retention duration, with enough margin for clock skew, request
78
+ latency, and process stalls across all instances.
79
+
80
+ If the result is still unknown after the protection expires, processing halts.
81
+ The subscription reports `vendorData.reconciliationRequired: true`, and the
82
+ module logs an error that contains the subscription ID. A record whose attempt
83
+ has already started but carries no attempt timing does not get a new replay
84
+ window. It halts for reconciliation too. The module reads a known pending
85
+ payment by its ID, even after the deadline, and that read never submits a
86
+ charge. For the operational recovery procedure, see
87
+ [failed renewals](./3.failed-renewals.md#reconciliation-and-operational-recovery).
88
+
89
+ The deadline is the second guard. The first guard, the claim, means that the
90
+ provider normally never sees a second request at all.
79
91
 
80
92
  ## Several instances
81
93
 
82
- Nothing is held in memory that another instance needs. Each instance has its own
83
- claim identity, sweeps on its own, and delivers the events of the records it
84
- processed to the handlers registered in it. Any number can run against one
85
- database.
94
+ No instance keeps anything in memory that another instance needs. Each
95
+ instance has its own claim identity, sweeps on its own, and delivers the
96
+ events of the records it processed to the handlers registered in it. Any
97
+ number of instances can run against one database.
86
98
 
87
99
  ## Testing the clock
88
100
 
89
- The clock the module reads is replaceable (`UseClock`), and the suite drives a
90
- manual one through trials, renewals, failures, retries and period ends. The real
91
- triggers are tested separately in real time: a renewal made by polling with
92
- nobody calling, and — with Redis — a task scheduled for a trial end and fired by
93
- Redis while the sweep is an hour away, and a task deleted from Redis whose
94
- renewal the sweep still makes. A boot test launches a project the production
95
- way, without the test harness, and checks it starts and renews.
101
+ The clock that the module reads is replaceable (`UseClock` in `src/clock.ts`),
102
+ and the suite drives a manual clock through trials, renewals, failures,
103
+ retries, and period ends. Separate tests check the real triggers in real time:
104
+
105
+ - A renewal made by polling, with nobody calling.
106
+ - With Redis, a task scheduled for the end of a trial and fired by Redis while
107
+ the sweep is an hour away.
108
+ - With Redis, a task deleted from Redis whose renewal the sweep still makes.
109
+
110
+ A boot test launches a project the way production does, without the test
111
+ harness, and checks that it starts and renews.
@@ -1,126 +1,156 @@
1
- # Failed renewals
1
+ ---
2
+ title: Failed renewals
3
+ description: The retry policy of this module for declined renewals, settling charges, refusals, an unreachable provider, the first period, and reconciliation.
4
+ mode: reference
5
+ ---
2
6
 
3
- The interface promises only that a failed renewal is reported as `past_due`. What
4
- happens next is each implementation's policy. This is this module's.
7
+ The interface promises only that a failed renewal is reported as `past_due`.
8
+ What happens next is the policy of each implementation. This page describes
9
+ the policy of this module.
5
10
 
6
11
  ## The policy
7
12
 
8
- When charging a period is declined:
13
+ When the charge for a period is declined:
9
14
 
10
- 1. The period advances anyway, the subscription goes `past_due`, and
11
- `subscription.payment_failed` is raised. The unpaid period is the current one.
12
- 2. It is retried after each entry of `retryDelaysMs`, measured from the failure
13
- before it. By default: one day, three days, seven days — four attempts over
14
- eleven days.
15
- 3. A retry that succeeds makes it `active` again, in the same period. The cycle
16
- does not move.
17
- 4. When the last retry fails, the subscription ends: `canceled`, with
18
- `endReason: "payment_failed"`, and both `subscription.payment_failed` and
19
- `subscription.canceled` are raised.
15
+ 1. The period advances anyway, the subscription goes `past_due`, and the module
16
+ raises `subscription.payment_failed`. The unpaid period is the current one.
17
+ 2. The module retries the charge after each entry of `retryDelaysMs`, measured
18
+ from the failure before it. By default the delays are one day, three days,
19
+ and seven days, which makes four attempts over eleven days.
20
+ 3. A retry that succeeds makes the subscription `active` again, in the same
21
+ period. The cycle does not move.
22
+ 4. When the last retry fails, the subscription ends. It becomes `canceled`,
23
+ with `endReason: "payment_failed"`, and the module raises both
24
+ `subscription.payment_failed` and `subscription.canceled`.
20
25
 
21
- Each new attempt uses the subscription's payment method at the time it is made,
22
- so `UpdateSubscriptionPaymentMethod` during `past_due` is how a payer recovers.
23
- Each attempt has its own idempotency key; a retry is a new charge, not a replay
24
- of the decline.
26
+ A payment with the status `failed`, `canceled`, or `requires_action` counts as
27
+ a decline.
28
+
29
+ Each new attempt uses the payment method of the subscription at the time of
30
+ the attempt. A payer recovers by calling `UpdateSubscriptionPaymentMethod`
31
+ during `past_due`. Each attempt has its own idempotency key. A retry is a new
32
+ charge, not a replay of the decline.
25
33
 
26
34
  A subscription set to end at period end keeps being retried until its period
27
- ends, and then ends instead of being retried further.
35
+ ends. Then it ends, and the module retries no further.
28
36
 
29
37
  ## A charge that is still settling
30
38
 
31
- A bank debit can report `pending` for days. The subscription stays as it was —
32
- `active` after a trial or a paid period, `past_due` during retries — and the
33
- charge is read again every `settlementPollMs` until it settles, then treated as
34
- succeeded or declined. Nothing is reported until it settles.
39
+ A bank debit can report `pending` for days. The module treats a payment with
40
+ the status `pending` or `authorized` as settling. The subscription keeps its
41
+ status: `active` after a trial or a paid period, or `past_due` during retries.
42
+ The module reads the charge again every `settlementPollMs` until it settles,
43
+ then treats it as succeeded or declined. Nothing is reported until it settles.
35
44
 
36
- If the subscription is cancelled while a charge is settling, the charge is still
37
- followed; a charge that then succeeds is recorded and reported, so the money can
38
- be refunded.
45
+ If the subscription is cancelled while a charge is settling, the module still
46
+ follows the charge. A charge that then succeeds is recorded and reported, so
47
+ that the merchant can refund the money.
39
48
 
40
49
  ## A provider that refuses the charge
41
50
 
42
- `CustomerNotFoundError`, `PaymentNotFoundError`, `InvalidPaymentStateError` and
43
- `UnsupportedOperationError` from the payment interface mean the provider will
44
- not make this charge — most often because the saved method has been removed.
45
- They count as a declined attempt: `past_due`, retried under the policy, ended
46
- when the retries are spent. The `subscription.payment_failed` event has no
47
- `payment`, since none was made.
51
+ `CustomerNotFoundError`, `PaymentNotFoundError`, `InvalidPaymentStateError`,
52
+ and `UnsupportedOperationError` from the payment interface mean that the
53
+ provider will not make this charge. The most common cause is a saved method
54
+ that has been removed. They count as a declined attempt. The subscription goes
55
+ `past_due`, the module retries it under the policy, and it ends when the
56
+ retries are spent. The `subscription.payment_failed` event has no `payment`,
57
+ because no payment was made.
48
58
 
49
- ## A provider that cannot be reached
59
+ If one of these errors comes back when the module reads a settling charge, the
60
+ module does not count it as a decline. It holds the subscription for
61
+ reconciliation.
50
62
 
51
- Any other `PaymentError` is not a decline: the charge is in doubt. The same
52
- attempt can be made again after `errorBackoffMs` only within its persisted
53
- provider guarantee, with the same idempotency key **and the same payment method**,
54
- recorded before the first try — so if the first request did reach the provider,
55
- the retry finds that charge instead of making another, even if the method was
56
- changed meanwhile. The new method is used from the next attempt.
63
+ ## A provider that cannot be reached
57
64
 
58
- If the subscription is cancelled while a charge is in doubt, the attempt is not
59
- made again. A charge that did land then reaches the merchant only as the payment
60
- interface's `payment.succeeded` webhook, carrying `antelopeSubscription`.
65
+ Any other `PaymentError` is not a decline. The charge is in doubt. The module
66
+ can make the same attempt again after `errorBackoffMs`, but only within the
67
+ persisted provider guarantee. The retry uses the same idempotency key **and
68
+ the same payment method**, both recorded before the first try. If the first
69
+ request did reach the provider, the retry finds that charge instead of making
70
+ another, even if the method was changed in the meantime. The new method is
71
+ used from the next attempt. With the default `guaranteedReplayMs` of zero, the
72
+ guarantee has already expired, so the module holds the subscription for
73
+ reconciliation instead of retrying.
74
+
75
+ If the subscription is cancelled while a charge is in doubt, the module does
76
+ not make the attempt again, and it holds the record for reconciliation. A
77
+ charge that did land then reaches the merchant only as the
78
+ `payment.succeeded` webhook of the payment interface, which carries
79
+ `antelopeSubscription`.
61
80
 
62
81
  ## After a stall
63
82
 
64
- Periods are anchored, so a subscription that could not be processed for longer
65
- than a period — the database or every instance was down — has every missed
66
- period charged on recovery, one after another.
83
+ Periods are counted from the anchor. If the module could not process a
84
+ subscription for longer than a period, because the database or every instance
85
+ was down, it charges every missed period on recovery, one after another.
67
86
 
68
87
  ## The first period
69
88
 
70
- The first period is charged inside `CreateSubscription`, and a decline there
71
- creates nothing: it rejects with `SubscriptionPaymentError`. A payer with no
72
- subscription is not `past_due`.
73
-
74
- A creation that ends without an answer — the provider could not be reached, or
75
- the instance died mid-call — must be replayed with the same idempotency key.
76
- The replay resumes it only within its persisted replay window. After expiry it
77
- rejects with a reconciliation-required error naming the subscription ID,
78
- without charging again. A refused creation remains refused on replay.
79
- A creation nobody replays is never completed by the module, and a charge it made
80
- belongs to no subscription; it still reaches the merchant as a payment-interface
81
- webhook carrying `antelopeSubscription`.
89
+ When the request has neither `trialEnd` nor `billingAnchor`,
90
+ `CreateSubscription` charges the first period itself, and a decline there
91
+ creates no subscription. A declined payment rejects with
92
+ `SubscriptionPaymentError`. A refusal from the provider, with no payment made,
93
+ rejects with `InvalidSubscriptionRequestError`. A payer with no subscription is
94
+ not `past_due`. With `trialEnd` or `billingAnchor`, the module creates the
95
+ subscription at once and charges the first period at that time, under the
96
+ policy above.
97
+
98
+ A creation that ends without an answer must be replayed with the same
99
+ idempotency key. That happens when the provider could not be reached, or when
100
+ the instance died during the call. The replay resumes the creation only within
101
+ its persisted replay window. After the window expires, the replay rejects with
102
+ the error `Subscription <id> requires reconciliation; charge replay protection unavailable or expired`
103
+ and does not charge again. A refused creation stays refused on replay. The
104
+ module never completes a creation that nobody replays, and a charge that such
105
+ a creation made belongs to no subscription. That charge still reaches the
106
+ merchant as a webhook of the payment interface that carries
107
+ `antelopeSubscription`.
82
108
 
83
109
  ## Reconciliation and operational recovery
84
110
 
85
- `guaranteedReplayMs` defaults to zero: the first call is allowed, but an uncertain
86
- result is not blindly replayed. Set a positive value only from a documented
87
- provider guarantee that covers every account using this module, with a safety
88
- margin. Transient errors are retried only strictly before the saved deadline;
89
- declines follow the separate finite `retryDelaysMs` policy with new attempt keys.
111
+ `guaranteedReplayMs` defaults to zero. The module makes the first call, but it
112
+ does not replay an uncertain result blindly. Set a positive value only from a
113
+ documented provider guarantee that covers every account that uses this module,
114
+ with a safety margin. The module retries transient errors only strictly before
115
+ the saved deadline. Declines follow the separate, finite `retryDelaysMs` policy
116
+ with new attempt keys.
90
117
 
91
118
  Live subscriptions expose `reconciliationRequired`, `attemptStartedAt`,
92
- `attemptReplayUntil` and `phase` in `vendorData`. A halted record has no next
93
- charge scheduled. Cancellation and payment-method changes do not clear that
94
- hold. Initial creations expose the hold through the replay error and persisted
95
- record because they are not yet public live subscriptions.
96
-
97
- For operational recovery:
98
-
99
- 1. Stop all module instances/triggers and drain in-flight requests. Back up the
100
- record and retain its revision, provider account, attempt key, timing and
101
- payment method. Never delete the record or reset timing to force a replay.
102
- 2. Search the provider's authoritative ledger, including webhooks and metadata
103
- `antelopeSubscription`, using the original account and attempt key. If the
104
- result is still unknown, leave the hold in place and escalate to the provider.
105
- 3. If a payment is found, verify its customer, method, amount, currency,
106
- subscription metadata and original attempt key. Recover the target period
119
+ `attemptReplayUntil`, and `phase` in `vendorData`. A halted record has no next
120
+ charge scheduled. Cancellation and payment method changes do not clear the
121
+ hold. An initial creation is not a public live subscription yet, so it exposes
122
+ the hold through the replay error and the persisted record.
123
+
124
+ To recover a halted subscription:
125
+
126
+ 1. Stop all module instances and triggers, and drain the requests in flight.
127
+ Back up the record, and keep its revision, provider account, attempt key,
128
+ timing, and payment method. Never delete the record or reset its timing to
129
+ force a replay.
130
+ 2. Search the authoritative ledger of the provider, including webhooks and the
131
+ metadata key `antelopeSubscription`, with the original account and attempt
132
+ key. If the result is still unknown, leave the hold in place and escalate to
133
+ the provider.
134
+ 3. If you find a payment, verify its customer, method, amount, currency,
135
+ subscription metadata, and original attempt key. Recover the target period
107
136
  index from that key (`payment-subscriptions:<id>:<period>:<attempt>`), not
108
- from the record's last paid period. If the target cannot be established,
137
+ from the last paid period of the record. If you cannot establish the target,
109
138
  leave the hold in place.
110
- An operator-reviewed, revision-conditional database repair can attach that ID
111
- as `pendingPayment`, clear `reconciliationRequired`, and set `nextActionAt`
112
- and `dueAt` to now with the lease cleared. Set `periodIndex` to the recovered
113
- target for every record, including renewals; the initial charge targets `0`.
114
- For a `creating` record, replay the original creation key: it reads that
115
- payment instead of charging. For a live
116
- record, restart processing to read and apply its actual status. Keep the
117
- original attempt identity and timing intact.
118
- 4. If the provider conclusively proves no charge exists, prefer retiring the
119
- held subscription and creating a replacement with a new key under an audited
120
- merchant decision. Do not silently retry the uncertain attempt. Resolve any
139
+ An operator-reviewed database repair, conditional on the revision, can
140
+ attach that ID as `pendingPayment`, clear `reconciliationRequired`, and set
141
+ `nextActionAt` and `dueAt` to now with the lease cleared. Set `periodIndex`
142
+ to the recovered target for every record, renewals included. The initial
143
+ charge targets `0`. For a `creating` record, replay the original creation
144
+ key, and the module reads that payment instead of charging. For a live
145
+ record, restart processing so that the module reads and applies the actual
146
+ status of the payment. Keep the original attempt identity and timing intact.
147
+ 4. If the provider proves that no charge exists, prefer to retire the held
148
+ subscription and create a replacement with a new key, under an audited
149
+ merchant decision. Do not retry the uncertain attempt silently. Resolve any
121
150
  provider schedule registration as well. Refunds and entitlement corrections
122
- remain merchant operations.
151
+ stay merchant operations.
123
152
 
124
- There is intentionally no portable force-retry or reconciliation API. Database
125
- repair requires provider-specific evidence and an audit trail; an elapsed lease,
126
- a method update or a longer configuration value is not evidence of non-payment.
153
+ The module has no portable force-retry or reconciliation API, on purpose. A
154
+ database repair needs evidence from the provider and an audit trail. An
155
+ elapsed lease, a method update, or a longer configuration value is not
156
+ evidence of non-payment.
@@ -1,13 +1,19 @@
1
- # The provider schedule
1
+ ---
2
+ title: The provider schedule
3
+ description: Why the module can mirror part of a subscription with a provider such as Mangopay, and how the providerSchedule extension point works.
4
+ mode: explanation
5
+ ---
2
6
 
3
- This module always owns the clock. Some providers that leave the merchant to
4
- fire each charge will still store the schedule, and handle the authentication
5
- chain between charges, if asked. Mangopay's Recurring PayIn Registration stores
6
- frequency, dates and amounts and chains the customer-initiated first payment to
7
- the merchant-initiated ones; Mangopay still does not fire them.
7
+ This module always owns the clock. Some providers leave the merchant to fire
8
+ each charge, but still store the schedule if asked, and handle the
9
+ authentication chain between charges. The Recurring PayIn Registration of
10
+ Mangopay stores the frequency, the dates, and the amounts. It chains the first
11
+ payment, which the customer starts, to the later payments, which the merchant
12
+ starts. Mangopay still does not fire those payments.
8
13
 
9
- For those, part of a subscription's state can live with the provider as well as
10
- in this module's database. The seam for it is `ProviderSchedule`:
14
+ For those providers, part of the state of a subscription can live with the
15
+ provider as well as in the database of this module. The extension point for it
16
+ is the `ProviderSchedule` interface in `src/schedule.ts`:
11
17
 
12
18
  | Call | When | The default |
13
19
  | ---------- | ---------------------------------------------- | ------------------------------ |
@@ -15,17 +21,20 @@ in this module's database. The seam for it is `ProviderSchedule`:
15
21
  | `charge` | Each time a period is charged | An off-session `CreatePayment` |
16
22
  | `release` | Once, when a subscription ends, for any reason | Does nothing |
17
23
 
18
- What `register` returns is stored with the subscription and handed to every
19
- `charge` and `release`. A schedule never decides when to charge, and never
20
- throws for a decline: a declined charge resolves with a `failed` payment, as
21
- `CreatePayment` does.
24
+ The module stores what `register` returns with the subscription, and hands it
25
+ to every `charge` and `release` call. A schedule never decides when to charge.
26
+ It never throws for a decline either. A declined charge resolves with a
27
+ `failed` payment, as `CreatePayment` does.
22
28
 
23
- `register` runs before the subscription is stored and is given no idempotency
24
- key, so two creations racing on one key may both call it. A schedule that
25
- registers anything real must tolerate that, or derive its own key from the
26
- subscription identifier it is handed.
29
+ `register` runs before the module stores the subscription, and it receives no
30
+ idempotency key. Two creations that race on one key can therefore both call
31
+ it. A schedule that registers anything real must tolerate that, or derive its
32
+ own key from the subscription ID that it receives.
27
33
 
28
- The schedule is chosen by the `providerSchedule` setting. Only the default,
29
- `payment-interface`, exists. A Mangopay schedule would charge against the
30
- registration through the Mangopay module's own interface, which is the escape
31
- hatch for provider-specific behaviour everywhere else in AntelopeJS.
34
+ The `providerSchedule` setting chooses the schedule. Only the default,
35
+ `payment-interface`, exists. Any other name makes the module throw at
36
+ construction, with an error that lists the known names. A Mangopay schedule
37
+ would charge against the registration through an interface of the Mangopay
38
+ module itself. Everywhere else in AntelopeJS, provider-specific behaviour also
39
+ goes through the interface of the provider module, not through the portable
40
+ interfaces.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/payment-subscriptions",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Generic AntelopeJS subscriptions on top of any payment interface provider: saved methods charged off-session, on a renewal clock the module owns",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -33,17 +33,17 @@
33
33
  "scripts": {
34
34
  "build": "rimraf dist && tsc",
35
35
  "format": "oxfmt .",
36
- "lint": "oxlint",
36
+ "lint": "oxlint && antelopejs-check-interface-ranges",
37
37
  "lint:fix": "oxlint --fix",
38
38
  "prepack": "pnpm run build",
39
- "release": "pnpm run lint && pnpm run test && pnpm run prepack && release-it",
39
+ "release": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run prepack && release-it",
40
40
  "test": "pnpm run build && pnpm run test:polling && pnpm run test:redis",
41
41
  "test:polling": "ajs module test .",
42
42
  "test:redis": "ANTELOPE_SUBSCRIPTIONS_TEST_CLOCK=redis ajs module test .",
43
43
  "typecheck": "tsc --noEmit",
44
44
  "format:check": "oxfmt --check .",
45
45
  "knip": "knip",
46
- "prepare": "if git rev-parse --is-inside-work-tree >/dev/null 2>&1 && command -v lefthook >/dev/null 2>&1; then lefthook install; fi",
46
+ "prepare": "if [ -e .git ] && command -v git >/dev/null 2>&1 && command -v lefthook >/dev/null 2>&1 && GIT_DIR=.git GIT_WORK_TREE=. git rev-parse --git-dir >/dev/null 2>&1; then GIT_DIR=.git GIT_WORK_TREE=. lefthook install; fi",
47
47
  "checks": "antelopejs-checks",
48
48
  "size": "antelopejs-check-size",
49
49
  "sync": "antelopejs-sync",
@@ -52,18 +52,20 @@
52
52
  "suppressions:update": "antelopejs-suppressions --update"
53
53
  },
54
54
  "dependencies": {
55
- "@antelopejs/interface-core": ">=0.0.5 <1.0.0",
55
+ "@antelopejs/interface-core": ">=0.2.4 <1.0.0",
56
56
  "@antelopejs/interface-database": ">=0.2.0 <1.0.0",
57
57
  "@antelopejs/interface-payment": ">=0.0.2 <1.0.0",
58
58
  "@antelopejs/interface-subscriptions": ">=0.1.0 <0.2.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@antelopejs/core": "1.16.0",
61
+ "@antelopejs/core": "1.21.0",
62
62
  "@antelopejs/mongodb": "^1.6.0",
63
63
  "@antelopejs/redis": "^1.0.3",
64
- "@antelopejs/tooling-configs": "^0.2.11",
64
+ "@antelopejs/tooling-configs": "^0.5.1",
65
65
  "@types/mocha": "^10.0.10",
66
66
  "@types/node": "^22.19.15",
67
+ "@types/semver": "^7.8.0",
68
+ "@types/tmp": "^0.2.6",
67
69
  "eslint-plugin-perfectionist": "^5.11.0",
68
70
  "knip": "^6.34.0",
69
71
  "lefthook": "^2.2.2",
@@ -78,7 +80,7 @@
78
80
  "typescript": "^5.9.3"
79
81
  },
80
82
  "optionalDependencies": {
81
- "@antelopejs/interface-redis": ">=0.0.6 <1.0.0",
83
+ "@antelopejs/interface-redis": ">=0.0.9 <1.0.0",
82
84
  "@antelopejs/interface-redis-scheduler": ">=0.0.9 <1.0.0"
83
85
  },
84
86
  "packageManager": "pnpm@10.6.5",
@@ -90,6 +92,9 @@
90
92
  "test": "src/test/antelope.test.ts",
91
93
  "skills": [
92
94
  "./skills"
93
- ]
95
+ ],
96
+ "docs": {
97
+ "standard": true
98
+ }
94
99
  }
95
100
  }