@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,41 @@
|
|
|
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 path_1 = require("../../../internal/utils/path.js");
|
|
8
|
+
class Entitlements extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new feature entitlement. Entitlements represent features or
|
|
11
|
+
* capabilities in your app that can be gated by subscription. After creating an
|
|
12
|
+
* entitlement, attach it to one or more plans to grant access to customers on
|
|
13
|
+
* those plans.
|
|
14
|
+
*/
|
|
15
|
+
create(body, options) {
|
|
16
|
+
return this._client.post('/v1/pay/entitlements', { body, ...options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Updates an existing entitlement. Use this to modify the name or deactivate the
|
|
20
|
+
* entitlement.
|
|
21
|
+
*/
|
|
22
|
+
update(entitlementID, body = {}, options) {
|
|
23
|
+
return this._client.patch((0, path_1.path) `/v1/pay/entitlements/${entitlementID}`, { body, ...options });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves a paginated list of all entitlements. Entitlements represent features
|
|
27
|
+
* or capabilities in your app that can be gated by subscription.
|
|
28
|
+
*/
|
|
29
|
+
list(query = {}, options) {
|
|
30
|
+
return this._client.getAPIList('/v1/pay/entitlements', (pagination_1.CursorIDPage), { query, ...options });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves an entitlement by ID. Returns the entitlement object including its
|
|
34
|
+
* active status.
|
|
35
|
+
*/
|
|
36
|
+
get(entitlementID, options) {
|
|
37
|
+
return this._client.get((0, path_1.path) `/v1/pay/entitlements/${entitlementID}`, options);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.Entitlements = Entitlements;
|
|
41
|
+
//# sourceMappingURL=entitlements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.js","sourceRoot":"","sources":["../../../src/resources/beta/pay/entitlements.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAErD,4DAA8F;AAE9F,0DAAoD;AAEpD,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;;;OAKG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;OAGG;IACH,MAAM,CACJ,aAAqB,EACrB,OAAmD,EAAE,EACrD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,wBAAwB,aAAa,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;OAGG;IACH,IAAI,CACF,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAA,yBAAyB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC3G,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,aAAqB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,wBAAwB,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;CACF;AAzCD,oCAyCC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { path } from "../../../internal/utils/path.mjs";
|
|
5
|
+
export class Entitlements extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new feature entitlement. Entitlements represent features or
|
|
8
|
+
* capabilities in your app that can be gated by subscription. After creating an
|
|
9
|
+
* entitlement, attach it to one or more plans to grant access to customers on
|
|
10
|
+
* those plans.
|
|
11
|
+
*/
|
|
12
|
+
create(body, options) {
|
|
13
|
+
return this._client.post('/v1/pay/entitlements', { body, ...options });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Updates an existing entitlement. Use this to modify the name or deactivate the
|
|
17
|
+
* entitlement.
|
|
18
|
+
*/
|
|
19
|
+
update(entitlementID, body = {}, options) {
|
|
20
|
+
return this._client.patch(path `/v1/pay/entitlements/${entitlementID}`, { body, ...options });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves a paginated list of all entitlements. Entitlements represent features
|
|
24
|
+
* or capabilities in your app that can be gated by subscription.
|
|
25
|
+
*/
|
|
26
|
+
list(query = {}, options) {
|
|
27
|
+
return this._client.getAPIList('/v1/pay/entitlements', (CursorIDPage), { query, ...options });
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves an entitlement by ID. Returns the entitlement object including its
|
|
31
|
+
* active status.
|
|
32
|
+
*/
|
|
33
|
+
get(entitlementID, options) {
|
|
34
|
+
return this._client.get(path `/v1/pay/entitlements/${entitlementID}`, options);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=entitlements.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.mjs","sourceRoot":"","sources":["../../../src/resources/beta/pay/entitlements.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAwC;OAEtD,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;;OAKG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;OAGG;IACH,MAAM,CACJ,aAAqB,EACrB,OAAmD,EAAE,EACrD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,wBAAwB,aAAa,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;OAGG;IACH,IAAI,CACF,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAA,YAAyB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC3G,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,aAAqB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,wBAAwB,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Coupons, type Coupon, type CouponCreateParams, type CouponUpdateParams, type CouponListParams, type CouponsCursorIDPage, } from "./coupons.mjs";
|
|
2
2
|
export { Customers, type Customer, type CustomerAddress, type CustomerBillingPortalResponse, type CustomerCreateParams, type CustomerUpdateParams, type CustomerListParams, type CustomerBillingPortalParams, type CustomersCursorIDPage, } from "./customers.mjs";
|
|
3
3
|
export { Entitlements, type Entitlement, type EntitlementCreateParams, type EntitlementUpdateParams, type EntitlementListParams, type EntitlementsCursorIDPage, } from "./entitlements.mjs";
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
4
|
+
export { Pay, type PayCancelResponse, type PayCheckResponse, type PayCheckoutResponse, type PayCancelParams, type PayCheckParams, type PayCheckoutParams, } from "./pay.mjs";
|
|
5
|
+
export { Products, type Product, type ProductCreateParams, type ProductUpdateParams, type ProductListParams, type ProductsCursorIDPage, } from "./products/index.mjs";
|
|
6
6
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/pay/index.ts"],"names":[],"mappings":"OAEO,EACL,OAAO,EACP,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB;OACM,EACL,SAAS,EACT,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,GAC3B;OACM,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B;OACM,EACL,GAAG,EACH,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB;OACM,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Coupons, type Coupon, type CouponCreateParams, type CouponUpdateParams, type CouponListParams, type CouponsCursorIDPage, } from "./coupons.js";
|
|
2
2
|
export { Customers, type Customer, type CustomerAddress, type CustomerBillingPortalResponse, type CustomerCreateParams, type CustomerUpdateParams, type CustomerListParams, type CustomerBillingPortalParams, type CustomersCursorIDPage, } from "./customers.js";
|
|
3
3
|
export { Entitlements, type Entitlement, type EntitlementCreateParams, type EntitlementUpdateParams, type EntitlementListParams, type EntitlementsCursorIDPage, } from "./entitlements.js";
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
4
|
+
export { Pay, type PayCancelResponse, type PayCheckResponse, type PayCheckoutResponse, type PayCancelParams, type PayCheckParams, type PayCheckoutParams, } from "./pay.js";
|
|
5
|
+
export { Products, type Product, type ProductCreateParams, type ProductUpdateParams, type ProductListParams, type ProductsCursorIDPage, } from "./products/index.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/pay/index.ts"],"names":[],"mappings":"OAEO,EACL,OAAO,EACP,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB;OACM,EACL,SAAS,EACT,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,GAC3B;OACM,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B;OACM,EACL,GAAG,EACH,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB;OACM,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.Products = exports.Pay = exports.Entitlements = exports.Customers = exports.Coupons = void 0;
|
|
5
5
|
var coupons_1 = require("./coupons.js");
|
|
6
6
|
Object.defineProperty(exports, "Coupons", { enumerable: true, get: function () { return coupons_1.Coupons; } });
|
|
7
7
|
var customers_1 = require("./customers.js");
|
|
8
8
|
Object.defineProperty(exports, "Customers", { enumerable: true, get: function () { return customers_1.Customers; } });
|
|
9
9
|
var entitlements_1 = require("./entitlements.js");
|
|
10
10
|
Object.defineProperty(exports, "Entitlements", { enumerable: true, get: function () { return entitlements_1.Entitlements; } });
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
var
|
|
14
|
-
Object.defineProperty(exports, "
|
|
11
|
+
var pay_1 = require("./pay.js");
|
|
12
|
+
Object.defineProperty(exports, "Pay", { enumerable: true, get: function () { return pay_1.Pay; } });
|
|
13
|
+
var index_1 = require("./products/index.js");
|
|
14
|
+
Object.defineProperty(exports, "Products", { enumerable: true, get: function () { return index_1.Products; } });
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/beta/pay/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wCAOmB;AANjB,kGAAA,OAAO,OAAA;AAOT,4CAUqB;AATnB,sGAAA,SAAS,OAAA;AAUX,kDAOwB;AANtB,4GAAA,YAAY,OAAA;AAOd,gCAQe;AAPb,0FAAA,GAAG,OAAA;AAQL,6CAO0B;AANxB,iGAAA,QAAQ,OAAA"}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
export { Coupons, } from "./coupons.mjs";
|
|
3
3
|
export { Customers, } from "./customers.mjs";
|
|
4
4
|
export { Entitlements, } from "./entitlements.mjs";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { Pay, } from "./pay.mjs";
|
|
6
|
+
export { Products, } from "./products/index.mjs";
|
|
7
7
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/beta/pay/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,OAAO,GAMR;OACM,EACL,SAAS,GASV;OACM,EACL,YAAY,GAMb;OACM,EACL,GAAG,GAOJ;OACM,EACL,QAAQ,GAMT"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
+
import * as CouponsAPI from "./coupons.mjs";
|
|
3
|
+
import { Coupon, CouponCreateParams, CouponListParams, CouponUpdateParams, Coupons, CouponsCursorIDPage } from "./coupons.mjs";
|
|
4
|
+
import * as CustomersAPI from "./customers.mjs";
|
|
5
|
+
import { Customer, CustomerAddress, CustomerBillingPortalParams, CustomerBillingPortalResponse, CustomerCreateParams, CustomerListParams, CustomerUpdateParams, Customers, CustomersCursorIDPage } from "./customers.mjs";
|
|
6
|
+
import * as EntitlementsAPI from "./entitlements.mjs";
|
|
7
|
+
import { Entitlement, EntitlementCreateParams, EntitlementListParams, EntitlementUpdateParams, Entitlements, EntitlementsCursorIDPage } from "./entitlements.mjs";
|
|
8
|
+
import * as ProductsAPI from "./products/products.mjs";
|
|
9
|
+
import { Product, ProductCreateParams, ProductListParams, ProductUpdateParams, Products, ProductsCursorIDPage } from "./products/products.mjs";
|
|
10
|
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
11
|
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
12
|
+
export declare class Pay extends APIResource {
|
|
13
|
+
customers: CustomersAPI.Customers;
|
|
14
|
+
products: ProductsAPI.Products;
|
|
15
|
+
entitlements: EntitlementsAPI.Entitlements;
|
|
16
|
+
coupons: CouponsAPI.Coupons;
|
|
17
|
+
/**
|
|
18
|
+
* Cancels a customer's subscription. By default, the subscription remains active
|
|
19
|
+
* until the end of the current billing period. Set cancellation_timing to
|
|
20
|
+
* 'immediate' to cancel immediately.
|
|
21
|
+
*/
|
|
22
|
+
cancel(body: PayCancelParams, options?: RequestOptions): APIPromise<PayCancelResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Verifies if a customer has access to a specific feature. Use this to gate
|
|
25
|
+
* features in your app based on the customer's active subscription and the
|
|
26
|
+
* entitlements attached to their product. Hercules recommends calling this before
|
|
27
|
+
* allowing access to premium features.
|
|
28
|
+
*/
|
|
29
|
+
check(body: PayCheckParams, options?: RequestOptions): APIPromise<PayCheckResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a checkout session for a customer to subscribe to a product. Returns a
|
|
32
|
+
* URL to redirect the customer to for payment. After successful payment, the
|
|
33
|
+
* customer is subscribed to the product and gains access to its entitlements.
|
|
34
|
+
*/
|
|
35
|
+
checkout(body: PayCheckoutParams, options?: RequestOptions): APIPromise<PayCheckoutResponse>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Cancel subscription response
|
|
39
|
+
*/
|
|
40
|
+
export interface PayCancelResponse {
|
|
41
|
+
/**
|
|
42
|
+
* The subscription ID
|
|
43
|
+
*/
|
|
44
|
+
id: string;
|
|
45
|
+
/**
|
|
46
|
+
* When the cancellation takes effect
|
|
47
|
+
*/
|
|
48
|
+
cancellation_timing: 'immediate' | 'at_billing_period_end';
|
|
49
|
+
/**
|
|
50
|
+
* The subscription status
|
|
51
|
+
*/
|
|
52
|
+
status: string;
|
|
53
|
+
/**
|
|
54
|
+
* When the subscription was canceled
|
|
55
|
+
*/
|
|
56
|
+
canceled_at?: string | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check entitlement response
|
|
60
|
+
*/
|
|
61
|
+
export interface PayCheckResponse {
|
|
62
|
+
/**
|
|
63
|
+
* The entitlement ID that was checked
|
|
64
|
+
*/
|
|
65
|
+
entitlement_id: string;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the customer has the entitlement
|
|
68
|
+
*/
|
|
69
|
+
has_entitlement: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Checkout response. For new customers, returns a checkout URL. For existing
|
|
73
|
+
* subscribers, returns the updated subscription.
|
|
74
|
+
*/
|
|
75
|
+
export interface PayCheckoutResponse {
|
|
76
|
+
/**
|
|
77
|
+
* The checkout session ID (for checkout action) or subscription ID (for update
|
|
78
|
+
* action)
|
|
79
|
+
*/
|
|
80
|
+
id: string;
|
|
81
|
+
/**
|
|
82
|
+
* The action taken: 'checkout' for new subscriptions (redirect to URL), 'update'
|
|
83
|
+
* for subscription changes (already applied)
|
|
84
|
+
*/
|
|
85
|
+
action: 'checkout' | 'update';
|
|
86
|
+
/**
|
|
87
|
+
* The checkout mode: subscription for recurring prices, payment for one-time
|
|
88
|
+
* prices. Only present for 'checkout' action.
|
|
89
|
+
*/
|
|
90
|
+
mode?: 'subscription' | 'payment' | null;
|
|
91
|
+
/**
|
|
92
|
+
* The updated subscription details. Only present for 'update' action.
|
|
93
|
+
*/
|
|
94
|
+
subscription?: PayCheckoutResponse.Subscription | null;
|
|
95
|
+
/**
|
|
96
|
+
* The checkout URL to redirect the customer to. Only present for 'checkout'
|
|
97
|
+
* action.
|
|
98
|
+
*/
|
|
99
|
+
url?: string | null;
|
|
100
|
+
}
|
|
101
|
+
export declare namespace PayCheckoutResponse {
|
|
102
|
+
/**
|
|
103
|
+
* The updated subscription details. Only present for 'update' action.
|
|
104
|
+
*/
|
|
105
|
+
interface Subscription {
|
|
106
|
+
/**
|
|
107
|
+
* The subscription ID
|
|
108
|
+
*/
|
|
109
|
+
id: string;
|
|
110
|
+
/**
|
|
111
|
+
* The product ID
|
|
112
|
+
*/
|
|
113
|
+
product_id: string;
|
|
114
|
+
/**
|
|
115
|
+
* The subscription status
|
|
116
|
+
*/
|
|
117
|
+
status: string;
|
|
118
|
+
/**
|
|
119
|
+
* The variant ID if applicable
|
|
120
|
+
*/
|
|
121
|
+
variant_id?: string | null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export interface PayCancelParams {
|
|
125
|
+
/**
|
|
126
|
+
* The customer ID
|
|
127
|
+
*/
|
|
128
|
+
customer_id: string;
|
|
129
|
+
/**
|
|
130
|
+
* The subscription ID to cancel
|
|
131
|
+
*/
|
|
132
|
+
subscription_id: string;
|
|
133
|
+
/**
|
|
134
|
+
* When to cancel the subscription. Defaults to 'at_billing_period_end' to allow
|
|
135
|
+
* customers to use remaining time.
|
|
136
|
+
*/
|
|
137
|
+
cancellation_timing?: 'immediate' | 'at_billing_period_end';
|
|
138
|
+
}
|
|
139
|
+
export interface PayCheckParams {
|
|
140
|
+
/**
|
|
141
|
+
* The customer ID
|
|
142
|
+
*/
|
|
143
|
+
customer_id: string;
|
|
144
|
+
/**
|
|
145
|
+
* The entitlement ID to check for access
|
|
146
|
+
*/
|
|
147
|
+
entitlement_id: string;
|
|
148
|
+
}
|
|
149
|
+
export interface PayCheckoutParams {
|
|
150
|
+
/**
|
|
151
|
+
* The customer ID
|
|
152
|
+
*/
|
|
153
|
+
customer_id: string;
|
|
154
|
+
/**
|
|
155
|
+
* The product ID to purchase
|
|
156
|
+
*/
|
|
157
|
+
product_id: string;
|
|
158
|
+
/**
|
|
159
|
+
* Optional custom ID for the subscription or payment. If not provided, one will be
|
|
160
|
+
* generated.
|
|
161
|
+
*/
|
|
162
|
+
id?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Override billing cycle anchor behavior for subscription updates. 'now' resets to
|
|
165
|
+
* current time, 'unchanged' keeps original anchor. If not provided, uses the
|
|
166
|
+
* price's configured default.
|
|
167
|
+
*/
|
|
168
|
+
billing_cycle_anchor?: 'now' | 'unchanged';
|
|
169
|
+
/**
|
|
170
|
+
* URL to redirect on cancel
|
|
171
|
+
*/
|
|
172
|
+
cancel_url?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Promotion code to apply
|
|
175
|
+
*/
|
|
176
|
+
promotion_code?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Override proration behavior for subscription updates. 'default' creates
|
|
179
|
+
* prorations, 'none' disables them. If not provided, uses the price's configured
|
|
180
|
+
* default.
|
|
181
|
+
*/
|
|
182
|
+
proration_behavior?: 'default' | 'none';
|
|
183
|
+
/**
|
|
184
|
+
* Override proration date calculation for subscription updates. 'now' uses current
|
|
185
|
+
* time, 'start_of_period' uses billing period start. If not provided, uses the
|
|
186
|
+
* price's configured default.
|
|
187
|
+
*/
|
|
188
|
+
proration_date?: 'now' | 'start_of_period';
|
|
189
|
+
/**
|
|
190
|
+
* URL to redirect on success
|
|
191
|
+
*/
|
|
192
|
+
success_url?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Optional variant ID to specify a particular pricing tier. If not provided, the
|
|
195
|
+
* product's default price is used.
|
|
196
|
+
*/
|
|
197
|
+
variant_id?: string;
|
|
198
|
+
}
|
|
199
|
+
export declare namespace Pay {
|
|
200
|
+
export { type PayCancelResponse as PayCancelResponse, type PayCheckResponse as PayCheckResponse, type PayCheckoutResponse as PayCheckoutResponse, type PayCancelParams as PayCancelParams, type PayCheckParams as PayCheckParams, type PayCheckoutParams as PayCheckoutParams, };
|
|
201
|
+
export { Customers as Customers, type Customer as Customer, type CustomerAddress as CustomerAddress, type CustomerBillingPortalResponse as CustomerBillingPortalResponse, type CustomersCursorIDPage as CustomersCursorIDPage, type CustomerCreateParams as CustomerCreateParams, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, type CustomerBillingPortalParams as CustomerBillingPortalParams, };
|
|
202
|
+
export { Products as Products, type Product as Product, type ProductsCursorIDPage as ProductsCursorIDPage, type ProductCreateParams as ProductCreateParams, type ProductUpdateParams as ProductUpdateParams, type ProductListParams as ProductListParams, };
|
|
203
|
+
export { Entitlements as Entitlements, type Entitlement as Entitlement, type EntitlementsCursorIDPage as EntitlementsCursorIDPage, type EntitlementCreateParams as EntitlementCreateParams, type EntitlementUpdateParams as EntitlementUpdateParams, type EntitlementListParams as EntitlementListParams, };
|
|
204
|
+
export { Coupons as Coupons, type Coupon as Coupon, type CouponsCursorIDPage as CouponsCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=pay.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/pay/pay.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACpB;OACM,KAAK,YAAY;OACjB,EACL,QAAQ,EACR,eAAe,EACf,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,qBAAqB,EACtB;OACM,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,GACpD,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import * as CouponsAPI from "./coupons.js";
|
|
3
|
+
import { Coupon, CouponCreateParams, CouponListParams, CouponUpdateParams, Coupons, CouponsCursorIDPage } from "./coupons.js";
|
|
4
|
+
import * as CustomersAPI from "./customers.js";
|
|
5
|
+
import { Customer, CustomerAddress, CustomerBillingPortalParams, CustomerBillingPortalResponse, CustomerCreateParams, CustomerListParams, CustomerUpdateParams, Customers, CustomersCursorIDPage } from "./customers.js";
|
|
6
|
+
import * as EntitlementsAPI from "./entitlements.js";
|
|
7
|
+
import { Entitlement, EntitlementCreateParams, EntitlementListParams, EntitlementUpdateParams, Entitlements, EntitlementsCursorIDPage } from "./entitlements.js";
|
|
8
|
+
import * as ProductsAPI from "./products/products.js";
|
|
9
|
+
import { Product, ProductCreateParams, ProductListParams, ProductUpdateParams, Products, ProductsCursorIDPage } from "./products/products.js";
|
|
10
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
11
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
12
|
+
export declare class Pay extends APIResource {
|
|
13
|
+
customers: CustomersAPI.Customers;
|
|
14
|
+
products: ProductsAPI.Products;
|
|
15
|
+
entitlements: EntitlementsAPI.Entitlements;
|
|
16
|
+
coupons: CouponsAPI.Coupons;
|
|
17
|
+
/**
|
|
18
|
+
* Cancels a customer's subscription. By default, the subscription remains active
|
|
19
|
+
* until the end of the current billing period. Set cancellation_timing to
|
|
20
|
+
* 'immediate' to cancel immediately.
|
|
21
|
+
*/
|
|
22
|
+
cancel(body: PayCancelParams, options?: RequestOptions): APIPromise<PayCancelResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Verifies if a customer has access to a specific feature. Use this to gate
|
|
25
|
+
* features in your app based on the customer's active subscription and the
|
|
26
|
+
* entitlements attached to their product. Hercules recommends calling this before
|
|
27
|
+
* allowing access to premium features.
|
|
28
|
+
*/
|
|
29
|
+
check(body: PayCheckParams, options?: RequestOptions): APIPromise<PayCheckResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a checkout session for a customer to subscribe to a product. Returns a
|
|
32
|
+
* URL to redirect the customer to for payment. After successful payment, the
|
|
33
|
+
* customer is subscribed to the product and gains access to its entitlements.
|
|
34
|
+
*/
|
|
35
|
+
checkout(body: PayCheckoutParams, options?: RequestOptions): APIPromise<PayCheckoutResponse>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Cancel subscription response
|
|
39
|
+
*/
|
|
40
|
+
export interface PayCancelResponse {
|
|
41
|
+
/**
|
|
42
|
+
* The subscription ID
|
|
43
|
+
*/
|
|
44
|
+
id: string;
|
|
45
|
+
/**
|
|
46
|
+
* When the cancellation takes effect
|
|
47
|
+
*/
|
|
48
|
+
cancellation_timing: 'immediate' | 'at_billing_period_end';
|
|
49
|
+
/**
|
|
50
|
+
* The subscription status
|
|
51
|
+
*/
|
|
52
|
+
status: string;
|
|
53
|
+
/**
|
|
54
|
+
* When the subscription was canceled
|
|
55
|
+
*/
|
|
56
|
+
canceled_at?: string | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check entitlement response
|
|
60
|
+
*/
|
|
61
|
+
export interface PayCheckResponse {
|
|
62
|
+
/**
|
|
63
|
+
* The entitlement ID that was checked
|
|
64
|
+
*/
|
|
65
|
+
entitlement_id: string;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the customer has the entitlement
|
|
68
|
+
*/
|
|
69
|
+
has_entitlement: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Checkout response. For new customers, returns a checkout URL. For existing
|
|
73
|
+
* subscribers, returns the updated subscription.
|
|
74
|
+
*/
|
|
75
|
+
export interface PayCheckoutResponse {
|
|
76
|
+
/**
|
|
77
|
+
* The checkout session ID (for checkout action) or subscription ID (for update
|
|
78
|
+
* action)
|
|
79
|
+
*/
|
|
80
|
+
id: string;
|
|
81
|
+
/**
|
|
82
|
+
* The action taken: 'checkout' for new subscriptions (redirect to URL), 'update'
|
|
83
|
+
* for subscription changes (already applied)
|
|
84
|
+
*/
|
|
85
|
+
action: 'checkout' | 'update';
|
|
86
|
+
/**
|
|
87
|
+
* The checkout mode: subscription for recurring prices, payment for one-time
|
|
88
|
+
* prices. Only present for 'checkout' action.
|
|
89
|
+
*/
|
|
90
|
+
mode?: 'subscription' | 'payment' | null;
|
|
91
|
+
/**
|
|
92
|
+
* The updated subscription details. Only present for 'update' action.
|
|
93
|
+
*/
|
|
94
|
+
subscription?: PayCheckoutResponse.Subscription | null;
|
|
95
|
+
/**
|
|
96
|
+
* The checkout URL to redirect the customer to. Only present for 'checkout'
|
|
97
|
+
* action.
|
|
98
|
+
*/
|
|
99
|
+
url?: string | null;
|
|
100
|
+
}
|
|
101
|
+
export declare namespace PayCheckoutResponse {
|
|
102
|
+
/**
|
|
103
|
+
* The updated subscription details. Only present for 'update' action.
|
|
104
|
+
*/
|
|
105
|
+
interface Subscription {
|
|
106
|
+
/**
|
|
107
|
+
* The subscription ID
|
|
108
|
+
*/
|
|
109
|
+
id: string;
|
|
110
|
+
/**
|
|
111
|
+
* The product ID
|
|
112
|
+
*/
|
|
113
|
+
product_id: string;
|
|
114
|
+
/**
|
|
115
|
+
* The subscription status
|
|
116
|
+
*/
|
|
117
|
+
status: string;
|
|
118
|
+
/**
|
|
119
|
+
* The variant ID if applicable
|
|
120
|
+
*/
|
|
121
|
+
variant_id?: string | null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export interface PayCancelParams {
|
|
125
|
+
/**
|
|
126
|
+
* The customer ID
|
|
127
|
+
*/
|
|
128
|
+
customer_id: string;
|
|
129
|
+
/**
|
|
130
|
+
* The subscription ID to cancel
|
|
131
|
+
*/
|
|
132
|
+
subscription_id: string;
|
|
133
|
+
/**
|
|
134
|
+
* When to cancel the subscription. Defaults to 'at_billing_period_end' to allow
|
|
135
|
+
* customers to use remaining time.
|
|
136
|
+
*/
|
|
137
|
+
cancellation_timing?: 'immediate' | 'at_billing_period_end';
|
|
138
|
+
}
|
|
139
|
+
export interface PayCheckParams {
|
|
140
|
+
/**
|
|
141
|
+
* The customer ID
|
|
142
|
+
*/
|
|
143
|
+
customer_id: string;
|
|
144
|
+
/**
|
|
145
|
+
* The entitlement ID to check for access
|
|
146
|
+
*/
|
|
147
|
+
entitlement_id: string;
|
|
148
|
+
}
|
|
149
|
+
export interface PayCheckoutParams {
|
|
150
|
+
/**
|
|
151
|
+
* The customer ID
|
|
152
|
+
*/
|
|
153
|
+
customer_id: string;
|
|
154
|
+
/**
|
|
155
|
+
* The product ID to purchase
|
|
156
|
+
*/
|
|
157
|
+
product_id: string;
|
|
158
|
+
/**
|
|
159
|
+
* Optional custom ID for the subscription or payment. If not provided, one will be
|
|
160
|
+
* generated.
|
|
161
|
+
*/
|
|
162
|
+
id?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Override billing cycle anchor behavior for subscription updates. 'now' resets to
|
|
165
|
+
* current time, 'unchanged' keeps original anchor. If not provided, uses the
|
|
166
|
+
* price's configured default.
|
|
167
|
+
*/
|
|
168
|
+
billing_cycle_anchor?: 'now' | 'unchanged';
|
|
169
|
+
/**
|
|
170
|
+
* URL to redirect on cancel
|
|
171
|
+
*/
|
|
172
|
+
cancel_url?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Promotion code to apply
|
|
175
|
+
*/
|
|
176
|
+
promotion_code?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Override proration behavior for subscription updates. 'default' creates
|
|
179
|
+
* prorations, 'none' disables them. If not provided, uses the price's configured
|
|
180
|
+
* default.
|
|
181
|
+
*/
|
|
182
|
+
proration_behavior?: 'default' | 'none';
|
|
183
|
+
/**
|
|
184
|
+
* Override proration date calculation for subscription updates. 'now' uses current
|
|
185
|
+
* time, 'start_of_period' uses billing period start. If not provided, uses the
|
|
186
|
+
* price's configured default.
|
|
187
|
+
*/
|
|
188
|
+
proration_date?: 'now' | 'start_of_period';
|
|
189
|
+
/**
|
|
190
|
+
* URL to redirect on success
|
|
191
|
+
*/
|
|
192
|
+
success_url?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Optional variant ID to specify a particular pricing tier. If not provided, the
|
|
195
|
+
* product's default price is used.
|
|
196
|
+
*/
|
|
197
|
+
variant_id?: string;
|
|
198
|
+
}
|
|
199
|
+
export declare namespace Pay {
|
|
200
|
+
export { type PayCancelResponse as PayCancelResponse, type PayCheckResponse as PayCheckResponse, type PayCheckoutResponse as PayCheckoutResponse, type PayCancelParams as PayCancelParams, type PayCheckParams as PayCheckParams, type PayCheckoutParams as PayCheckoutParams, };
|
|
201
|
+
export { Customers as Customers, type Customer as Customer, type CustomerAddress as CustomerAddress, type CustomerBillingPortalResponse as CustomerBillingPortalResponse, type CustomersCursorIDPage as CustomersCursorIDPage, type CustomerCreateParams as CustomerCreateParams, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, type CustomerBillingPortalParams as CustomerBillingPortalParams, };
|
|
202
|
+
export { Products as Products, type Product as Product, type ProductsCursorIDPage as ProductsCursorIDPage, type ProductCreateParams as ProductCreateParams, type ProductUpdateParams as ProductUpdateParams, type ProductListParams as ProductListParams, };
|
|
203
|
+
export { Entitlements as Entitlements, type Entitlement as Entitlement, type EntitlementsCursorIDPage as EntitlementsCursorIDPage, type EntitlementCreateParams as EntitlementCreateParams, type EntitlementUpdateParams as EntitlementUpdateParams, type EntitlementListParams as EntitlementListParams, };
|
|
204
|
+
export { Coupons as Coupons, type Coupon as Coupon, type CouponsCursorIDPage as CouponsCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=pay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/pay/pay.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACpB;OACM,KAAK,YAAY;OACjB,EACL,QAAQ,EACR,eAAe,EACf,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,qBAAqB,EACtB;OACM,KAAK,eAAe;OACpB,EACL,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,wBAAwB,EACzB;OACM,KAAK,WAAW;OAChB,EACL,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,oBAAoB,EACrB;OACM,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,GAAI,SAAQ,WAAW;IAClC,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;IAC7E,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;IACxE,YAAY,EAAE,eAAe,CAAC,YAAY,CAAkD;IAC5F,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;IAEnE;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC;IAItF;;;;;OAKG;IACH,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC;IAInF;;;;OAIG;IACH,QAAQ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jD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;IAEF,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;IAEF,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.Pay = void 0;
|
|
5
|
+
const tslib_1 = require("../../../internal/tslib.js");
|
|
6
|
+
const resource_1 = require("../../../core/resource.js");
|
|
7
|
+
const CouponsAPI = tslib_1.__importStar(require("./coupons.js"));
|
|
8
|
+
const coupons_1 = require("./coupons.js");
|
|
9
|
+
const CustomersAPI = tslib_1.__importStar(require("./customers.js"));
|
|
10
|
+
const customers_1 = require("./customers.js");
|
|
11
|
+
const EntitlementsAPI = tslib_1.__importStar(require("./entitlements.js"));
|
|
12
|
+
const entitlements_1 = require("./entitlements.js");
|
|
13
|
+
const ProductsAPI = tslib_1.__importStar(require("./products/products.js"));
|
|
14
|
+
const products_1 = require("./products/products.js");
|
|
15
|
+
class Pay extends resource_1.APIResource {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.customers = new CustomersAPI.Customers(this._client);
|
|
19
|
+
this.products = new ProductsAPI.Products(this._client);
|
|
20
|
+
this.entitlements = new EntitlementsAPI.Entitlements(this._client);
|
|
21
|
+
this.coupons = new CouponsAPI.Coupons(this._client);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Cancels a customer's subscription. By default, the subscription remains active
|
|
25
|
+
* until the end of the current billing period. Set cancellation_timing to
|
|
26
|
+
* 'immediate' to cancel immediately.
|
|
27
|
+
*/
|
|
28
|
+
cancel(body, options) {
|
|
29
|
+
return this._client.post('/v1/pay/cancel', { body, ...options });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Verifies if a customer has access to a specific feature. Use this to gate
|
|
33
|
+
* features in your app based on the customer's active subscription and the
|
|
34
|
+
* entitlements attached to their product. Hercules recommends calling this before
|
|
35
|
+
* allowing access to premium features.
|
|
36
|
+
*/
|
|
37
|
+
check(body, options) {
|
|
38
|
+
return this._client.post('/v1/pay/check', { body, ...options });
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a checkout session for a customer to subscribe to a product. Returns a
|
|
42
|
+
* URL to redirect the customer to for payment. After successful payment, the
|
|
43
|
+
* customer is subscribed to the product and gains access to its entitlements.
|
|
44
|
+
*/
|
|
45
|
+
checkout(body, options) {
|
|
46
|
+
return this._client.post('/v1/pay/checkout', { body, ...options });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Pay = Pay;
|
|
50
|
+
Pay.Customers = customers_1.Customers;
|
|
51
|
+
Pay.Products = products_1.Products;
|
|
52
|
+
Pay.Entitlements = entitlements_1.Entitlements;
|
|
53
|
+
Pay.Coupons = coupons_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