@deliverart/sdk-js-subscription 2.13.2 → 2.13.4

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,3 +1,82 @@
1
1
  # @deliverart/sdk-js-subscription
2
2
 
3
3
  Subscription management package for the Deliverart JavaScript SDK.
4
+
5
+ ## Highlights
6
+
7
+ - subscription plan CRUD for backoffice/admin flows
8
+ - public catalog for purchasable subscription plans
9
+ - subscription CRUD for `infinite`, `consumption` and `time_based`
10
+ - renewal CRUD for `consumption` and `time_based`
11
+ - subscription overview from point of sale
12
+ - credit adjustments for consumption subscriptions
13
+ - renewal payment initialization for `stripe`, `bank_transfer`, `cash` and `credit_card`
14
+ - manual renewal payment resolution for offline payment methods
15
+
16
+ ## Subscription Plan Catalog
17
+
18
+ ```ts
19
+ import { GetSubscriptionPlanCatalog } from '@deliverart/sdk-js-subscription'
20
+
21
+ const plans = await sdk.call(new GetSubscriptionPlanCatalog())
22
+ ```
23
+
24
+ Each catalog item exposes the plan configuration plus `priceOptions`, already sorted by threshold.
25
+
26
+ ## Renewal Payment Start
27
+
28
+ Consumption renewal:
29
+
30
+ ```ts
31
+ import { PaySubscriptionConsumptionRenewal } from '@deliverart/sdk-js-subscription'
32
+
33
+ const payment = await sdk.call(
34
+ new PaySubscriptionConsumptionRenewal('renewal-id', 'bank_transfer'),
35
+ )
36
+ ```
37
+
38
+ Time-based renewal:
39
+
40
+ ```ts
41
+ import { PaySubscriptionTimeBasedRenewal } from '@deliverart/sdk-js-subscription'
42
+
43
+ const payment = await sdk.call(
44
+ new PaySubscriptionTimeBasedRenewal('renewal-id', 'stripe'),
45
+ )
46
+ ```
47
+
48
+ Both requests return the same `PaymentInfo` shape used by the payment SDK area.
49
+
50
+ ## Renewal Payment Resolution
51
+
52
+ Consumption renewal:
53
+
54
+ ```ts
55
+ import { ResolveSubscriptionConsumptionRenewalPayment } from '@deliverart/sdk-js-subscription'
56
+
57
+ await sdk.call(
58
+ new ResolveSubscriptionConsumptionRenewalPayment('renewal-id', {
59
+ status: 'paid',
60
+ response: 'verified by admin',
61
+ }),
62
+ )
63
+ ```
64
+
65
+ Time-based renewal:
66
+
67
+ ```ts
68
+ import { ResolveSubscriptionTimeBasedRenewalPayment } from '@deliverart/sdk-js-subscription'
69
+
70
+ await sdk.call(
71
+ new ResolveSubscriptionTimeBasedRenewalPayment('renewal-id', {
72
+ status: 'failed',
73
+ response: 'bank transfer rejected',
74
+ }),
75
+ )
76
+ ```
77
+
78
+ Allowed statuses are `paid`, `failed` and `canceled`.
79
+
80
+ ## Renewal Payment Relation
81
+
82
+ Renewal list/detail schemas now expose the linked `payment` IRI when a payment attempt already exists.