@deliverart/sdk-js-subscription 2.13.4 → 2.13.6
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 +71 -0
- package/dist/index.cjs +367 -60
- package/dist/index.d.cts +1909 -609
- package/dist/index.d.ts +1909 -609
- package/dist/index.js +335 -60
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ Subscription management package for the Deliverart JavaScript SDK.
|
|
|
6
6
|
|
|
7
7
|
- subscription plan CRUD for backoffice/admin flows
|
|
8
8
|
- public catalog for purchasable subscription plans
|
|
9
|
+
- initial subscription purchase flow with payment start and offline payment resolution
|
|
9
10
|
- subscription CRUD for `infinite`, `consumption` and `time_based`
|
|
10
11
|
- renewal CRUD for `consumption` and `time_based`
|
|
11
12
|
- subscription overview from point of sale
|
|
@@ -23,6 +24,76 @@ const plans = await sdk.call(new GetSubscriptionPlanCatalog())
|
|
|
23
24
|
|
|
24
25
|
Each catalog item exposes the plan configuration plus `priceOptions`, already sorted by threshold.
|
|
25
26
|
|
|
27
|
+
Preview the self-service charge before creating a purchase:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { CalculateSubscriptionPlanPurchaseQuote } from '@deliverart/sdk-js-subscription'
|
|
31
|
+
|
|
32
|
+
const quote = await sdk.call(
|
|
33
|
+
new CalculateSubscriptionPlanPurchaseQuote('plan-id', {
|
|
34
|
+
pointOfSale: '/point_of_sales/pos-id',
|
|
35
|
+
startsAt: '2026-04-05',
|
|
36
|
+
}),
|
|
37
|
+
)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The response includes `threshold`, `unitPrice`, `amount`, `type`, `startsAt` and the effective `autoRenewal`.
|
|
41
|
+
|
|
42
|
+
## Admin Plan Assignment
|
|
43
|
+
|
|
44
|
+
Assign a plan directly to a point of sale without going through the public purchase flow:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { AssignSubscriptionPlan } from '@deliverart/sdk-js-subscription'
|
|
48
|
+
|
|
49
|
+
const subscription = await sdk.call(
|
|
50
|
+
new AssignSubscriptionPlan('plan-id', {
|
|
51
|
+
pointOfSale: '/point_of_sales/pos-id',
|
|
52
|
+
startsAt: '2026-04-01',
|
|
53
|
+
}),
|
|
54
|
+
)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This operation is intended for admin/backoffice flows, including `adminOnly` and `infinite` plans.
|
|
58
|
+
|
|
59
|
+
## Subscription Purchase
|
|
60
|
+
|
|
61
|
+
Create a purchase from a public plan:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { CreateSubscriptionPurchase } from '@deliverart/sdk-js-subscription'
|
|
65
|
+
|
|
66
|
+
const purchase = await sdk.call(
|
|
67
|
+
new CreateSubscriptionPurchase({
|
|
68
|
+
pointOfSale: '/point_of_sales/pos-id',
|
|
69
|
+
plan: '/subscription_plans/plan-id',
|
|
70
|
+
}),
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Start payment for the purchase:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { PaySubscriptionPurchase } from '@deliverart/sdk-js-subscription'
|
|
78
|
+
|
|
79
|
+
const payment = await sdk.call(
|
|
80
|
+
new PaySubscriptionPurchase('purchase-id', 'cash'),
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Resolve offline payment:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { ResolveSubscriptionPurchasePayment } from '@deliverart/sdk-js-subscription'
|
|
88
|
+
|
|
89
|
+
await sdk.call(
|
|
90
|
+
new ResolveSubscriptionPurchasePayment('purchase-id', {
|
|
91
|
+
status: 'paid',
|
|
92
|
+
response: 'verified by admin',
|
|
93
|
+
}),
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
26
97
|
## Renewal Payment Start
|
|
27
98
|
|
|
28
99
|
Consumption renewal:
|