@usehercules/sdk 1.2.0 → 1.4.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/CHANGELOG.md +129 -0
- package/LICENSE +1 -1
- package/README.md +14 -20
- package/client.d.mts +6 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -3
- package/client.d.ts.map +1 -1
- package/client.js +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/beta.d.mts +4 -4
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +4 -4
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +4 -4
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +4 -4
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.mts +1 -1
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +1 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +3 -3
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/pay/coupons.d.mts +156 -0
- package/resources/beta/pay/coupons.d.mts.map +1 -0
- package/resources/beta/pay/coupons.d.ts +156 -0
- package/resources/beta/pay/coupons.d.ts.map +1 -0
- package/resources/beta/pay/coupons.js +51 -0
- package/resources/beta/pay/coupons.js.map +1 -0
- package/resources/beta/pay/coupons.mjs +47 -0
- package/resources/beta/pay/coupons.mjs.map +1 -0
- package/resources/beta/pay/customers.d.mts +160 -0
- package/resources/beta/pay/customers.d.mts.map +1 -0
- package/resources/beta/pay/customers.d.ts +160 -0
- package/resources/beta/pay/customers.d.ts.map +1 -0
- package/resources/beta/pay/customers.js +60 -0
- package/resources/beta/pay/customers.js.map +1 -0
- package/resources/beta/pay/customers.mjs +56 -0
- package/resources/beta/pay/customers.mjs.map +1 -0
- package/resources/beta/{subscriptions → pay}/entitlements.d.mts +25 -19
- package/resources/beta/pay/entitlements.d.mts.map +1 -0
- package/resources/beta/{subscriptions → pay}/entitlements.d.ts +25 -19
- package/resources/beta/pay/entitlements.d.ts.map +1 -0
- package/resources/beta/pay/entitlements.js +41 -0
- package/resources/beta/pay/entitlements.js.map +1 -0
- package/resources/beta/pay/entitlements.mjs +37 -0
- package/resources/beta/pay/entitlements.mjs.map +1 -0
- package/resources/beta/{subscriptions → pay}/index.d.mts +2 -2
- package/resources/beta/pay/index.d.mts.map +1 -0
- package/resources/beta/{subscriptions → pay}/index.d.ts +2 -2
- package/resources/beta/pay/index.d.ts.map +1 -0
- package/resources/beta/{subscriptions → pay}/index.js +5 -5
- package/resources/beta/pay/index.js.map +1 -0
- package/resources/beta/{subscriptions → pay}/index.mjs +2 -2
- package/resources/beta/pay/index.mjs.map +1 -0
- package/resources/beta/pay/pay.d.mts +206 -0
- package/resources/beta/pay/pay.d.mts.map +1 -0
- package/resources/beta/pay/pay.d.ts +206 -0
- package/resources/beta/pay/pay.d.ts.map +1 -0
- package/resources/beta/pay/pay.js +54 -0
- package/resources/beta/pay/pay.js.map +1 -0
- package/resources/beta/pay/pay.mjs +49 -0
- package/resources/beta/pay/pay.mjs.map +1 -0
- package/resources/beta/pay/products/entitlements.d.mts +53 -0
- package/resources/beta/pay/products/entitlements.d.mts.map +1 -0
- package/resources/beta/pay/products/entitlements.d.ts +53 -0
- package/resources/beta/pay/products/entitlements.d.ts.map +1 -0
- package/resources/beta/pay/products/entitlements.js +38 -0
- package/resources/beta/pay/products/entitlements.js.map +1 -0
- package/resources/beta/pay/products/entitlements.mjs +34 -0
- package/resources/beta/pay/products/entitlements.mjs.map +1 -0
- package/resources/beta/pay/products/index.d.mts +4 -0
- package/resources/beta/pay/products/index.d.mts.map +1 -0
- package/resources/beta/pay/products/index.d.ts +4 -0
- package/resources/beta/pay/products/index.d.ts.map +1 -0
- package/resources/beta/pay/products/index.js +11 -0
- package/resources/beta/pay/products/index.js.map +1 -0
- package/resources/beta/{subscriptions/plans → pay/products}/index.mjs +2 -1
- package/resources/beta/pay/products/index.mjs.map +1 -0
- package/resources/beta/pay/products/products.d.mts +183 -0
- package/resources/beta/pay/products/products.d.mts.map +1 -0
- package/resources/beta/pay/products/products.d.ts +183 -0
- package/resources/beta/pay/products/products.d.ts.map +1 -0
- package/resources/beta/pay/products/products.js +61 -0
- package/resources/beta/pay/products/products.js.map +1 -0
- package/resources/beta/pay/products/products.mjs +56 -0
- package/resources/beta/pay/products/products.mjs.map +1 -0
- package/resources/beta/pay/products/variants.d.mts +206 -0
- package/resources/beta/pay/products/variants.d.mts.map +1 -0
- package/resources/beta/pay/products/variants.d.ts +206 -0
- package/resources/beta/pay/products/variants.d.ts.map +1 -0
- package/resources/beta/pay/products/variants.js +56 -0
- package/resources/beta/pay/products/variants.js.map +1 -0
- package/resources/beta/pay/products/variants.mjs +52 -0
- package/resources/beta/pay/products/variants.mjs.map +1 -0
- package/resources/beta/pay/products.d.mts +2 -0
- package/resources/beta/pay/products.d.mts.map +1 -0
- package/resources/beta/pay/products.d.ts +2 -0
- package/resources/beta/pay/products.d.ts.map +1 -0
- package/resources/beta/{subscriptions/plans.js → pay/products.js} +2 -2
- package/resources/beta/pay/products.js.map +1 -0
- package/resources/beta/{subscriptions.mjs → pay/products.mjs} +2 -2
- package/resources/beta/pay/products.mjs.map +1 -0
- package/resources/beta/pay.d.mts +2 -0
- package/resources/beta/pay.d.mts.map +1 -0
- package/resources/beta/pay.d.ts +2 -0
- package/resources/beta/pay.d.ts.map +1 -0
- package/resources/beta/{subscriptions.js → pay.js} +2 -2
- package/resources/beta/pay.js.map +1 -0
- package/resources/beta/{subscriptions/plans.mjs → pay.mjs} +2 -2
- package/resources/beta/pay.mjs.map +1 -0
- package/src/client.ts +6 -4
- package/src/resources/beta/beta.ts +18 -18
- package/src/resources/beta/index.ts +8 -8
- package/src/resources/beta/pay/coupons.ts +218 -0
- package/src/resources/beta/pay/customers.ts +229 -0
- package/src/resources/beta/{subscriptions → pay}/entitlements.ts +29 -29
- package/src/resources/beta/{subscriptions → pay}/index.ts +15 -15
- package/src/resources/beta/pay/pay.ts +326 -0
- package/src/resources/beta/{subscriptions/plans → pay/products}/entitlements.ts +26 -21
- package/src/resources/beta/pay/products/index.ts +28 -0
- package/src/resources/beta/pay/products/products.ts +280 -0
- package/src/resources/beta/pay/products/variants.ts +279 -0
- package/src/resources/beta/{subscriptions.ts → pay/products.ts} +1 -1
- package/src/resources/beta/{subscriptions/plans.ts → pay.ts} +1 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/beta/subscriptions/coupons.d.mts +0 -124
- package/resources/beta/subscriptions/coupons.d.mts.map +0 -1
- package/resources/beta/subscriptions/coupons.d.ts +0 -124
- package/resources/beta/subscriptions/coupons.d.ts.map +0 -1
- package/resources/beta/subscriptions/coupons.js +0 -45
- package/resources/beta/subscriptions/coupons.js.map +0 -1
- package/resources/beta/subscriptions/coupons.mjs +0 -41
- package/resources/beta/subscriptions/coupons.mjs.map +0 -1
- package/resources/beta/subscriptions/customers.d.mts +0 -93
- package/resources/beta/subscriptions/customers.d.mts.map +0 -1
- package/resources/beta/subscriptions/customers.d.ts +0 -93
- package/resources/beta/subscriptions/customers.d.ts.map +0 -1
- package/resources/beta/subscriptions/customers.js +0 -57
- package/resources/beta/subscriptions/customers.js.map +0 -1
- package/resources/beta/subscriptions/customers.mjs +0 -53
- package/resources/beta/subscriptions/customers.mjs.map +0 -1
- package/resources/beta/subscriptions/entitlements.d.mts.map +0 -1
- package/resources/beta/subscriptions/entitlements.d.ts.map +0 -1
- package/resources/beta/subscriptions/entitlements.js +0 -38
- package/resources/beta/subscriptions/entitlements.js.map +0 -1
- package/resources/beta/subscriptions/entitlements.mjs +0 -34
- package/resources/beta/subscriptions/entitlements.mjs.map +0 -1
- package/resources/beta/subscriptions/index.d.mts.map +0 -1
- package/resources/beta/subscriptions/index.d.ts.map +0 -1
- package/resources/beta/subscriptions/index.js.map +0 -1
- package/resources/beta/subscriptions/index.mjs.map +0 -1
- package/resources/beta/subscriptions/plans/entitlements.d.mts +0 -48
- package/resources/beta/subscriptions/plans/entitlements.d.mts.map +0 -1
- package/resources/beta/subscriptions/plans/entitlements.d.ts +0 -48
- package/resources/beta/subscriptions/plans/entitlements.d.ts.map +0 -1
- package/resources/beta/subscriptions/plans/entitlements.js +0 -34
- package/resources/beta/subscriptions/plans/entitlements.js.map +0 -1
- package/resources/beta/subscriptions/plans/entitlements.mjs +0 -30
- package/resources/beta/subscriptions/plans/entitlements.mjs.map +0 -1
- package/resources/beta/subscriptions/plans/index.d.mts +0 -3
- package/resources/beta/subscriptions/plans/index.d.mts.map +0 -1
- package/resources/beta/subscriptions/plans/index.d.ts +0 -3
- package/resources/beta/subscriptions/plans/index.d.ts.map +0 -1
- package/resources/beta/subscriptions/plans/index.js +0 -9
- package/resources/beta/subscriptions/plans/index.js.map +0 -1
- package/resources/beta/subscriptions/plans/index.mjs.map +0 -1
- package/resources/beta/subscriptions/plans/plans.d.mts +0 -87
- package/resources/beta/subscriptions/plans/plans.d.mts.map +0 -1
- package/resources/beta/subscriptions/plans/plans.d.ts +0 -87
- package/resources/beta/subscriptions/plans/plans.d.ts.map +0 -1
- package/resources/beta/subscriptions/plans/plans.js +0 -49
- package/resources/beta/subscriptions/plans/plans.js.map +0 -1
- package/resources/beta/subscriptions/plans/plans.mjs +0 -44
- package/resources/beta/subscriptions/plans/plans.mjs.map +0 -1
- package/resources/beta/subscriptions/plans.d.mts +0 -2
- package/resources/beta/subscriptions/plans.d.mts.map +0 -1
- package/resources/beta/subscriptions/plans.d.ts +0 -2
- package/resources/beta/subscriptions/plans.d.ts.map +0 -1
- package/resources/beta/subscriptions/plans.js.map +0 -1
- package/resources/beta/subscriptions/plans.mjs.map +0 -1
- package/resources/beta/subscriptions/subscriptions.d.mts +0 -130
- package/resources/beta/subscriptions/subscriptions.d.mts.map +0 -1
- package/resources/beta/subscriptions/subscriptions.d.ts +0 -130
- package/resources/beta/subscriptions/subscriptions.d.ts.map +0 -1
- package/resources/beta/subscriptions/subscriptions.js +0 -47
- package/resources/beta/subscriptions/subscriptions.js.map +0 -1
- package/resources/beta/subscriptions/subscriptions.mjs +0 -42
- package/resources/beta/subscriptions/subscriptions.mjs.map +0 -1
- package/resources/beta/subscriptions.d.mts +0 -2
- package/resources/beta/subscriptions.d.mts.map +0 -1
- package/resources/beta/subscriptions.d.ts +0 -2
- package/resources/beta/subscriptions.d.ts.map +0 -1
- package/resources/beta/subscriptions.js.map +0 -1
- package/resources/beta/subscriptions.mjs.map +0 -1
- package/src/resources/beta/subscriptions/coupons.ts +0 -185
- package/src/resources/beta/subscriptions/customers.ts +0 -168
- package/src/resources/beta/subscriptions/plans/index.ts +0 -18
- package/src/resources/beta/subscriptions/plans/plans.ts +0 -159
- package/src/resources/beta/subscriptions/subscriptions.ts +0 -241
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
3
|
+
import * as CouponsAPI from "./coupons.mjs";
|
|
4
|
+
import { Coupons, } from "./coupons.mjs";
|
|
5
|
+
import * as CustomersAPI from "./customers.mjs";
|
|
6
|
+
import { Customers, } from "./customers.mjs";
|
|
7
|
+
import * as EntitlementsAPI from "./entitlements.mjs";
|
|
8
|
+
import { Entitlements, } from "./entitlements.mjs";
|
|
9
|
+
import * as ProductsAPI from "./products/products.mjs";
|
|
10
|
+
import { Products, } from "./products/products.mjs";
|
|
11
|
+
export class Pay extends APIResource {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.customers = new CustomersAPI.Customers(this._client);
|
|
15
|
+
this.products = new ProductsAPI.Products(this._client);
|
|
16
|
+
this.entitlements = new EntitlementsAPI.Entitlements(this._client);
|
|
17
|
+
this.coupons = new CouponsAPI.Coupons(this._client);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Cancels a customer's subscription. By default, the subscription remains active
|
|
21
|
+
* until the end of the current billing period. Set cancellation_timing to
|
|
22
|
+
* 'immediate' to cancel immediately.
|
|
23
|
+
*/
|
|
24
|
+
cancel(body, options) {
|
|
25
|
+
return this._client.post('/v1/pay/cancel', { body, ...options });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Verifies if a customer has access to a specific feature. Use this to gate
|
|
29
|
+
* features in your app based on the customer's active subscription and the
|
|
30
|
+
* entitlements attached to their product. Hercules recommends calling this before
|
|
31
|
+
* allowing access to premium features.
|
|
32
|
+
*/
|
|
33
|
+
check(body, options) {
|
|
34
|
+
return this._client.post('/v1/pay/check', { body, ...options });
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a checkout session for a customer to subscribe to a product. Returns a
|
|
38
|
+
* URL to redirect the customer to for payment. After successful payment, the
|
|
39
|
+
* customer is subscribed to the product and gains access to its entitlements.
|
|
40
|
+
*/
|
|
41
|
+
checkout(body, options) {
|
|
42
|
+
return this._client.post('/v1/pay/checkout', { body, ...options });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
Pay.Customers = Customers;
|
|
46
|
+
Pay.Products = Products;
|
|
47
|
+
Pay.Entitlements = Entitlements;
|
|
48
|
+
Pay.Coupons = Coupons;
|
|
49
|
+
//# sourceMappingURL=pay.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay.mjs","sourceRoot":"","sources":["../../../src/resources/beta/pay/pay.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EAKL,OAAO,GAER;OACM,KAAK,YAAY;OACjB,EAQL,SAAS,GAEV;OACM,KAAK,eAAe;OACpB,EAKL,YAAY,GAEb;OACM,KAAK,WAAW;OAChB,EAKL,QAAQ,GAET;AAID,MAAM,OAAO,GAAI,SAAQ,WAAW;IAApC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5F,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6BrE,CAAC;IA3BC;;;;OAIG;IACH,MAAM,CAAC,IAAqB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAoB,EAAE,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAAuB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;CACF;AAkMD,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC;AAC1B,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACxB,GAAG,CAAC,YAAY,GAAG,YAAY,CAAC;AAChC,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { APIResource } from "../../../../core/resource.mjs";
|
|
2
|
+
import * as EntitlementsAPI from "../entitlements.mjs";
|
|
3
|
+
import { APIPromise } from "../../../../core/api-promise.mjs";
|
|
4
|
+
import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../../../../core/pagination.mjs";
|
|
5
|
+
import { RequestOptions } from "../../../../internal/request-options.mjs";
|
|
6
|
+
export declare class Entitlements extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves all entitlements attached to a product. These entitlements define the
|
|
9
|
+
* features that customers subscribed to this product can access.
|
|
10
|
+
*/
|
|
11
|
+
list(productID: string, query?: EntitlementListParams | null | undefined, options?: RequestOptions): PagePromise<ProductEntitlementsCursorIDPage, ProductEntitlement>;
|
|
12
|
+
/**
|
|
13
|
+
* Attaches an entitlement to a product. All customers subscribed to this product
|
|
14
|
+
* will gain access to the attached feature. Hercules recommends attaching
|
|
15
|
+
* entitlements when creating or updating products to keep feature access in sync.
|
|
16
|
+
*/
|
|
17
|
+
attach(productID: string, body: EntitlementAttachParams, options?: RequestOptions): APIPromise<ProductEntitlement>;
|
|
18
|
+
/**
|
|
19
|
+
* Removes an entitlement from a product. Customers subscribed to this product will
|
|
20
|
+
* lose access to the feature. Existing subscriptions are affected immediately.
|
|
21
|
+
*/
|
|
22
|
+
remove(featureID: string, params: EntitlementRemoveParams, options?: RequestOptions): APIPromise<void>;
|
|
23
|
+
}
|
|
24
|
+
export type ProductEntitlementsCursorIDPage = CursorIDPage<ProductEntitlement>;
|
|
25
|
+
/**
|
|
26
|
+
* An entitlement attached to a product. All customers subscribed to the product
|
|
27
|
+
* gain access to this entitlement.
|
|
28
|
+
*/
|
|
29
|
+
export interface ProductEntitlement {
|
|
30
|
+
/**
|
|
31
|
+
* Unique identifier for the price
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
/**
|
|
35
|
+
* The entitlement attached to the product
|
|
36
|
+
*/
|
|
37
|
+
entitlement: EntitlementsAPI.Entitlement;
|
|
38
|
+
}
|
|
39
|
+
export interface EntitlementListParams extends CursorIDPageParams {
|
|
40
|
+
}
|
|
41
|
+
export interface EntitlementAttachParams {
|
|
42
|
+
/**
|
|
43
|
+
* The ID of the entitlement to attach to the product
|
|
44
|
+
*/
|
|
45
|
+
entitlement: string;
|
|
46
|
+
}
|
|
47
|
+
export interface EntitlementRemoveParams {
|
|
48
|
+
product_id: string;
|
|
49
|
+
}
|
|
50
|
+
export declare namespace Entitlements {
|
|
51
|
+
export { type ProductEntitlement as ProductEntitlement, type ProductEntitlementsCursorIDPage as ProductEntitlementsCursorIDPage, type EntitlementListParams as EntitlementListParams, type EntitlementAttachParams as EntitlementAttachParams, type EntitlementRemoveParams as EntitlementRemoveParams, };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=entitlements.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.d.mts","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/entitlements.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,eAAe;OACpB,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OAEtD,EAAE,cAAc,EAAE;AAGzB,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;OAGG;IACH,IAAI,CACF,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,qBAAqB,GAAG,IAAI,GAAG,SAAc,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,+BAA+B,EAAE,kBAAkB,CAAC;IAQnE;;;;OAIG;IACH,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,kBAAkB,CAAC;IAIjC;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAOvG;AAED,MAAM,MAAM,+BAA+B,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC,WAAW,CAAC;CAC1C;AAED,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;CAAG;AAEpE,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { APIResource } from "../../../../core/resource.js";
|
|
2
|
+
import * as EntitlementsAPI from "../entitlements.js";
|
|
3
|
+
import { APIPromise } from "../../../../core/api-promise.js";
|
|
4
|
+
import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../../../../core/pagination.js";
|
|
5
|
+
import { RequestOptions } from "../../../../internal/request-options.js";
|
|
6
|
+
export declare class Entitlements extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves all entitlements attached to a product. These entitlements define the
|
|
9
|
+
* features that customers subscribed to this product can access.
|
|
10
|
+
*/
|
|
11
|
+
list(productID: string, query?: EntitlementListParams | null | undefined, options?: RequestOptions): PagePromise<ProductEntitlementsCursorIDPage, ProductEntitlement>;
|
|
12
|
+
/**
|
|
13
|
+
* Attaches an entitlement to a product. All customers subscribed to this product
|
|
14
|
+
* will gain access to the attached feature. Hercules recommends attaching
|
|
15
|
+
* entitlements when creating or updating products to keep feature access in sync.
|
|
16
|
+
*/
|
|
17
|
+
attach(productID: string, body: EntitlementAttachParams, options?: RequestOptions): APIPromise<ProductEntitlement>;
|
|
18
|
+
/**
|
|
19
|
+
* Removes an entitlement from a product. Customers subscribed to this product will
|
|
20
|
+
* lose access to the feature. Existing subscriptions are affected immediately.
|
|
21
|
+
*/
|
|
22
|
+
remove(featureID: string, params: EntitlementRemoveParams, options?: RequestOptions): APIPromise<void>;
|
|
23
|
+
}
|
|
24
|
+
export type ProductEntitlementsCursorIDPage = CursorIDPage<ProductEntitlement>;
|
|
25
|
+
/**
|
|
26
|
+
* An entitlement attached to a product. All customers subscribed to the product
|
|
27
|
+
* gain access to this entitlement.
|
|
28
|
+
*/
|
|
29
|
+
export interface ProductEntitlement {
|
|
30
|
+
/**
|
|
31
|
+
* Unique identifier for the price
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
/**
|
|
35
|
+
* The entitlement attached to the product
|
|
36
|
+
*/
|
|
37
|
+
entitlement: EntitlementsAPI.Entitlement;
|
|
38
|
+
}
|
|
39
|
+
export interface EntitlementListParams extends CursorIDPageParams {
|
|
40
|
+
}
|
|
41
|
+
export interface EntitlementAttachParams {
|
|
42
|
+
/**
|
|
43
|
+
* The ID of the entitlement to attach to the product
|
|
44
|
+
*/
|
|
45
|
+
entitlement: string;
|
|
46
|
+
}
|
|
47
|
+
export interface EntitlementRemoveParams {
|
|
48
|
+
product_id: string;
|
|
49
|
+
}
|
|
50
|
+
export declare namespace Entitlements {
|
|
51
|
+
export { type ProductEntitlement as ProductEntitlement, type ProductEntitlementsCursorIDPage as ProductEntitlementsCursorIDPage, type EntitlementListParams as EntitlementListParams, type EntitlementAttachParams as EntitlementAttachParams, type EntitlementRemoveParams as EntitlementRemoveParams, };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=entitlements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/entitlements.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,E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I,uBAAuB,GACxD,CAAC;CACH"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Entitlements = void 0;
|
|
5
|
+
const resource_1 = require("../../../../core/resource.js");
|
|
6
|
+
const pagination_1 = require("../../../../core/pagination.js");
|
|
7
|
+
const headers_1 = require("../../../../internal/headers.js");
|
|
8
|
+
const path_1 = require("../../../../internal/utils/path.js");
|
|
9
|
+
class Entitlements extends resource_1.APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves all entitlements attached to a product. These entitlements define the
|
|
12
|
+
* features that customers subscribed to this product can access.
|
|
13
|
+
*/
|
|
14
|
+
list(productID, query = {}, options) {
|
|
15
|
+
return this._client.getAPIList((0, path_1.path) `/v1/pay/products/${productID}/entitlements`, (pagination_1.CursorIDPage), { query, ...options });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Attaches an entitlement to a product. All customers subscribed to this product
|
|
19
|
+
* will gain access to the attached feature. Hercules recommends attaching
|
|
20
|
+
* entitlements when creating or updating products to keep feature access in sync.
|
|
21
|
+
*/
|
|
22
|
+
attach(productID, body, options) {
|
|
23
|
+
return this._client.post((0, path_1.path) `/v1/pay/products/${productID}/entitlements`, { body, ...options });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Removes an entitlement from a product. Customers subscribed to this product will
|
|
27
|
+
* lose access to the feature. Existing subscriptions are affected immediately.
|
|
28
|
+
*/
|
|
29
|
+
remove(featureID, params, options) {
|
|
30
|
+
const { product_id } = params;
|
|
31
|
+
return this._client.delete((0, path_1.path) `/v1/pay/products/${product_id}/entitlements/${featureID}`, {
|
|
32
|
+
...options,
|
|
33
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Entitlements = Entitlements;
|
|
38
|
+
//# sourceMappingURL=entitlements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.js","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/entitlements.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAAwD;AAGxD,+DAAiG;AACjG,6DAA4D;AAE5D,6DAAuD;AAEvD,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;OAGG;IACH,IAAI,CACF,SAAiB,EACjB,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAC5B,IAAA,WAAI,EAAA,oBAAoB,SAAS,eAAe,EAChD,CAAA,yBAAgC,CAAA,EAChC,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CACtB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,SAAiB,EACjB,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,oBAAoB,SAAS,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,SAAiB,EAAE,MAA+B,EAAE,OAAwB;QACjF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,oBAAoB,UAAU,iBAAiB,SAAS,EAAE,EAAE;YACzF,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAzCD,oCAyCC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../../../core/resource.mjs";
|
|
3
|
+
import { CursorIDPage } from "../../../../core/pagination.mjs";
|
|
4
|
+
import { buildHeaders } from "../../../../internal/headers.mjs";
|
|
5
|
+
import { path } from "../../../../internal/utils/path.mjs";
|
|
6
|
+
export class Entitlements extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves all entitlements attached to a product. These entitlements define the
|
|
9
|
+
* features that customers subscribed to this product can access.
|
|
10
|
+
*/
|
|
11
|
+
list(productID, query = {}, options) {
|
|
12
|
+
return this._client.getAPIList(path `/v1/pay/products/${productID}/entitlements`, (CursorIDPage), { query, ...options });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Attaches an entitlement to a product. All customers subscribed to this product
|
|
16
|
+
* will gain access to the attached feature. Hercules recommends attaching
|
|
17
|
+
* entitlements when creating or updating products to keep feature access in sync.
|
|
18
|
+
*/
|
|
19
|
+
attach(productID, body, options) {
|
|
20
|
+
return this._client.post(path `/v1/pay/products/${productID}/entitlements`, { body, ...options });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Removes an entitlement from a product. Customers subscribed to this product will
|
|
24
|
+
* lose access to the feature. Existing subscriptions are affected immediately.
|
|
25
|
+
*/
|
|
26
|
+
remove(featureID, params, options) {
|
|
27
|
+
const { product_id } = params;
|
|
28
|
+
return this._client.delete(path `/v1/pay/products/${product_id}/entitlements/${featureID}`, {
|
|
29
|
+
...options,
|
|
30
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=entitlements.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.mjs","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/entitlements.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAwC;OACtD,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;OAGG;IACH,IAAI,CACF,SAAiB,EACjB,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAC5B,IAAI,CAAA,oBAAoB,SAAS,eAAe,EAChD,CAAA,YAAgC,CAAA,EAChC,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CACtB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,SAAiB,EACjB,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,oBAAoB,SAAS,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,SAAiB,EAAE,MAA+B,EAAE,OAAwB;QACjF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,oBAAoB,UAAU,iBAAiB,SAAS,EAAE,EAAE;YACzF,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Entitlements, type ProductEntitlement, type EntitlementListParams, type EntitlementAttachParams, type EntitlementRemoveParams, type ProductEntitlementsCursorIDPage, } from "./entitlements.mjs";
|
|
2
|
+
export { Products, type Product, type ProductCreateParams, type ProductUpdateParams, type ProductListParams, type ProductsCursorIDPage, } from "./products.mjs";
|
|
3
|
+
export { Variants, type Variant, type VariantCreateParams, type VariantUpdateParams, type VariantListParams, type VariantArchiveParams, type VariantGetParams, type VariantsCursorIDPage, } from "./variants.mjs";
|
|
4
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/index.ts"],"names":[],"mappings":"OAEO,EACL,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,GACrC;OACM,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B;OACM,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,GAC1B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Entitlements, type ProductEntitlement, type EntitlementListParams, type EntitlementAttachParams, type EntitlementRemoveParams, type ProductEntitlementsCursorIDPage, } from "./entitlements.js";
|
|
2
|
+
export { Products, type Product, type ProductCreateParams, type ProductUpdateParams, type ProductListParams, type ProductsCursorIDPage, } from "./products.js";
|
|
3
|
+
export { Variants, type Variant, type VariantCreateParams, type VariantUpdateParams, type VariantListParams, type VariantArchiveParams, type VariantGetParams, type VariantsCursorIDPage, } from "./variants.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/index.ts"],"names":[],"mappings":"OAEO,EACL,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,GACrC;OACM,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B;OACM,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,GAC1B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Variants = exports.Products = exports.Entitlements = void 0;
|
|
5
|
+
var entitlements_1 = require("./entitlements.js");
|
|
6
|
+
Object.defineProperty(exports, "Entitlements", { enumerable: true, get: function () { return entitlements_1.Entitlements; } });
|
|
7
|
+
var products_1 = require("./products.js");
|
|
8
|
+
Object.defineProperty(exports, "Products", { enumerable: true, get: function () { return products_1.Products; } });
|
|
9
|
+
var variants_1 = require("./variants.js");
|
|
10
|
+
Object.defineProperty(exports, "Variants", { enumerable: true, get: function () { return variants_1.Variants; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAOwB;AANtB,4GAAA,YAAY,OAAA;AAOd,0CAOoB;AANlB,oGAAA,QAAQ,OAAA;AAOV,0CASoB;AARlB,oGAAA,QAAQ,OAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
export { Entitlements, } from "./entitlements.mjs";
|
|
3
|
-
export {
|
|
3
|
+
export { Products, } from "./products.mjs";
|
|
4
|
+
export { Variants, } from "./variants.mjs";
|
|
4
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,YAAY,GAMb;OACM,EACL,QAAQ,GAMT;OACM,EACL,QAAQ,GAQT"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { APIResource } from "../../../../core/resource.mjs";
|
|
2
|
+
import * as EntitlementsAPI from "./entitlements.mjs";
|
|
3
|
+
import { EntitlementAttachParams, EntitlementListParams, EntitlementRemoveParams, Entitlements, ProductEntitlement, ProductEntitlementsCursorIDPage } from "./entitlements.mjs";
|
|
4
|
+
import * as VariantsAPI from "./variants.mjs";
|
|
5
|
+
import { Variant, VariantArchiveParams, VariantCreateParams, VariantGetParams, VariantListParams, VariantUpdateParams, Variants, VariantsCursorIDPage } from "./variants.mjs";
|
|
6
|
+
import { APIPromise } from "../../../../core/api-promise.mjs";
|
|
7
|
+
import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../../../../core/pagination.mjs";
|
|
8
|
+
import { RequestOptions } from "../../../../internal/request-options.mjs";
|
|
9
|
+
export declare class Products extends APIResource {
|
|
10
|
+
entitlements: EntitlementsAPI.Entitlements;
|
|
11
|
+
variants: VariantsAPI.Variants;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new subscription product with a recurring price. Common examples
|
|
14
|
+
* include Free, Pro, Business, or Teams tiers. After creating a product, attach
|
|
15
|
+
* entitlements to define which features customers on this product can access.
|
|
16
|
+
*/
|
|
17
|
+
create(body: ProductCreateParams, options?: RequestOptions): APIPromise<Product>;
|
|
18
|
+
/**
|
|
19
|
+
* Updates an existing product. Use this to modify the product name, description,
|
|
20
|
+
* or active status. Pricing cannot be changed after creation—create a new product
|
|
21
|
+
* instead.
|
|
22
|
+
*/
|
|
23
|
+
update(productID: string, body?: ProductUpdateParams | null | undefined, options?: RequestOptions): APIPromise<Product>;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves a paginated list of subscription products. Products define the pricing
|
|
26
|
+
* and billing intervals for subscriptions. Each product can have entitlements
|
|
27
|
+
* attached that grant features to subscribed customers.
|
|
28
|
+
*/
|
|
29
|
+
list(query?: ProductListParams | null | undefined, options?: RequestOptions): PagePromise<ProductsCursorIDPage, Product>;
|
|
30
|
+
/**
|
|
31
|
+
* Archives a product, preventing new subscriptions. Existing subscriptions remain
|
|
32
|
+
* active. Use this instead of deletion to preserve subscription history.
|
|
33
|
+
*/
|
|
34
|
+
archive(productID: string, options?: RequestOptions): APIPromise<Product>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves a product by ID. Returns the product object including pricing details
|
|
37
|
+
* and status.
|
|
38
|
+
*/
|
|
39
|
+
get(productID: string, options?: RequestOptions): APIPromise<Product>;
|
|
40
|
+
}
|
|
41
|
+
export type ProductsCursorIDPage = CursorIDPage<Product>;
|
|
42
|
+
/**
|
|
43
|
+
* A product that customers can purchase. Products can be one-time purchases or
|
|
44
|
+
* recurring subscriptions. Attach entitlements to a product to grant features to
|
|
45
|
+
* customers.
|
|
46
|
+
*/
|
|
47
|
+
export interface Product {
|
|
48
|
+
/**
|
|
49
|
+
* Unique identifier for the price
|
|
50
|
+
*/
|
|
51
|
+
id: string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the product is available for new purchases
|
|
54
|
+
*/
|
|
55
|
+
active: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Timestamp when the product was created
|
|
58
|
+
*/
|
|
59
|
+
created: string;
|
|
60
|
+
/**
|
|
61
|
+
* Display name for the product (e.g., Pro, Business, Teams)
|
|
62
|
+
*/
|
|
63
|
+
name: string;
|
|
64
|
+
/**
|
|
65
|
+
* Price configuration for a product. Can be one-time or recurring (subscription).
|
|
66
|
+
*/
|
|
67
|
+
default_price?: Product.DefaultPrice | null;
|
|
68
|
+
/**
|
|
69
|
+
* Detailed description of what the product includes
|
|
70
|
+
*/
|
|
71
|
+
description?: string | null;
|
|
72
|
+
}
|
|
73
|
+
export declare namespace Product {
|
|
74
|
+
/**
|
|
75
|
+
* Price configuration for a product. Can be one-time or recurring (subscription).
|
|
76
|
+
*/
|
|
77
|
+
interface DefaultPrice {
|
|
78
|
+
/**
|
|
79
|
+
* Unique identifier for the price
|
|
80
|
+
*/
|
|
81
|
+
id: string;
|
|
82
|
+
/**
|
|
83
|
+
* How to handle the billing cycle when switching plans. 'now' resets to current
|
|
84
|
+
* time, 'unchanged' keeps the original anchor. Null for one-time prices.
|
|
85
|
+
*/
|
|
86
|
+
billing_cycle_anchor: 'now' | 'unchanged' | null;
|
|
87
|
+
/**
|
|
88
|
+
* Three-letter ISO currency code (e.g., usd, eur)
|
|
89
|
+
*/
|
|
90
|
+
currency: string;
|
|
91
|
+
/**
|
|
92
|
+
* Billing frequency for recurring prices: day, week, month, or year. Null for
|
|
93
|
+
* one-time prices.
|
|
94
|
+
*/
|
|
95
|
+
interval: 'day' | 'week' | 'month' | 'year' | null;
|
|
96
|
+
/**
|
|
97
|
+
* Number of intervals between billings for recurring prices. Null for one-time
|
|
98
|
+
* prices.
|
|
99
|
+
*/
|
|
100
|
+
interval_count: number | null;
|
|
101
|
+
/**
|
|
102
|
+
* How to handle prorations when switching plans. 'default' creates prorations,
|
|
103
|
+
* 'none' disables them. Null for one-time prices.
|
|
104
|
+
*/
|
|
105
|
+
proration_behavior: 'default' | 'none' | null;
|
|
106
|
+
/**
|
|
107
|
+
* When to calculate proration. 'now' uses current time, 'start_of_period' uses the
|
|
108
|
+
* billing period start. Null for one-time prices or to use Stripe's default.
|
|
109
|
+
*/
|
|
110
|
+
proration_date: 'now' | 'start_of_period' | null;
|
|
111
|
+
/**
|
|
112
|
+
* Price type: one_time for single purchases, recurring for subscriptions
|
|
113
|
+
*/
|
|
114
|
+
type: 'one_time' | 'recurring';
|
|
115
|
+
/**
|
|
116
|
+
* Price amount in the smallest currency unit (e.g., cents)
|
|
117
|
+
*/
|
|
118
|
+
unit_amount: number | null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export interface ProductCreateParams {
|
|
122
|
+
/**
|
|
123
|
+
* Display name for the product (e.g., Pro, Business, Teams)
|
|
124
|
+
*/
|
|
125
|
+
name: string;
|
|
126
|
+
/**
|
|
127
|
+
* Price amount in the smallest currency unit (e.g., cents). Use 0 for free
|
|
128
|
+
* products.
|
|
129
|
+
*/
|
|
130
|
+
unit_amount: number;
|
|
131
|
+
/**
|
|
132
|
+
* Optional custom ID for the product. If not provided, one will be generated.
|
|
133
|
+
*/
|
|
134
|
+
id?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Three-letter ISO currency code
|
|
137
|
+
*/
|
|
138
|
+
currency?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Detailed description of what the product includes
|
|
141
|
+
*/
|
|
142
|
+
description?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Billing frequency for recurring prices: day, week, month, or year. Required for
|
|
145
|
+
* recurring type, ignored for one_time.
|
|
146
|
+
*/
|
|
147
|
+
interval?: 'day' | 'week' | 'month' | 'year';
|
|
148
|
+
/**
|
|
149
|
+
* Number of intervals between billings for recurring prices. Required for
|
|
150
|
+
* recurring type, ignored for one_time.
|
|
151
|
+
*/
|
|
152
|
+
interval_count?: number;
|
|
153
|
+
/**
|
|
154
|
+
* Price type: one_time for single purchases, recurring for subscriptions
|
|
155
|
+
*/
|
|
156
|
+
type?: 'one_time' | 'recurring';
|
|
157
|
+
}
|
|
158
|
+
export interface ProductUpdateParams {
|
|
159
|
+
/**
|
|
160
|
+
* Whether the product is available for new subscriptions
|
|
161
|
+
*/
|
|
162
|
+
active?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Detailed description of what the product includes
|
|
165
|
+
*/
|
|
166
|
+
description?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Display name for the product
|
|
169
|
+
*/
|
|
170
|
+
name?: string;
|
|
171
|
+
}
|
|
172
|
+
export interface ProductListParams extends CursorIDPageParams {
|
|
173
|
+
/**
|
|
174
|
+
* Filter by active status
|
|
175
|
+
*/
|
|
176
|
+
active?: 'true' | 'false';
|
|
177
|
+
}
|
|
178
|
+
export declare namespace Products {
|
|
179
|
+
export { type Product as Product, type ProductsCursorIDPage as ProductsCursorIDPage, type ProductCreateParams as ProductCreateParams, type ProductUpdateParams as ProductUpdateParams, type ProductListParams as ProductListParams, };
|
|
180
|
+
export { Entitlements as Entitlements, type ProductEntitlement as ProductEntitlement, type ProductEntitlementsCursorIDPage as ProductEntitlementsCursorIDPage, type EntitlementListParams as EntitlementListParams, type EntitlementAttachParams as EntitlementAttachParams, type EntitlementRemoveParams as EntitlementRemoveParams, };
|
|
181
|
+
export { Variants as Variants, type Variant as Variant, type VariantsCursorIDPage as VariantsCursorIDPage, type VariantCreateParams as VariantCreateParams, type VariantUpdateParams as VariantUpdateParams, type VariantListParams as VariantListParams, type VariantArchiveParams as VariantArchiveParams, type VariantGetParams as VariantGetParams, };
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=products.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.d.mts","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/products.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,eAAe;OACpB,EACL,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,kBAAkB,EAClB,+BAA+B,EAChC;OACM,KAAK,WAAW;OAChB,EACL,OAAO,EACP,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,oBAAoB,EACrB;OACM,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OACtD,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC,YAAY,EAAE,eAAe,CAAC,YAAY,CAAkD;IAC5F,Q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