@blocklet/payment-js 1.23.11 → 1.24.0

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/lib/index.d.ts CHANGED
@@ -197,6 +197,27 @@ declare const _default: {
197
197
  }) => Promise<import("@blocklet/payment-types").TPriceExpanded>;
198
198
  };
199
199
  subscriptions: {
200
+ create: (_params: never, data?: {
201
+ customer_id: string;
202
+ items: {
203
+ price_id: string;
204
+ quantity?: number;
205
+ metadata?: Record<string, any>;
206
+ }[];
207
+ default_payment_method_id?: string;
208
+ currency_id?: string;
209
+ trial_period_days?: number;
210
+ trial_end?: number;
211
+ description?: string;
212
+ metadata?: Record<string, any>;
213
+ days_until_due?: number;
214
+ days_until_cancel?: number;
215
+ billing_cycle_anchor?: number;
216
+ collection_method?: "charge_automatically" | "send_invoice";
217
+ proration_behavior?: "always_invoice" | "create_prorations" | "none";
218
+ service_actions?: Record<string, any>[];
219
+ livemode?: boolean;
220
+ }) => Promise<import("@blocklet/payment-types").TSubscriptionExpanded>;
200
221
  retrieve: (_params: string, data?: never) => Promise<import("@blocklet/payment-types").TSubscriptionExpanded>;
201
222
  update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@blocklet/payment-types").Subscription, {
202
223
  omit: never;
@@ -12,7 +12,35 @@ type CancelBodyType = {
12
12
  slashReason?: string;
13
13
  cancel_from?: 'customer' | 'admin';
14
14
  };
15
+ type SubscriptionCreateItem = {
16
+ price_id: string;
17
+ quantity?: number;
18
+ metadata?: Record<string, any>;
19
+ };
20
+ type SubscriptionCreateBody = {
21
+ customer_id: string;
22
+ items: SubscriptionCreateItem[];
23
+ /**
24
+ * Optional: if not provided, subscription won't have automatic billing.
25
+ * Use this for prepaid/gifted subscriptions (e.g., credit redemption, promotional subscriptions).
26
+ */
27
+ default_payment_method_id?: string;
28
+ currency_id?: string;
29
+ trial_period_days?: number;
30
+ trial_end?: number;
31
+ description?: string;
32
+ metadata?: Record<string, any>;
33
+ days_until_due?: number;
34
+ days_until_cancel?: number;
35
+ billing_cycle_anchor?: number;
36
+ collection_method?: 'charge_automatically' | 'send_invoice';
37
+ proration_behavior?: 'always_invoice' | 'create_prorations' | 'none';
38
+ service_actions?: Record<string, any>[];
39
+ /** Optional: defaults to true if not provided */
40
+ livemode?: boolean;
41
+ };
15
42
  declare const _default: {
43
+ create: (_params: never, data?: SubscriptionCreateBody) => Promise<TSubscriptionExpanded>;
16
44
  retrieve: (_params: string, data?: never) => Promise<TSubscriptionExpanded>;
17
45
  update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@blocklet/payment-types").Subscription, {
18
46
  omit: never;
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const resource_1 = require("../resource");
4
4
  exports.default = {
5
- // create: createResourceCreateMethod<TSubscription, Partial<TSubscriptionExpanded>, never>({
6
- // method: 'POST',
7
- // path: '/api/subscriptions',
8
- // }),
5
+ create: (0, resource_1.createResourceMethod)({
6
+ method: 'POST',
7
+ path: '/api/subscriptions',
8
+ }),
9
9
  retrieve: (0, resource_1.createResourceMethod)({
10
10
  method: 'GET',
11
11
  path: '/api/subscriptions/{id}',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-js",
3
- "version": "1.23.11",
3
+ "version": "1.24.0",
4
4
  "description": "Node.js client for Payment Kit",
5
5
  "keywords": [
6
6
  "types",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@blocklet/constant": "^1.17.8-beta-20260104-120132-cb5b1914",
40
- "@blocklet/payment-types": "1.23.11",
40
+ "@blocklet/payment-types": "1.24.0",
41
41
  "@blocklet/sdk": "^1.17.8-beta-20260104-120132-cb5b1914"
42
42
  },
43
43
  "importSort": {
@@ -64,5 +64,5 @@
64
64
  "type-fest": "^4.41.0",
65
65
  "typescript": "5.5.4"
66
66
  },
67
- "gitHead": "72af80fc6e91e88058665212985002966f55787c"
67
+ "gitHead": "f3fad0829a1377422d51f9b6445a3502d0e94719"
68
68
  }