@usehercules/sdk 1.7.0 → 1.8.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 +21 -0
- package/README.md +17 -16
- 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/commerce/commerce.d.mts +201 -0
- package/resources/beta/commerce/commerce.d.mts.map +1 -0
- package/resources/beta/commerce/commerce.d.ts +201 -0
- package/resources/beta/commerce/commerce.d.ts.map +1 -0
- package/resources/beta/{pay/pay.js → commerce/commerce.js} +10 -14
- package/resources/beta/commerce/commerce.js.map +1 -0
- package/resources/beta/{pay/pay.mjs → commerce/commerce.mjs} +8 -12
- package/resources/beta/commerce/commerce.mjs.map +1 -0
- package/resources/beta/commerce/coupons.d.mts +333 -0
- package/resources/beta/commerce/coupons.d.mts.map +1 -0
- package/resources/beta/commerce/coupons.d.ts +333 -0
- package/resources/beta/commerce/coupons.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/coupons.js +8 -5
- package/resources/beta/commerce/coupons.js.map +1 -0
- package/resources/beta/{pay → commerce}/coupons.mjs +8 -5
- package/resources/beta/commerce/coupons.mjs.map +1 -0
- package/resources/beta/commerce/customers.d.mts +407 -0
- package/resources/beta/commerce/customers.d.mts.map +1 -0
- package/resources/beta/commerce/customers.d.ts +407 -0
- package/resources/beta/commerce/customers.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/customers.js +9 -6
- package/resources/beta/commerce/customers.js.map +1 -0
- package/resources/beta/{pay → commerce}/customers.mjs +9 -6
- package/resources/beta/commerce/customers.mjs.map +1 -0
- package/resources/beta/commerce/index.d.mts +5 -0
- package/resources/beta/commerce/index.d.mts.map +1 -0
- package/resources/beta/commerce/index.d.ts +5 -0
- package/resources/beta/commerce/index.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/index.js +3 -5
- package/resources/beta/commerce/index.js.map +1 -0
- package/resources/beta/{pay → commerce}/index.mjs +1 -2
- package/resources/beta/commerce/index.mjs.map +1 -0
- package/resources/beta/commerce/products/index.d.mts +4 -0
- package/resources/beta/commerce/products/index.d.mts.map +1 -0
- package/resources/beta/commerce/products/index.d.ts +4 -0
- package/resources/beta/commerce/products/index.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/products/index.js +3 -3
- package/resources/beta/commerce/products/index.js.map +1 -0
- package/resources/beta/{pay → commerce}/products/index.mjs +1 -1
- package/resources/beta/commerce/products/index.mjs.map +1 -0
- package/resources/beta/commerce/products/products.d.mts +967 -0
- package/resources/beta/commerce/products/products.d.mts.map +1 -0
- package/resources/beta/commerce/products/products.d.ts +967 -0
- package/resources/beta/commerce/products/products.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/products/products.js +16 -12
- package/resources/beta/commerce/products/products.js.map +1 -0
- package/resources/beta/{pay → commerce}/products/products.mjs +16 -12
- package/resources/beta/commerce/products/products.mjs.map +1 -0
- package/resources/beta/commerce/products/resources.d.mts +160 -0
- package/resources/beta/commerce/products/resources.d.mts.map +1 -0
- package/resources/beta/commerce/products/resources.d.ts +160 -0
- package/resources/beta/commerce/products/resources.d.ts.map +1 -0
- package/resources/beta/commerce/products/resources.js +41 -0
- package/resources/beta/commerce/products/resources.js.map +1 -0
- package/resources/beta/commerce/products/resources.mjs +37 -0
- package/resources/beta/commerce/products/resources.mjs.map +1 -0
- package/resources/beta/commerce/products/variants.d.mts +798 -0
- package/resources/beta/commerce/products/variants.d.mts.map +1 -0
- package/resources/beta/commerce/products/variants.d.ts +798 -0
- package/resources/beta/commerce/products/variants.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/products/variants.js +5 -8
- package/resources/beta/commerce/products/variants.js.map +1 -0
- package/resources/beta/{pay → commerce}/products/variants.mjs +5 -8
- package/resources/beta/commerce/products/variants.mjs.map +1 -0
- package/resources/beta/commerce/products.d.mts.map +1 -0
- package/resources/beta/commerce/products.d.ts.map +1 -0
- package/resources/beta/commerce/products.js.map +1 -0
- package/resources/beta/commerce/products.mjs.map +1 -0
- package/resources/beta/commerce.d.mts +2 -0
- package/resources/beta/commerce.d.mts.map +1 -0
- package/resources/beta/commerce.d.ts +2 -0
- package/resources/beta/commerce.d.ts.map +1 -0
- package/resources/beta/{pay.js → commerce.js} +2 -2
- package/resources/beta/commerce.js.map +1 -0
- package/resources/beta/{pay.mjs → commerce.mjs} +2 -2
- package/resources/beta/commerce.mjs.map +1 -0
- 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/push-notifications/push-notifications.d.mts +8 -9
- package/resources/push-notifications/push-notifications.d.mts.map +1 -1
- package/resources/push-notifications/push-notifications.d.ts +8 -9
- package/resources/push-notifications/push-notifications.d.ts.map +1 -1
- package/resources/push-notifications/push-notifications.js +5 -6
- package/resources/push-notifications/push-notifications.js.map +1 -1
- package/resources/push-notifications/push-notifications.mjs +5 -6
- package/resources/push-notifications/push-notifications.mjs.map +1 -1
- package/src/resources/beta/beta.ts +18 -18
- package/src/resources/beta/{pay/pay.ts → commerce/commerce.ts} +82 -85
- package/src/resources/beta/commerce/coupons.ts +440 -0
- package/src/resources/beta/commerce/customers.ts +532 -0
- package/src/resources/beta/commerce/index.ts +47 -0
- package/src/resources/beta/commerce/products/index.ts +37 -0
- package/src/resources/beta/commerce/products/products.ts +1199 -0
- package/src/resources/beta/commerce/products/resources.ts +213 -0
- package/src/resources/beta/commerce/products/variants.ts +984 -0
- package/src/resources/beta/{pay.ts → commerce.ts} +1 -1
- package/src/resources/beta/index.ts +8 -8
- package/src/resources/push-notifications/push-notifications.ts +8 -9
- 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/pay/coupons.d.mts +0 -156
- package/resources/beta/pay/coupons.d.mts.map +0 -1
- package/resources/beta/pay/coupons.d.ts +0 -156
- package/resources/beta/pay/coupons.d.ts.map +0 -1
- package/resources/beta/pay/coupons.js.map +0 -1
- package/resources/beta/pay/coupons.mjs.map +0 -1
- package/resources/beta/pay/customers.d.mts +0 -160
- package/resources/beta/pay/customers.d.mts.map +0 -1
- package/resources/beta/pay/customers.d.ts +0 -160
- package/resources/beta/pay/customers.d.ts.map +0 -1
- package/resources/beta/pay/customers.js.map +0 -1
- package/resources/beta/pay/customers.mjs.map +0 -1
- package/resources/beta/pay/entitlements.d.mts +0 -76
- package/resources/beta/pay/entitlements.d.mts.map +0 -1
- package/resources/beta/pay/entitlements.d.ts +0 -76
- package/resources/beta/pay/entitlements.d.ts.map +0 -1
- package/resources/beta/pay/entitlements.js +0 -41
- package/resources/beta/pay/entitlements.js.map +0 -1
- package/resources/beta/pay/entitlements.mjs +0 -37
- package/resources/beta/pay/entitlements.mjs.map +0 -1
- package/resources/beta/pay/index.d.mts +0 -6
- package/resources/beta/pay/index.d.mts.map +0 -1
- package/resources/beta/pay/index.d.ts +0 -6
- package/resources/beta/pay/index.d.ts.map +0 -1
- package/resources/beta/pay/index.js.map +0 -1
- package/resources/beta/pay/index.mjs.map +0 -1
- package/resources/beta/pay/pay.d.mts +0 -206
- package/resources/beta/pay/pay.d.mts.map +0 -1
- package/resources/beta/pay/pay.d.ts +0 -206
- package/resources/beta/pay/pay.d.ts.map +0 -1
- package/resources/beta/pay/pay.js.map +0 -1
- package/resources/beta/pay/pay.mjs.map +0 -1
- package/resources/beta/pay/products/entitlements.d.mts +0 -53
- package/resources/beta/pay/products/entitlements.d.mts.map +0 -1
- package/resources/beta/pay/products/entitlements.d.ts +0 -53
- package/resources/beta/pay/products/entitlements.d.ts.map +0 -1
- package/resources/beta/pay/products/entitlements.js +0 -38
- package/resources/beta/pay/products/entitlements.js.map +0 -1
- package/resources/beta/pay/products/entitlements.mjs +0 -34
- package/resources/beta/pay/products/entitlements.mjs.map +0 -1
- package/resources/beta/pay/products/index.d.mts +0 -4
- package/resources/beta/pay/products/index.d.mts.map +0 -1
- package/resources/beta/pay/products/index.d.ts +0 -4
- package/resources/beta/pay/products/index.d.ts.map +0 -1
- package/resources/beta/pay/products/index.js.map +0 -1
- package/resources/beta/pay/products/index.mjs.map +0 -1
- package/resources/beta/pay/products/products.d.mts +0 -183
- package/resources/beta/pay/products/products.d.mts.map +0 -1
- package/resources/beta/pay/products/products.d.ts +0 -183
- package/resources/beta/pay/products/products.d.ts.map +0 -1
- package/resources/beta/pay/products/products.js.map +0 -1
- package/resources/beta/pay/products/products.mjs.map +0 -1
- package/resources/beta/pay/products/variants.d.mts +0 -206
- package/resources/beta/pay/products/variants.d.mts.map +0 -1
- package/resources/beta/pay/products/variants.d.ts +0 -206
- package/resources/beta/pay/products/variants.d.ts.map +0 -1
- package/resources/beta/pay/products/variants.js.map +0 -1
- package/resources/beta/pay/products/variants.mjs.map +0 -1
- package/resources/beta/pay/products.d.mts.map +0 -1
- package/resources/beta/pay/products.d.ts.map +0 -1
- package/resources/beta/pay/products.js.map +0 -1
- package/resources/beta/pay/products.mjs.map +0 -1
- package/resources/beta/pay.d.mts +0 -2
- package/resources/beta/pay.d.mts.map +0 -1
- package/resources/beta/pay.d.ts +0 -2
- package/resources/beta/pay.d.ts.map +0 -1
- package/resources/beta/pay.js.map +0 -1
- package/resources/beta/pay.mjs.map +0 -1
- package/src/resources/beta/pay/coupons.ts +0 -218
- package/src/resources/beta/pay/customers.ts +0 -229
- package/src/resources/beta/pay/entitlements.ts +0 -113
- package/src/resources/beta/pay/index.ts +0 -46
- package/src/resources/beta/pay/products/entitlements.ts +0 -93
- package/src/resources/beta/pay/products/index.ts +0 -28
- package/src/resources/beta/pay/products/products.ts +0 -280
- package/src/resources/beta/pay/products/variants.ts +0 -279
- /package/resources/beta/{pay → commerce}/products.d.mts +0 -0
- /package/resources/beta/{pay → commerce}/products.d.ts +0 -0
- /package/resources/beta/{pay → commerce}/products.js +0 -0
- /package/resources/beta/{pay → commerce}/products.mjs +0 -0
- /package/src/resources/beta/{pay → commerce}/products.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.0 (2026-01-08)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.7.0...v1.8.0](https://github.com/withzeusai/hercules-sdk-typescript/compare/v1.7.0...v1.8.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** update api ([fbd0fea](https://github.com/withzeusai/hercules-sdk-typescript/commit/fbd0fea496a3b231c1d64b62c798178c12b8c8f5))
|
|
10
|
+
* **api:** update api ([9e6bd68](https://github.com/withzeusai/hercules-sdk-typescript/commit/9e6bd689985d61e22725adb62848775c53defaf1))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **internal:** don't try to push symbols to nuget as separate package ([3d0a989](https://github.com/withzeusai/hercules-sdk-typescript/commit/3d0a98978117f84d90b92b7d9c4ef7fb44583d47))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Chores
|
|
19
|
+
|
|
20
|
+
* **internal:** codegen related update ([e7f55d0](https://github.com/withzeusai/hercules-sdk-typescript/commit/e7f55d043d75661be0cefafc3445f767b20622b6))
|
|
21
|
+
* **internal:** codegen related update ([d6711e1](https://github.com/withzeusai/hercules-sdk-typescript/commit/d6711e1a9979e42e0d9ee9f9e99eb0ee56a1f7ce))
|
|
22
|
+
* **internal:** codegen related update ([528f959](https://github.com/withzeusai/hercules-sdk-typescript/commit/528f959507a9dbf74fd1c23255d9bfd0442fe530))
|
|
23
|
+
|
|
3
24
|
## 1.7.0 (2026-01-08)
|
|
4
25
|
|
|
5
26
|
Full Changelog: [v1.6.0...v1.7.0](https://github.com/withzeusai/hercules-sdk-typescript/compare/v1.6.0...v1.7.0)
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ const client = new Hercules({
|
|
|
42
42
|
apiKey: process.env['HERCULES_API_KEY'], // This is the default and can be omitted
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
const customer = await client.beta.
|
|
45
|
+
const customer = await client.beta.commerce.customers.create({
|
|
46
46
|
email: 'john.doe@example.com',
|
|
47
47
|
name: 'John Doe',
|
|
48
48
|
});
|
|
@@ -63,7 +63,8 @@ const client = new Hercules({
|
|
|
63
63
|
apiKey: process.env['HERCULES_API_KEY'], // This is the default and can be omitted
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
const customer: Hercules.Beta.
|
|
66
|
+
const customer: Hercules.Beta.Commerce.CustomerGetResponse =
|
|
67
|
+
await client.beta.commerce.customers.get('REPLACE_ME');
|
|
67
68
|
```
|
|
68
69
|
|
|
69
70
|
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
@@ -76,7 +77,7 @@ a subclass of `APIError` will be thrown:
|
|
|
76
77
|
|
|
77
78
|
<!-- prettier-ignore -->
|
|
78
79
|
```ts
|
|
79
|
-
const customer = await client.beta.
|
|
80
|
+
const customer = await client.beta.commerce.customers.get('REPLACE_ME').catch(async (err) => {
|
|
80
81
|
if (err instanceof Hercules.APIError) {
|
|
81
82
|
console.log(err.status); // 400
|
|
82
83
|
console.log(err.name); // BadRequestError
|
|
@@ -117,7 +118,7 @@ const client = new Hercules({
|
|
|
117
118
|
});
|
|
118
119
|
|
|
119
120
|
// Or, configure per-request:
|
|
120
|
-
await client.beta.
|
|
121
|
+
await client.beta.commerce.customers.get('REPLACE_ME', {
|
|
121
122
|
maxRetries: 5,
|
|
122
123
|
});
|
|
123
124
|
```
|
|
@@ -135,7 +136,7 @@ const client = new Hercules({
|
|
|
135
136
|
});
|
|
136
137
|
|
|
137
138
|
// Override per-request:
|
|
138
|
-
await client.beta.
|
|
139
|
+
await client.beta.commerce.customers.get('REPLACE_ME', {
|
|
139
140
|
timeout: 5 * 1000,
|
|
140
141
|
});
|
|
141
142
|
```
|
|
@@ -150,25 +151,25 @@ List methods in the Hercules API are paginated.
|
|
|
150
151
|
You can use the `for await … of` syntax to iterate through items across all pages:
|
|
151
152
|
|
|
152
153
|
```ts
|
|
153
|
-
async function
|
|
154
|
-
const
|
|
154
|
+
async function fetchAllCustomerListResponses(params) {
|
|
155
|
+
const allCustomerListResponses = [];
|
|
155
156
|
// Automatically fetches more pages as needed.
|
|
156
|
-
for await (const
|
|
157
|
+
for await (const customerListResponse of client.beta.commerce.customers.list({
|
|
157
158
|
limit: 100,
|
|
158
159
|
starting_after: 'id_123',
|
|
159
160
|
})) {
|
|
160
|
-
|
|
161
|
+
allCustomerListResponses.push(customerListResponse);
|
|
161
162
|
}
|
|
162
|
-
return
|
|
163
|
+
return allCustomerListResponses;
|
|
163
164
|
}
|
|
164
165
|
```
|
|
165
166
|
|
|
166
167
|
Alternatively, you can request a single page at a time:
|
|
167
168
|
|
|
168
169
|
```ts
|
|
169
|
-
let page = await client.beta.
|
|
170
|
-
for (const
|
|
171
|
-
console.log(
|
|
170
|
+
let page = await client.beta.commerce.customers.list({ limit: 100, starting_after: 'id_123' });
|
|
171
|
+
for (const customerListResponse of page.data) {
|
|
172
|
+
console.log(customerListResponse);
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
// Convenience methods are provided for manually paginating:
|
|
@@ -192,11 +193,11 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
|
|
|
192
193
|
```ts
|
|
193
194
|
const client = new Hercules();
|
|
194
195
|
|
|
195
|
-
const response = await client.beta.
|
|
196
|
+
const response = await client.beta.commerce.customers.get('REPLACE_ME').asResponse();
|
|
196
197
|
console.log(response.headers.get('X-My-Header'));
|
|
197
198
|
console.log(response.statusText); // access the underlying Response object
|
|
198
199
|
|
|
199
|
-
const { data: customer, response: raw } = await client.beta.
|
|
200
|
+
const { data: customer, response: raw } = await client.beta.commerce.customers
|
|
200
201
|
.get('REPLACE_ME')
|
|
201
202
|
.withResponse();
|
|
202
203
|
console.log(raw.headers.get('X-My-Header'));
|
|
@@ -280,7 +281,7 @@ parameter. This library doesn't validate at runtime that the request matches the
|
|
|
280
281
|
send will be sent as-is.
|
|
281
282
|
|
|
282
283
|
```ts
|
|
283
|
-
client.beta.
|
|
284
|
+
client.beta.commerce.customers.create({
|
|
284
285
|
// ...
|
|
285
286
|
// @ts-expect-error baz is not yet public
|
|
286
287
|
baz: 'undocumented option',
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
2
|
+
import * as CommerceAPI from "./commerce/commerce.mjs";
|
|
3
|
+
import { Commerce, CommerceCancelParams, CommerceCancelResponse, CommerceCheckParams, CommerceCheckResponse, CommerceCheckoutParams, CommerceCheckoutResponse } from "./commerce/commerce.mjs";
|
|
4
4
|
export declare class Beta extends APIResource {
|
|
5
|
-
|
|
5
|
+
commerce: CommerceAPI.Commerce;
|
|
6
6
|
}
|
|
7
7
|
export declare namespace Beta {
|
|
8
|
-
export {
|
|
8
|
+
export { Commerce as Commerce, type CommerceCancelResponse as CommerceCancelResponse, type CommerceCheckResponse as CommerceCheckResponse, type CommerceCheckoutResponse as CommerceCheckoutResponse, type CommerceCancelParams as CommerceCancelParams, type CommerceCheckParams as CommerceCheckParams, type CommerceCheckoutParams as CommerceCheckoutParams, };
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=beta.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beta.d.mts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,
|
|
1
|
+
{"version":3,"file":"beta.d.mts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EACL,QAAQ,EACR,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACzB;AAED,qBAAa,IAAK,SAAQ,WAAW;IACnC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;CACzE;AAID,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
package/resources/beta/beta.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.js";
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
2
|
+
import * as CommerceAPI from "./commerce/commerce.js";
|
|
3
|
+
import { Commerce, CommerceCancelParams, CommerceCancelResponse, CommerceCheckParams, CommerceCheckResponse, CommerceCheckoutParams, CommerceCheckoutResponse } from "./commerce/commerce.js";
|
|
4
4
|
export declare class Beta extends APIResource {
|
|
5
|
-
|
|
5
|
+
commerce: CommerceAPI.Commerce;
|
|
6
6
|
}
|
|
7
7
|
export declare namespace Beta {
|
|
8
|
-
export {
|
|
8
|
+
export { Commerce as Commerce, type CommerceCancelResponse as CommerceCancelResponse, type CommerceCheckResponse as CommerceCheckResponse, type CommerceCheckoutResponse as CommerceCheckoutResponse, type CommerceCancelParams as CommerceCancelParams, type CommerceCheckParams as CommerceCheckParams, type CommerceCheckoutParams as CommerceCheckoutParams, };
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=beta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beta.d.ts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,
|
|
1
|
+
{"version":3,"file":"beta.d.ts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EACL,QAAQ,EACR,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACzB;AAED,qBAAa,IAAK,SAAQ,WAAW;IACnC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;CACzE;AAID,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
package/resources/beta/beta.js
CHANGED
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Beta = void 0;
|
|
5
5
|
const tslib_1 = require("../../internal/tslib.js");
|
|
6
6
|
const resource_1 = require("../../core/resource.js");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const CommerceAPI = tslib_1.__importStar(require("./commerce/commerce.js"));
|
|
8
|
+
const commerce_1 = require("./commerce/commerce.js");
|
|
9
9
|
class Beta extends resource_1.APIResource {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
this.
|
|
12
|
+
this.commerce = new CommerceAPI.Commerce(this._client);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.Beta = Beta;
|
|
16
|
-
Beta.
|
|
16
|
+
Beta.Commerce = commerce_1.Commerce;
|
|
17
17
|
//# sourceMappingURL=beta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beta.js","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"beta.js","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,4EAAmD;AACnD,qDAQ6B;AAE7B,MAAa,IAAK,SAAQ,sBAAW;IAArC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;CAAA;AAFD,oBAEC;AAED,IAAI,CAAC,QAAQ,GAAG,mBAAQ,CAAC"}
|
package/resources/beta/beta.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
3
|
+
import * as CommerceAPI from "./commerce/commerce.mjs";
|
|
4
|
+
import { Commerce, } from "./commerce/commerce.mjs";
|
|
5
5
|
export class Beta extends APIResource {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
this.
|
|
8
|
+
this.commerce = new CommerceAPI.Commerce(this._client);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
Beta.
|
|
11
|
+
Beta.Commerce = Commerce;
|
|
12
12
|
//# sourceMappingURL=beta.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beta.mjs","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,
|
|
1
|
+
{"version":3,"file":"beta.mjs","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EACL,QAAQ,GAOT;AAED,MAAM,OAAO,IAAK,SAAQ,WAAW;IAArC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;CAAA;AAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
+
import * as CouponsAPI from "./coupons.mjs";
|
|
3
|
+
import { CouponCreateParams, CouponCreateResponse, CouponGetResponse, CouponListParams, CouponListResponse, CouponListResponsesCursorIDPage, CouponUpdateParams, CouponUpdateResponse, Coupons } from "./coupons.mjs";
|
|
4
|
+
import * as CustomersAPI from "./customers.mjs";
|
|
5
|
+
import { CustomerBillingPortalParams, CustomerBillingPortalResponse, CustomerCreateParams, CustomerCreateResponse, CustomerGetResponse, CustomerListParams, CustomerListResponse, CustomerListResponsesCursorIDPage, CustomerUpdateParams, CustomerUpdateResponse, Customers } from "./customers.mjs";
|
|
6
|
+
import * as ProductsAPI from "./products/products.mjs";
|
|
7
|
+
import { ProductArchiveResponse, ProductCreateParams, ProductCreateResponse, ProductGetResponse, ProductListParams, ProductListResponse, ProductListResponsesCursorIDPage, ProductUpdateParams, ProductUpdateResponse, Products } from "./products/products.mjs";
|
|
8
|
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
9
|
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
10
|
+
export declare class Commerce extends APIResource {
|
|
11
|
+
customers: CustomersAPI.Customers;
|
|
12
|
+
products: ProductsAPI.Products;
|
|
13
|
+
coupons: CouponsAPI.Coupons;
|
|
14
|
+
/**
|
|
15
|
+
* Cancels a customer's subscription. By default, the subscription remains active
|
|
16
|
+
* until the end of the current billing period. Set cancellation_timing to
|
|
17
|
+
* 'immediate' to cancel immediately.
|
|
18
|
+
*/
|
|
19
|
+
cancel(body: CommerceCancelParams, options?: RequestOptions): APIPromise<CommerceCancelResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Verifies if a customer has access to a specific feature. Use this to gate
|
|
22
|
+
* features in your app based on the customer's active subscription and the
|
|
23
|
+
* entitlements attached to their product. Hercules recommends calling this before
|
|
24
|
+
* allowing access to premium features.
|
|
25
|
+
*/
|
|
26
|
+
check(body: CommerceCheckParams, options?: RequestOptions): APIPromise<CommerceCheckResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a checkout session for a customer to subscribe to a product. Returns a
|
|
29
|
+
* URL to redirect the customer to for payment. After successful payment, the
|
|
30
|
+
* customer is subscribed to the product and gains access to its entitlements.
|
|
31
|
+
*/
|
|
32
|
+
checkout(body: CommerceCheckoutParams, options?: RequestOptions): APIPromise<CommerceCheckoutResponse>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cancel subscription response
|
|
36
|
+
*/
|
|
37
|
+
export interface CommerceCancelResponse {
|
|
38
|
+
/**
|
|
39
|
+
* The subscription ID
|
|
40
|
+
*/
|
|
41
|
+
id: string;
|
|
42
|
+
/**
|
|
43
|
+
* When the cancellation takes effect
|
|
44
|
+
*/
|
|
45
|
+
cancellation_timing: 'immediate' | 'at_billing_period_end';
|
|
46
|
+
/**
|
|
47
|
+
* The subscription status
|
|
48
|
+
*/
|
|
49
|
+
status: string;
|
|
50
|
+
/**
|
|
51
|
+
* When the subscription was canceled
|
|
52
|
+
*/
|
|
53
|
+
canceled_at?: string | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check resource access response. Indicates whether access is granted and through
|
|
57
|
+
* what means.
|
|
58
|
+
*/
|
|
59
|
+
export interface CommerceCheckResponse {
|
|
60
|
+
/**
|
|
61
|
+
* How the customer has access: through a subscription, one-time purchase, manual
|
|
62
|
+
* grant, or no access
|
|
63
|
+
*/
|
|
64
|
+
access_type: 'subscription' | 'one_time_purchase' | 'manual_grant' | 'none';
|
|
65
|
+
/**
|
|
66
|
+
* Whether the customer has access to the resource
|
|
67
|
+
*/
|
|
68
|
+
has_access: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The resource ID that was checked
|
|
71
|
+
*/
|
|
72
|
+
resource_id: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Checkout response. For new customers, returns a checkout URL. For existing
|
|
76
|
+
* subscribers, returns the updated subscription.
|
|
77
|
+
*/
|
|
78
|
+
export interface CommerceCheckoutResponse {
|
|
79
|
+
/**
|
|
80
|
+
* The checkout session ID (for checkout action) or subscription ID (for update
|
|
81
|
+
* action)
|
|
82
|
+
*/
|
|
83
|
+
id: string;
|
|
84
|
+
/**
|
|
85
|
+
* The action taken: 'checkout' for new subscriptions (redirect to URL), 'update'
|
|
86
|
+
* for subscription changes (already applied)
|
|
87
|
+
*/
|
|
88
|
+
action: 'checkout' | 'update';
|
|
89
|
+
/**
|
|
90
|
+
* The checkout mode: subscription for recurring prices, payment for one-time
|
|
91
|
+
* prices. Only present for 'checkout' action.
|
|
92
|
+
*/
|
|
93
|
+
mode?: 'subscription' | 'payment' | null;
|
|
94
|
+
/**
|
|
95
|
+
* The updated subscription details. Only present for 'update' action.
|
|
96
|
+
*/
|
|
97
|
+
subscription?: CommerceCheckoutResponse.Subscription | null;
|
|
98
|
+
/**
|
|
99
|
+
* The checkout URL to redirect the customer to. Only present for 'checkout'
|
|
100
|
+
* action.
|
|
101
|
+
*/
|
|
102
|
+
url?: string | null;
|
|
103
|
+
}
|
|
104
|
+
export declare namespace CommerceCheckoutResponse {
|
|
105
|
+
/**
|
|
106
|
+
* The updated subscription details. Only present for 'update' action.
|
|
107
|
+
*/
|
|
108
|
+
interface Subscription {
|
|
109
|
+
/**
|
|
110
|
+
* The subscription ID
|
|
111
|
+
*/
|
|
112
|
+
id: string;
|
|
113
|
+
/**
|
|
114
|
+
* The product ID
|
|
115
|
+
*/
|
|
116
|
+
product_id: string;
|
|
117
|
+
/**
|
|
118
|
+
* The subscription status
|
|
119
|
+
*/
|
|
120
|
+
status: string;
|
|
121
|
+
/**
|
|
122
|
+
* The variant ID if applicable
|
|
123
|
+
*/
|
|
124
|
+
variant_id?: string | null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export interface CommerceCancelParams {
|
|
128
|
+
/**
|
|
129
|
+
* The customer ID
|
|
130
|
+
*/
|
|
131
|
+
customer_id: string;
|
|
132
|
+
/**
|
|
133
|
+
* The subscription ID to cancel
|
|
134
|
+
*/
|
|
135
|
+
subscription_id: string;
|
|
136
|
+
/**
|
|
137
|
+
* When to cancel the subscription. Defaults to 'at_billing_period_end' to allow
|
|
138
|
+
* customers to use remaining time.
|
|
139
|
+
*/
|
|
140
|
+
cancellation_timing?: 'immediate' | 'at_billing_period_end';
|
|
141
|
+
}
|
|
142
|
+
export interface CommerceCheckParams {
|
|
143
|
+
/**
|
|
144
|
+
* The customer ID
|
|
145
|
+
*/
|
|
146
|
+
customer_id: string;
|
|
147
|
+
/**
|
|
148
|
+
* The resource ID to check for access
|
|
149
|
+
*/
|
|
150
|
+
resource_id: string;
|
|
151
|
+
}
|
|
152
|
+
export interface CommerceCheckoutParams {
|
|
153
|
+
/**
|
|
154
|
+
* The customer ID
|
|
155
|
+
*/
|
|
156
|
+
customer_id: string;
|
|
157
|
+
/**
|
|
158
|
+
* The variant ID to purchase. Determines pricing and whether this is a
|
|
159
|
+
* subscription or one-time payment.
|
|
160
|
+
*/
|
|
161
|
+
variant_id: string;
|
|
162
|
+
/**
|
|
163
|
+
* Optional custom ID for the subscription or payment. If not provided, one will be
|
|
164
|
+
* generated.
|
|
165
|
+
*/
|
|
166
|
+
id?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Override billing cycle anchor behavior for subscription updates. If not
|
|
169
|
+
* provided, uses the product group's configured default.
|
|
170
|
+
*/
|
|
171
|
+
billing_cycle_anchor?: 'now' | 'unchanged' | 'reset';
|
|
172
|
+
/**
|
|
173
|
+
* URL to redirect on cancel
|
|
174
|
+
*/
|
|
175
|
+
cancel_url?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Promotion code to apply
|
|
178
|
+
*/
|
|
179
|
+
promotion_code?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Override proration behavior for subscription updates. If not provided, uses the
|
|
182
|
+
* product group's configured default.
|
|
183
|
+
*/
|
|
184
|
+
proration_behavior?: 'create_prorations' | 'none' | 'always_invoice';
|
|
185
|
+
/**
|
|
186
|
+
* Override proration date calculation for subscription updates. If not provided,
|
|
187
|
+
* uses the product group's configured default.
|
|
188
|
+
*/
|
|
189
|
+
proration_date?: 'now' | 'start_of_period';
|
|
190
|
+
/**
|
|
191
|
+
* URL to redirect on success
|
|
192
|
+
*/
|
|
193
|
+
success_url?: string;
|
|
194
|
+
}
|
|
195
|
+
export declare namespace Commerce {
|
|
196
|
+
export { type CommerceCancelResponse as CommerceCancelResponse, type CommerceCheckResponse as CommerceCheckResponse, type CommerceCheckoutResponse as CommerceCheckoutResponse, type CommerceCancelParams as CommerceCancelParams, type CommerceCheckParams as CommerceCheckParams, type CommerceCheckoutParams as CommerceCheckoutParams, };
|
|
197
|
+
export { Customers as Customers, type CustomerCreateResponse as CustomerCreateResponse, type CustomerUpdateResponse as CustomerUpdateResponse, type CustomerListResponse as CustomerListResponse, type CustomerBillingPortalResponse as CustomerBillingPortalResponse, type CustomerGetResponse as CustomerGetResponse, type CustomerListResponsesCursorIDPage as CustomerListResponsesCursorIDPage, type CustomerCreateParams as CustomerCreateParams, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, type CustomerBillingPortalParams as CustomerBillingPortalParams, };
|
|
198
|
+
export { Products as Products, type ProductCreateResponse as ProductCreateResponse, type ProductUpdateResponse as ProductUpdateResponse, type ProductListResponse as ProductListResponse, type ProductArchiveResponse as ProductArchiveResponse, type ProductGetResponse as ProductGetResponse, type ProductListResponsesCursorIDPage as ProductListResponsesCursorIDPage, type ProductCreateParams as ProductCreateParams, type ProductUpdateParams as ProductUpdateParams, type ProductListParams as ProductListParams, };
|
|
199
|
+
export { Coupons as Coupons, type CouponCreateResponse as CouponCreateResponse, type CouponUpdateResponse as CouponUpdateResponse, type CouponListResponse as CouponListResponse, type CouponGetResponse as CouponGetResponse, type CouponListResponsesCursorIDPage as CouponListResponsesCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=commerce.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commerce.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,+BAA+B,EAC/B,kBAAkB,EAClB,oBAAoB,EACpB,OAAO,EACR;OACM,KAAK,YAAY;OACjB,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,iCAAiC,EACjC,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACV;OACM,KAAK,WAAW;OAChB,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,gCAAgC,EAChC,mBAAmB,EACnB,qBAAqB,EACrB,QAAQ,EACT;OACM,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,QAAS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AAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import * as CouponsAPI from "./coupons.js";
|
|
3
|
+
import { CouponCreateParams, CouponCreateResponse, CouponGetResponse, CouponListParams, CouponListResponse, CouponListResponsesCursorIDPage, CouponUpdateParams, CouponUpdateResponse, Coupons } from "./coupons.js";
|
|
4
|
+
import * as CustomersAPI from "./customers.js";
|
|
5
|
+
import { CustomerBillingPortalParams, CustomerBillingPortalResponse, CustomerCreateParams, CustomerCreateResponse, CustomerGetResponse, CustomerListParams, CustomerListResponse, CustomerListResponsesCursorIDPage, CustomerUpdateParams, CustomerUpdateResponse, Customers } from "./customers.js";
|
|
6
|
+
import * as ProductsAPI from "./products/products.js";
|
|
7
|
+
import { ProductArchiveResponse, ProductCreateParams, ProductCreateResponse, ProductGetResponse, ProductListParams, ProductListResponse, ProductListResponsesCursorIDPage, ProductUpdateParams, ProductUpdateResponse, Products } from "./products/products.js";
|
|
8
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
9
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
10
|
+
export declare class Commerce extends APIResource {
|
|
11
|
+
customers: CustomersAPI.Customers;
|
|
12
|
+
products: ProductsAPI.Products;
|
|
13
|
+
coupons: CouponsAPI.Coupons;
|
|
14
|
+
/**
|
|
15
|
+
* Cancels a customer's subscription. By default, the subscription remains active
|
|
16
|
+
* until the end of the current billing period. Set cancellation_timing to
|
|
17
|
+
* 'immediate' to cancel immediately.
|
|
18
|
+
*/
|
|
19
|
+
cancel(body: CommerceCancelParams, options?: RequestOptions): APIPromise<CommerceCancelResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Verifies if a customer has access to a specific feature. Use this to gate
|
|
22
|
+
* features in your app based on the customer's active subscription and the
|
|
23
|
+
* entitlements attached to their product. Hercules recommends calling this before
|
|
24
|
+
* allowing access to premium features.
|
|
25
|
+
*/
|
|
26
|
+
check(body: CommerceCheckParams, options?: RequestOptions): APIPromise<CommerceCheckResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a checkout session for a customer to subscribe to a product. Returns a
|
|
29
|
+
* URL to redirect the customer to for payment. After successful payment, the
|
|
30
|
+
* customer is subscribed to the product and gains access to its entitlements.
|
|
31
|
+
*/
|
|
32
|
+
checkout(body: CommerceCheckoutParams, options?: RequestOptions): APIPromise<CommerceCheckoutResponse>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cancel subscription response
|
|
36
|
+
*/
|
|
37
|
+
export interface CommerceCancelResponse {
|
|
38
|
+
/**
|
|
39
|
+
* The subscription ID
|
|
40
|
+
*/
|
|
41
|
+
id: string;
|
|
42
|
+
/**
|
|
43
|
+
* When the cancellation takes effect
|
|
44
|
+
*/
|
|
45
|
+
cancellation_timing: 'immediate' | 'at_billing_period_end';
|
|
46
|
+
/**
|
|
47
|
+
* The subscription status
|
|
48
|
+
*/
|
|
49
|
+
status: string;
|
|
50
|
+
/**
|
|
51
|
+
* When the subscription was canceled
|
|
52
|
+
*/
|
|
53
|
+
canceled_at?: string | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check resource access response. Indicates whether access is granted and through
|
|
57
|
+
* what means.
|
|
58
|
+
*/
|
|
59
|
+
export interface CommerceCheckResponse {
|
|
60
|
+
/**
|
|
61
|
+
* How the customer has access: through a subscription, one-time purchase, manual
|
|
62
|
+
* grant, or no access
|
|
63
|
+
*/
|
|
64
|
+
access_type: 'subscription' | 'one_time_purchase' | 'manual_grant' | 'none';
|
|
65
|
+
/**
|
|
66
|
+
* Whether the customer has access to the resource
|
|
67
|
+
*/
|
|
68
|
+
has_access: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The resource ID that was checked
|
|
71
|
+
*/
|
|
72
|
+
resource_id: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Checkout response. For new customers, returns a checkout URL. For existing
|
|
76
|
+
* subscribers, returns the updated subscription.
|
|
77
|
+
*/
|
|
78
|
+
export interface CommerceCheckoutResponse {
|
|
79
|
+
/**
|
|
80
|
+
* The checkout session ID (for checkout action) or subscription ID (for update
|
|
81
|
+
* action)
|
|
82
|
+
*/
|
|
83
|
+
id: string;
|
|
84
|
+
/**
|
|
85
|
+
* The action taken: 'checkout' for new subscriptions (redirect to URL), 'update'
|
|
86
|
+
* for subscription changes (already applied)
|
|
87
|
+
*/
|
|
88
|
+
action: 'checkout' | 'update';
|
|
89
|
+
/**
|
|
90
|
+
* The checkout mode: subscription for recurring prices, payment for one-time
|
|
91
|
+
* prices. Only present for 'checkout' action.
|
|
92
|
+
*/
|
|
93
|
+
mode?: 'subscription' | 'payment' | null;
|
|
94
|
+
/**
|
|
95
|
+
* The updated subscription details. Only present for 'update' action.
|
|
96
|
+
*/
|
|
97
|
+
subscription?: CommerceCheckoutResponse.Subscription | null;
|
|
98
|
+
/**
|
|
99
|
+
* The checkout URL to redirect the customer to. Only present for 'checkout'
|
|
100
|
+
* action.
|
|
101
|
+
*/
|
|
102
|
+
url?: string | null;
|
|
103
|
+
}
|
|
104
|
+
export declare namespace CommerceCheckoutResponse {
|
|
105
|
+
/**
|
|
106
|
+
* The updated subscription details. Only present for 'update' action.
|
|
107
|
+
*/
|
|
108
|
+
interface Subscription {
|
|
109
|
+
/**
|
|
110
|
+
* The subscription ID
|
|
111
|
+
*/
|
|
112
|
+
id: string;
|
|
113
|
+
/**
|
|
114
|
+
* The product ID
|
|
115
|
+
*/
|
|
116
|
+
product_id: string;
|
|
117
|
+
/**
|
|
118
|
+
* The subscription status
|
|
119
|
+
*/
|
|
120
|
+
status: string;
|
|
121
|
+
/**
|
|
122
|
+
* The variant ID if applicable
|
|
123
|
+
*/
|
|
124
|
+
variant_id?: string | null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export interface CommerceCancelParams {
|
|
128
|
+
/**
|
|
129
|
+
* The customer ID
|
|
130
|
+
*/
|
|
131
|
+
customer_id: string;
|
|
132
|
+
/**
|
|
133
|
+
* The subscription ID to cancel
|
|
134
|
+
*/
|
|
135
|
+
subscription_id: string;
|
|
136
|
+
/**
|
|
137
|
+
* When to cancel the subscription. Defaults to 'at_billing_period_end' to allow
|
|
138
|
+
* customers to use remaining time.
|
|
139
|
+
*/
|
|
140
|
+
cancellation_timing?: 'immediate' | 'at_billing_period_end';
|
|
141
|
+
}
|
|
142
|
+
export interface CommerceCheckParams {
|
|
143
|
+
/**
|
|
144
|
+
* The customer ID
|
|
145
|
+
*/
|
|
146
|
+
customer_id: string;
|
|
147
|
+
/**
|
|
148
|
+
* The resource ID to check for access
|
|
149
|
+
*/
|
|
150
|
+
resource_id: string;
|
|
151
|
+
}
|
|
152
|
+
export interface CommerceCheckoutParams {
|
|
153
|
+
/**
|
|
154
|
+
* The customer ID
|
|
155
|
+
*/
|
|
156
|
+
customer_id: string;
|
|
157
|
+
/**
|
|
158
|
+
* The variant ID to purchase. Determines pricing and whether this is a
|
|
159
|
+
* subscription or one-time payment.
|
|
160
|
+
*/
|
|
161
|
+
variant_id: string;
|
|
162
|
+
/**
|
|
163
|
+
* Optional custom ID for the subscription or payment. If not provided, one will be
|
|
164
|
+
* generated.
|
|
165
|
+
*/
|
|
166
|
+
id?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Override billing cycle anchor behavior for subscription updates. If not
|
|
169
|
+
* provided, uses the product group's configured default.
|
|
170
|
+
*/
|
|
171
|
+
billing_cycle_anchor?: 'now' | 'unchanged' | 'reset';
|
|
172
|
+
/**
|
|
173
|
+
* URL to redirect on cancel
|
|
174
|
+
*/
|
|
175
|
+
cancel_url?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Promotion code to apply
|
|
178
|
+
*/
|
|
179
|
+
promotion_code?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Override proration behavior for subscription updates. If not provided, uses the
|
|
182
|
+
* product group's configured default.
|
|
183
|
+
*/
|
|
184
|
+
proration_behavior?: 'create_prorations' | 'none' | 'always_invoice';
|
|
185
|
+
/**
|
|
186
|
+
* Override proration date calculation for subscription updates. If not provided,
|
|
187
|
+
* uses the product group's configured default.
|
|
188
|
+
*/
|
|
189
|
+
proration_date?: 'now' | 'start_of_period';
|
|
190
|
+
/**
|
|
191
|
+
* URL to redirect on success
|
|
192
|
+
*/
|
|
193
|
+
success_url?: string;
|
|
194
|
+
}
|
|
195
|
+
export declare namespace Commerce {
|
|
196
|
+
export { type CommerceCancelResponse as CommerceCancelResponse, type CommerceCheckResponse as CommerceCheckResponse, type CommerceCheckoutResponse as CommerceCheckoutResponse, type CommerceCancelParams as CommerceCancelParams, type CommerceCheckParams as CommerceCheckParams, type CommerceCheckoutParams as CommerceCheckoutParams, };
|
|
197
|
+
export { Customers as Customers, type CustomerCreateResponse as CustomerCreateResponse, type CustomerUpdateResponse as CustomerUpdateResponse, type CustomerListResponse as CustomerListResponse, type CustomerBillingPortalResponse as CustomerBillingPortalResponse, type CustomerGetResponse as CustomerGetResponse, type CustomerListResponsesCursorIDPage as CustomerListResponsesCursorIDPage, type CustomerCreateParams as CustomerCreateParams, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, type CustomerBillingPortalParams as CustomerBillingPortalParams, };
|
|
198
|
+
export { Products as Products, type ProductCreateResponse as ProductCreateResponse, type ProductUpdateResponse as ProductUpdateResponse, type ProductListResponse as ProductListResponse, type ProductArchiveResponse as ProductArchiveResponse, type ProductGetResponse as ProductGetResponse, type ProductListResponsesCursorIDPage as ProductListResponsesCursorIDPage, type ProductCreateParams as ProductCreateParams, type ProductUpdateParams as ProductUpdateParams, type ProductListParams as ProductListParams, };
|
|
199
|
+
export { Coupons as Coupons, type CouponCreateResponse as CouponCreateResponse, type CouponUpdateResponse as CouponUpdateResponse, type CouponListResponse as CouponListResponse, type CouponGetResponse as CouponGetResponse, type CouponListResponsesCursorIDPage as CouponListResponsesCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=commerce.d.ts.map
|