@stackup-fi/sdk 1.0.7 → 1.0.9

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/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./v1/gen/types.gen.js";
2
2
  import { type Config } from "./v1/gen/client/types.gen.js";
3
3
  import { StackupClient } from "./v1/gen/sdk.gen.js";
4
- export { type Config as OpencodeClientConfig, StackupClient };
4
+ export { type Config as StackupClientConfig, StackupClient };
5
5
  export declare function createStackupClient(config?: Config): StackupClient;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./client.js";
2
+ export * from "./notify/notify.js";
2
3
  export interface Options {
3
4
  accessToken: string;
4
5
  baseUrl?: string;
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  export * from "./client.js";
2
+ export * from "./notify/notify.js";
2
3
  import { createStackupClient } from "./client.js";
3
4
  export function createStackup(options) {
4
5
  const client = createStackupClient({
5
- baseUrl: options.baseUrl ?? "https://api.stackup.finance",
6
6
  headers: {
7
7
  Authorization: `Bearer ${options.accessToken}`,
8
8
  },
9
+ baseUrl: options.baseUrl ?? "https://api.stackup.finance",
9
10
  });
10
11
  return {
11
12
  client,
@@ -0,0 +1,4 @@
1
+ import { type CheckArgs, type CheckResult, type WebhookArgs } from "./types.js";
2
+ export * from "./types.js";
3
+ export declare function notify(args: CheckArgs): Promise<CheckResult>;
4
+ export declare function notify(args: WebhookArgs): (req: Request) => Promise<Response>;
@@ -0,0 +1,54 @@
1
+ import { createClient } from "../v1/gen/client/client.gen.js";
2
+ import { StackupClient } from "../v1/gen/sdk.gen.js";
3
+ import { verifyTimestamp } from "./util.js";
4
+ export * from "./types.js";
5
+ const DEFAULT_TOLERANCE = 300; // 5 minutes
6
+ export function notify(args) {
7
+ if (args.mode === "check")
8
+ return check(args);
9
+ return webhook(args);
10
+ }
11
+ async function check(args) {
12
+ const client = new StackupClient({
13
+ client: createClient({
14
+ baseUrl: args.baseUrl ?? "https://api.stackup.finance",
15
+ headers: {
16
+ Authorization: `Bearer ${args.accessToken}`,
17
+ },
18
+ }),
19
+ });
20
+ return client.customer.check({
21
+ customerID: args.customerID,
22
+ productID: args.productID,
23
+ });
24
+ }
25
+ function webhook(config) {
26
+ const tolerance = config.tolerance ?? DEFAULT_TOLERANCE;
27
+ return async (req) => {
28
+ const timestamp = req.headers.get("x-webhook-timestamp");
29
+ const signature = req.headers.get("x-webhook-signature");
30
+ if (!timestamp || !signature)
31
+ return Response.json({
32
+ code: "bad_request",
33
+ message: "Missing webhook timestamp or signature",
34
+ }, { status: 400 });
35
+ const payload = await req.text();
36
+ if (!verifyTimestamp(timestamp, tolerance))
37
+ return Response.json({ code: "bad_request", message: "Webhook timestamp expired" }, { status: 400 });
38
+ const allow = await (async () => {
39
+ const encoder = new TextEncoder();
40
+ const key = await crypto.subtle.importKey("raw", encoder.encode(config.secret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
41
+ const bytes = await crypto.subtle.sign("HMAC", key, encoder.encode(`${timestamp}.${payload}`));
42
+ const expected = Array.from(new Uint8Array(bytes))
43
+ .map((b) => b.toString(16).padStart(2, "0"))
44
+ .join("");
45
+ return expected === signature.replace("sha256=", "");
46
+ })().catch(() => false);
47
+ if (!allow)
48
+ return Response.json({ code: "bad_request", message: "Invalid webhook signature" }, { status: 400 });
49
+ return await config
50
+ .handler(JSON.parse(payload))
51
+ .then(() => new Response(null, { status: 200 }))
52
+ .catch(() => Response.json({ code: "internal", message: "Internal server error" }, { status: 500 }));
53
+ };
54
+ }
@@ -0,0 +1,48 @@
1
+ type Address = `0x${string}`;
2
+ type Hex = `0x${string}`;
3
+ import type { CustomerCheckErrors, CustomerCheckResponses } from "../v1/gen/types.gen.js";
4
+ import type { RequestResult } from "../v1/gen/client/types.gen.js";
5
+ type Prettify<T> = {
6
+ [K in keyof T]: Prettify<T[K]>;
7
+ } & {};
8
+ export interface Customer {
9
+ walletAddress: Address;
10
+ email: string | null;
11
+ name: string | null;
12
+ externalID: string | null;
13
+ }
14
+ export interface Payment {
15
+ status: "succeeded" | "failed";
16
+ amount: string;
17
+ tokenAddress: string | null;
18
+ txHash: Hex;
19
+ blockNumber: number;
20
+ productID: string | null;
21
+ }
22
+ export type WebhookEvent = Prettify<{
23
+ type: "payment.succeeded";
24
+ payload: {
25
+ customer: Customer;
26
+ payment: Payment;
27
+ };
28
+ }>;
29
+ export interface CheckArgs {
30
+ mode: "check";
31
+ accessToken: string;
32
+ customerID: string;
33
+ productID: string;
34
+ baseUrl?: string;
35
+ }
36
+ export interface WebhookArgs {
37
+ mode: "webhook";
38
+ secret: string;
39
+ tolerance?: number;
40
+ handler: WebhookHandler;
41
+ }
42
+ export type CheckResult = RequestResult<CustomerCheckResponses, CustomerCheckErrors, false>;
43
+ export type WebhookHandler = (event: WebhookEvent) => Promise<void>;
44
+ export declare class WebhookError extends Error {
45
+ code: "invalid_signature" | "invalid_timestamp" | "invalid_payload";
46
+ constructor(message: string, code: "invalid_signature" | "invalid_timestamp" | "invalid_payload");
47
+ }
48
+ export {};
@@ -0,0 +1,8 @@
1
+ export class WebhookError extends Error {
2
+ code;
3
+ constructor(message, code) {
4
+ super(message);
5
+ this.code = code;
6
+ this.name = "WebhookError";
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ export declare function verifyTimestamp(timestamp: string, tolerance: number): boolean;
@@ -0,0 +1,7 @@
1
+ export function verifyTimestamp(timestamp, tolerance) {
2
+ const ts = parseInt(timestamp, 10);
3
+ if (isNaN(ts))
4
+ return false;
5
+ const now = Math.floor(Date.now() / 1000);
6
+ return Math.abs(now - ts) <= tolerance;
7
+ }
@@ -1,5 +1,5 @@
1
1
  import { type Client, type Options as Options2, type TDataShape } from "./client/index.js";
2
- import type { CheckoutSessionCreateErrors, CheckoutSessionCreateResponses, CustomerCreateErrors, CustomerCreateResponses, CustomerDeleteErrors, CustomerDeleteResponses, CustomerGetErrors, CustomerGetResponses, CustomerListResponses, CustomerUpdateErrors, CustomerUpdateResponses, ProductCreateErrors, ProductCreateResponses, ProductDeleteErrors, ProductDeleteResponses, ProductGetErrors, ProductGetResponses, ProductListResponses, ProductUpdateErrors, ProductUpdateResponses } from "./types.gen.js";
2
+ import type { CheckoutSessionCreateErrors, CheckoutSessionCreateResponses, CustomerCheckErrors, CustomerCheckResponses, CustomerCreateErrors, CustomerCreateResponses, CustomerDeleteErrors, CustomerDeleteResponses, CustomerGetErrors, CustomerGetResponses, CustomerListResponses, CustomerUpdateErrors, CustomerUpdateResponses, ProductCreateErrors, ProductCreateResponses, ProductDeleteErrors, ProductDeleteResponses, ProductGetErrors, ProductGetResponses, ProductListResponses, ProductUpdateErrors, ProductUpdateResponses } from "./types.gen.js";
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -29,10 +29,9 @@ export declare class Customer extends HeyApiClient {
29
29
  /**
30
30
  * Create customer
31
31
  *
32
- * Create a new customer with a wallet address
32
+ * Create a new customer
33
33
  */
34
34
  create<ThrowOnError extends boolean = false>(parameters?: {
35
- walletAddress?: unknown;
36
35
  name?: string | null;
37
36
  email?: string | null;
38
37
  externalID?: string | null;
@@ -66,11 +65,19 @@ export declare class Customer extends HeyApiClient {
66
65
  */
67
66
  update<ThrowOnError extends boolean = false>(parameters: {
68
67
  id: string;
69
- walletAddress?: unknown;
70
68
  name?: string | null;
71
69
  email?: string | null;
72
70
  externalID?: string | null;
73
71
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CustomerUpdateResponses, CustomerUpdateErrors, ThrowOnError, "fields">;
72
+ /**
73
+ * Check customer product payment
74
+ *
75
+ * Check if a customer has paid for a specific product
76
+ */
77
+ check<ThrowOnError extends boolean = false>(parameters: {
78
+ customerID: string;
79
+ productID: string;
80
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CustomerCheckResponses, CustomerCheckErrors, ThrowOnError, "fields">;
74
81
  }
75
82
  export declare class Product extends HeyApiClient {
76
83
  /**
@@ -79,11 +86,15 @@ export declare class Product extends HeyApiClient {
79
86
  * Create a new product
80
87
  */
81
88
  create<ThrowOnError extends boolean = false>(parameters?: {
82
- walletID?: string;
83
- payoutWalletID?: string;
84
- chainID?: 1 | 8453;
85
- token?: unknown;
86
- price?: string;
89
+ id?: string;
90
+ payoutWalletAddress?: string;
91
+ chain?: string;
92
+ currency?: "USDC";
93
+ amount?: number;
94
+ supply?: number | null;
95
+ name?: string;
96
+ description?: string | null;
97
+ tokens?: Array<string> | null;
87
98
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProductCreateResponses, ProductCreateErrors, ThrowOnError, "fields">;
88
99
  /**
89
100
  * List products
@@ -113,28 +124,79 @@ export declare class Product extends HeyApiClient {
113
124
  * Update a product's price or paused status
114
125
  */
115
126
  update<ThrowOnError extends boolean = false>(parameters: {
116
- id: string;
117
- price?: string;
127
+ path_id: string;
128
+ body_id?: string;
129
+ workspaceID?: string;
130
+ timeCreated?: unknown;
131
+ timeUpdated?: unknown;
132
+ timeDeleted?: unknown | null;
133
+ payoutWalletID?: string;
134
+ assetType?: string;
135
+ pricingType?: "fixed";
136
+ pricingAmount?: string;
137
+ pricingUnit?: string | null;
138
+ supply?: number | null;
139
+ sold?: number;
118
140
  paused?: boolean;
141
+ name?: string;
142
+ description?: string | null;
143
+ tokens?: Array<string> | null;
119
144
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProductUpdateResponses, ProductUpdateErrors, ThrowOnError, "fields">;
120
145
  }
121
146
  export declare class Session extends HeyApiClient {
122
147
  /**
123
148
  * Create checkout session
124
149
  *
125
- * Generate a checkout session URL for a product and customer.
150
+ * Generate a checkout session URL for one or more products. Customer is optional - if not provided, a customer will be created from the buyer's wallet address at payment time.
126
151
  *
127
152
  * ```ts
128
153
  * const session = await client.checkout.session.create({
129
- * productID: "prd_01ABC123",
130
- * customerID: "cus_01DEF456"
154
+ * items: [
155
+ * { product: "prd_01ABC123", qty: 1 },
156
+ * { product: "prd_01DEF456", qty: 2 },
157
+ * ],
158
+ * customer: "cus_01DEF456", // optional
159
+ * theme: {
160
+ * primary: { light: "#7c3aed", dark: "#a78bfa" },
161
+ * background: { light: "#ffffff", dark: "#0b1220" },
162
+ * radius: "lg",
163
+ * }
131
164
  * });
132
165
  * console.log(session.url);
133
166
  * ```
134
167
  */
135
168
  create<ThrowOnError extends boolean = false>(parameters?: {
136
- product?: string;
137
- customer?: string;
169
+ items?: Array<{
170
+ product: string;
171
+ mode?: "required" | "optional" | "pick";
172
+ quantity?: number;
173
+ default?: boolean;
174
+ editable?: boolean;
175
+ max?: number | null;
176
+ group?: string | null;
177
+ }>;
178
+ customer?: string | null;
179
+ theme?: {
180
+ primary?: string | {
181
+ light: string;
182
+ dark: string;
183
+ };
184
+ background?: string | {
185
+ light: string;
186
+ dark: string;
187
+ };
188
+ radius?: "none" | "sm" | "md" | "lg" | "full";
189
+ font?: {
190
+ family?: string;
191
+ scale?: string;
192
+ };
193
+ logo?: string | {
194
+ light: string;
195
+ dark: string;
196
+ };
197
+ favicon?: string;
198
+ css?: string;
199
+ } | null;
138
200
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CheckoutSessionCreateResponses, CheckoutSessionCreateErrors, ThrowOnError, "fields">;
139
201
  }
140
202
  export declare class Checkout extends HeyApiClient {
@@ -25,13 +25,12 @@ export class Customer extends HeyApiClient {
25
25
  /**
26
26
  * Create customer
27
27
  *
28
- * Create a new customer with a wallet address
28
+ * Create a new customer
29
29
  */
30
30
  create(parameters, options) {
31
31
  const params = buildClientParams([parameters], [
32
32
  {
33
33
  args: [
34
- { in: "body", key: "walletAddress" },
35
34
  { in: "body", key: "name" },
36
35
  { in: "body", key: "email" },
37
36
  { in: "body", key: "externalID" },
@@ -93,7 +92,6 @@ export class Customer extends HeyApiClient {
93
92
  {
94
93
  args: [
95
94
  { in: "path", key: "id" },
96
- { in: "body", key: "walletAddress" },
97
95
  { in: "body", key: "name" },
98
96
  { in: "body", key: "email" },
99
97
  { in: "body", key: "externalID" },
@@ -111,6 +109,26 @@ export class Customer extends HeyApiClient {
111
109
  },
112
110
  });
113
111
  }
112
+ /**
113
+ * Check customer product payment
114
+ *
115
+ * Check if a customer has paid for a specific product
116
+ */
117
+ check(parameters, options) {
118
+ const params = buildClientParams([parameters], [
119
+ {
120
+ args: [
121
+ { in: "path", key: "customerID" },
122
+ { in: "path", key: "productID" },
123
+ ],
124
+ },
125
+ ]);
126
+ return (options?.client ?? this.client).get({
127
+ url: "/customer/{customerID}/products/{productID}/payment-status",
128
+ ...options,
129
+ ...params,
130
+ });
131
+ }
114
132
  }
115
133
  export class Product extends HeyApiClient {
116
134
  /**
@@ -122,11 +140,15 @@ export class Product extends HeyApiClient {
122
140
  const params = buildClientParams([parameters], [
123
141
  {
124
142
  args: [
125
- { in: "body", key: "walletID" },
126
- { in: "body", key: "payoutWalletID" },
127
- { in: "body", key: "chainID" },
128
- { in: "body", key: "token" },
129
- { in: "body", key: "price" },
143
+ { in: "body", key: "id" },
144
+ { in: "body", key: "payoutWalletAddress" },
145
+ { in: "body", key: "chain" },
146
+ { in: "body", key: "currency" },
147
+ { in: "body", key: "amount" },
148
+ { in: "body", key: "supply" },
149
+ { in: "body", key: "name" },
150
+ { in: "body", key: "description" },
151
+ { in: "body", key: "tokens" },
130
152
  ],
131
153
  },
132
154
  ]);
@@ -184,9 +206,31 @@ export class Product extends HeyApiClient {
184
206
  const params = buildClientParams([parameters], [
185
207
  {
186
208
  args: [
187
- { in: "path", key: "id" },
188
- { in: "body", key: "price" },
209
+ {
210
+ in: "path",
211
+ key: "path_id",
212
+ map: "id",
213
+ },
214
+ {
215
+ in: "body",
216
+ key: "body_id",
217
+ map: "id",
218
+ },
219
+ { in: "body", key: "workspaceID" },
220
+ { in: "body", key: "timeCreated" },
221
+ { in: "body", key: "timeUpdated" },
222
+ { in: "body", key: "timeDeleted" },
223
+ { in: "body", key: "payoutWalletID" },
224
+ { in: "body", key: "assetType" },
225
+ { in: "body", key: "pricingType" },
226
+ { in: "body", key: "pricingAmount" },
227
+ { in: "body", key: "pricingUnit" },
228
+ { in: "body", key: "supply" },
229
+ { in: "body", key: "sold" },
189
230
  { in: "body", key: "paused" },
231
+ { in: "body", key: "name" },
232
+ { in: "body", key: "description" },
233
+ { in: "body", key: "tokens" },
190
234
  ],
191
235
  },
192
236
  ]);
@@ -206,12 +250,20 @@ export class Session extends HeyApiClient {
206
250
  /**
207
251
  * Create checkout session
208
252
  *
209
- * Generate a checkout session URL for a product and customer.
253
+ * Generate a checkout session URL for one or more products. Customer is optional - if not provided, a customer will be created from the buyer's wallet address at payment time.
210
254
  *
211
255
  * ```ts
212
256
  * const session = await client.checkout.session.create({
213
- * productID: "prd_01ABC123",
214
- * customerID: "cus_01DEF456"
257
+ * items: [
258
+ * { product: "prd_01ABC123", qty: 1 },
259
+ * { product: "prd_01DEF456", qty: 2 },
260
+ * ],
261
+ * customer: "cus_01DEF456", // optional
262
+ * theme: {
263
+ * primary: { light: "#7c3aed", dark: "#a78bfa" },
264
+ * background: { light: "#ffffff", dark: "#0b1220" },
265
+ * radius: "lg",
266
+ * }
215
267
  * });
216
268
  * console.log(session.url);
217
269
  * ```
@@ -220,8 +272,9 @@ export class Session extends HeyApiClient {
220
272
  const params = buildClientParams([parameters], [
221
273
  {
222
274
  args: [
223
- { in: "body", key: "product" },
275
+ { in: "body", key: "items" },
224
276
  { in: "body", key: "customer" },
277
+ { in: "body", key: "theme" },
225
278
  ],
226
279
  },
227
280
  ]);
@@ -13,7 +13,6 @@ export type NotFoundError = {
13
13
  };
14
14
  export type CustomerCreateData = {
15
15
  body?: {
16
- walletAddress: unknown;
17
16
  name?: string | null;
18
17
  email?: string | null;
19
18
  externalID?: string | null;
@@ -39,7 +38,6 @@ export type CustomerCreateResponses = {
39
38
  timeCreated: unknown;
40
39
  timeUpdated: unknown;
41
40
  timeDeleted: unknown | null;
42
- walletAddress: unknown;
43
41
  email: string | null;
44
42
  name: string | null;
45
43
  externalID: string | null;
@@ -62,7 +60,6 @@ export type CustomerListResponses = {
62
60
  timeCreated: unknown;
63
61
  timeUpdated: unknown;
64
62
  timeDeleted: unknown | null;
65
- walletAddress: unknown;
66
63
  email: string | null;
67
64
  name: string | null;
68
65
  externalID: string | null;
@@ -124,7 +121,6 @@ export type CustomerGetResponses = {
124
121
  timeCreated: unknown;
125
122
  timeUpdated: unknown;
126
123
  timeDeleted: unknown | null;
127
- walletAddress: unknown;
128
124
  email: string | null;
129
125
  name: string | null;
130
126
  externalID: string | null;
@@ -133,7 +129,6 @@ export type CustomerGetResponses = {
133
129
  export type CustomerGetResponse = CustomerGetResponses[keyof CustomerGetResponses];
134
130
  export type CustomerUpdateData = {
135
131
  body?: {
136
- walletAddress?: unknown;
137
132
  name?: string | null;
138
133
  email?: string | null;
139
134
  externalID?: string | null;
@@ -165,20 +160,51 @@ export type CustomerUpdateResponses = {
165
160
  timeCreated: unknown;
166
161
  timeUpdated: unknown;
167
162
  timeDeleted: unknown | null;
168
- walletAddress: unknown;
169
163
  email: string | null;
170
164
  name: string | null;
171
165
  externalID: string | null;
172
166
  };
173
167
  };
174
168
  export type CustomerUpdateResponse = CustomerUpdateResponses[keyof CustomerUpdateResponses];
169
+ export type CustomerCheckData = {
170
+ body?: never;
171
+ path: {
172
+ customerID: string;
173
+ productID: string;
174
+ };
175
+ query?: never;
176
+ url: "/customer/{customerID}/products/{productID}/payment-status";
177
+ };
178
+ export type CustomerCheckErrors = {
179
+ /**
180
+ * Bad request
181
+ */
182
+ 400: BadRequestError;
183
+ };
184
+ export type CustomerCheckError = CustomerCheckErrors[keyof CustomerCheckErrors];
185
+ export type CustomerCheckResponses = {
186
+ /**
187
+ * Payment status
188
+ */
189
+ 200: {
190
+ allowed: boolean;
191
+ };
192
+ };
193
+ export type CustomerCheckResponse = CustomerCheckResponses[keyof CustomerCheckResponses];
175
194
  export type ProductCreateData = {
176
195
  body?: {
177
- walletID: string;
178
- payoutWalletID: string;
179
- chainID: 1 | 8453;
180
- token: unknown;
181
- price: string;
196
+ id?: string;
197
+ /**
198
+ * Ethereum address for payouts
199
+ */
200
+ payoutWalletAddress: string;
201
+ chain: string;
202
+ currency: "USDC";
203
+ amount: number;
204
+ supply?: number | null;
205
+ name?: string;
206
+ description?: string | null;
207
+ tokens?: Array<string> | null;
182
208
  };
183
209
  path?: never;
184
210
  query?: never;
@@ -198,17 +224,27 @@ export type ProductCreateResponses = {
198
224
  201: {
199
225
  id: string;
200
226
  workspaceID: string;
201
- timeCreated: unknown;
202
- timeUpdated: unknown;
203
- timeDeleted: unknown | null;
204
- walletID: string;
205
- payoutWalletID: string;
206
- chainID: 1 | 8453;
207
- token: unknown;
208
- price: string;
227
+ /**
228
+ * Payout Ethereum address
229
+ */
230
+ payoutWalletAddress: string;
231
+ /**
232
+ * Chain reference (e.g. 8453)
233
+ */
234
+ chain: string;
235
+ currency: "USDC";
236
+ /**
237
+ * Price amount in base units
238
+ */
239
+ amount: string;
240
+ supply: number | null;
241
+ sold: number;
209
242
  paused: boolean;
210
243
  name: string;
211
244
  description: string | null;
245
+ tokens: Array<string> | null;
246
+ timeCreated: string;
247
+ timeUpdated: string;
212
248
  };
213
249
  };
214
250
  export type ProductCreateResponse = ProductCreateResponses[keyof ProductCreateResponses];
@@ -225,17 +261,27 @@ export type ProductListResponses = {
225
261
  200: Array<{
226
262
  id: string;
227
263
  workspaceID: string;
228
- timeCreated: unknown;
229
- timeUpdated: unknown;
230
- timeDeleted: unknown | null;
231
- walletID: string;
232
- payoutWalletID: string;
233
- chainID: 1 | 8453;
234
- token: unknown;
235
- price: string;
264
+ /**
265
+ * Payout Ethereum address
266
+ */
267
+ payoutWalletAddress: string;
268
+ /**
269
+ * Chain reference (e.g. 8453)
270
+ */
271
+ chain: string;
272
+ currency: "USDC";
273
+ /**
274
+ * Price amount in base units
275
+ */
276
+ amount: string;
277
+ supply: number | null;
278
+ sold: number;
236
279
  paused: boolean;
237
280
  name: string;
238
281
  description: string | null;
282
+ tokens: Array<string> | null;
283
+ timeCreated: string;
284
+ timeUpdated: string;
239
285
  }>;
240
286
  };
241
287
  export type ProductListResponse = ProductListResponses[keyof ProductListResponses];
@@ -291,24 +337,51 @@ export type ProductGetResponses = {
291
337
  200: {
292
338
  id: string;
293
339
  workspaceID: string;
294
- timeCreated: unknown;
295
- timeUpdated: unknown;
296
- timeDeleted: unknown | null;
297
- walletID: string;
298
- payoutWalletID: string;
299
- chainID: 1 | 8453;
300
- token: unknown;
301
- price: string;
340
+ /**
341
+ * Payout Ethereum address
342
+ */
343
+ payoutWalletAddress: string;
344
+ /**
345
+ * Chain reference (e.g. 8453)
346
+ */
347
+ chain: string;
348
+ currency: "USDC";
349
+ /**
350
+ * Price amount in base units
351
+ */
352
+ amount: string;
353
+ supply: number | null;
354
+ sold: number;
302
355
  paused: boolean;
303
356
  name: string;
304
357
  description: string | null;
358
+ tokens: Array<string> | null;
359
+ timeCreated: string;
360
+ timeUpdated: string;
305
361
  };
306
362
  };
307
363
  export type ProductGetResponse = ProductGetResponses[keyof ProductGetResponses];
308
364
  export type ProductUpdateData = {
309
365
  body?: {
310
- price?: string;
366
+ id?: string;
367
+ workspaceID?: string;
368
+ timeCreated?: unknown;
369
+ timeUpdated?: unknown;
370
+ timeDeleted?: unknown | null;
371
+ payoutWalletID?: string;
372
+ /**
373
+ * CAIP-19 asset type (e.g. eip155:1/erc20:0x6b17...)
374
+ */
375
+ assetType?: string;
376
+ pricingType?: "fixed";
377
+ pricingAmount?: string;
378
+ pricingUnit?: string | null;
379
+ supply?: number | null;
380
+ sold?: number;
311
381
  paused?: boolean;
382
+ name?: string;
383
+ description?: string | null;
384
+ tokens?: Array<string> | null;
312
385
  };
313
386
  path: {
314
387
  id: string;
@@ -334,24 +407,63 @@ export type ProductUpdateResponses = {
334
407
  200: {
335
408
  id: string;
336
409
  workspaceID: string;
337
- timeCreated: unknown;
338
- timeUpdated: unknown;
339
- timeDeleted: unknown | null;
340
- walletID: string;
341
- payoutWalletID: string;
342
- chainID: 1 | 8453;
343
- token: unknown;
344
- price: string;
410
+ /**
411
+ * Payout Ethereum address
412
+ */
413
+ payoutWalletAddress: string;
414
+ /**
415
+ * Chain reference (e.g. 8453)
416
+ */
417
+ chain: string;
418
+ currency: "USDC";
419
+ /**
420
+ * Price amount in base units
421
+ */
422
+ amount: string;
423
+ supply: number | null;
424
+ sold: number;
345
425
  paused: boolean;
346
426
  name: string;
347
427
  description: string | null;
428
+ tokens: Array<string> | null;
429
+ timeCreated: string;
430
+ timeUpdated: string;
348
431
  };
349
432
  };
350
433
  export type ProductUpdateResponse = ProductUpdateResponses[keyof ProductUpdateResponses];
351
434
  export type CheckoutSessionCreateData = {
352
435
  body?: {
353
- product: string;
354
- customer: string;
436
+ items: Array<{
437
+ product: string;
438
+ mode?: "required" | "optional" | "pick";
439
+ quantity?: number;
440
+ default?: boolean;
441
+ editable?: boolean;
442
+ max?: number | null;
443
+ group?: string | null;
444
+ }>;
445
+ customer?: string | null;
446
+ theme?: {
447
+ primary?: string | {
448
+ light: string;
449
+ dark: string;
450
+ };
451
+ background?: string | {
452
+ light: string;
453
+ dark: string;
454
+ };
455
+ radius?: "none" | "sm" | "md" | "lg" | "full";
456
+ font?: {
457
+ family?: string;
458
+ scale?: string;
459
+ };
460
+ logo?: string | {
461
+ light: string;
462
+ dark: string;
463
+ };
464
+ favicon?: string;
465
+ css?: string;
466
+ } | null;
355
467
  };
356
468
  path?: never;
357
469
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackup-fi/sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "exports": {