@deliverart/sdk-js-subscription 2.13.3 → 2.13.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
@@ -4,6 +4,9 @@ Subscription management package for the Deliverart JavaScript SDK.
4
4
 
5
5
  ## Highlights
6
6
 
7
+ - subscription plan CRUD for backoffice/admin flows
8
+ - public catalog for purchasable subscription plans
9
+ - initial subscription purchase flow with payment start and offline payment resolution
7
10
  - subscription CRUD for `infinite`, `consumption` and `time_based`
8
11
  - renewal CRUD for `consumption` and `time_based`
9
12
  - subscription overview from point of sale
@@ -11,6 +14,54 @@ Subscription management package for the Deliverart JavaScript SDK.
11
14
  - renewal payment initialization for `stripe`, `bank_transfer`, `cash` and `credit_card`
12
15
  - manual renewal payment resolution for offline payment methods
13
16
 
17
+ ## Subscription Plan Catalog
18
+
19
+ ```ts
20
+ import { GetSubscriptionPlanCatalog } from '@deliverart/sdk-js-subscription'
21
+
22
+ const plans = await sdk.call(new GetSubscriptionPlanCatalog())
23
+ ```
24
+
25
+ Each catalog item exposes the plan configuration plus `priceOptions`, already sorted by threshold.
26
+
27
+ ## Subscription Purchase
28
+
29
+ Create a purchase from a public plan:
30
+
31
+ ```ts
32
+ import { CreateSubscriptionPurchase } from '@deliverart/sdk-js-subscription'
33
+
34
+ const purchase = await sdk.call(
35
+ new CreateSubscriptionPurchase({
36
+ pointOfSale: '/point_of_sales/pos-id',
37
+ plan: '/subscription_plans/plan-id',
38
+ }),
39
+ )
40
+ ```
41
+
42
+ Start payment for the purchase:
43
+
44
+ ```ts
45
+ import { PaySubscriptionPurchase } from '@deliverart/sdk-js-subscription'
46
+
47
+ const payment = await sdk.call(
48
+ new PaySubscriptionPurchase('purchase-id', 'cash'),
49
+ )
50
+ ```
51
+
52
+ Resolve offline payment:
53
+
54
+ ```ts
55
+ import { ResolveSubscriptionPurchasePayment } from '@deliverart/sdk-js-subscription'
56
+
57
+ await sdk.call(
58
+ new ResolveSubscriptionPurchasePayment('purchase-id', {
59
+ status: 'paid',
60
+ response: 'verified by admin',
61
+ }),
62
+ )
63
+ ```
64
+
14
65
  ## Renewal Payment Start
15
66
 
16
67
  Consumption renewal: