@stackup-fi/sdk 1.0.5 → 1.0.7

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/index.js CHANGED
@@ -3,7 +3,6 @@ import { createStackupClient } from "./client.js";
3
3
  export function createStackup(options) {
4
4
  const client = createStackupClient({
5
5
  baseUrl: options.baseUrl ?? "https://api.stackup.finance",
6
- throwOnError: true,
7
6
  headers: {
8
7
  Authorization: `Bearer ${options.accessToken}`,
9
8
  },
@@ -33,6 +33,9 @@ export declare class Customer extends HeyApiClient {
33
33
  */
34
34
  create<ThrowOnError extends boolean = false>(parameters?: {
35
35
  walletAddress?: unknown;
36
+ name?: string | null;
37
+ email?: string | null;
38
+ externalID?: string | null;
36
39
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CustomerCreateResponses, CustomerCreateErrors, ThrowOnError, "fields">;
37
40
  /**
38
41
  * List customers
@@ -59,11 +62,14 @@ export declare class Customer extends HeyApiClient {
59
62
  /**
60
63
  * Update customer
61
64
  *
62
- * Update a customer's wallet address
65
+ * Update a customer
63
66
  */
64
67
  update<ThrowOnError extends boolean = false>(parameters: {
65
68
  id: string;
66
69
  walletAddress?: unknown;
70
+ name?: string | null;
71
+ email?: string | null;
72
+ externalID?: string | null;
67
73
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CustomerUpdateResponses, CustomerUpdateErrors, ThrowOnError, "fields">;
68
74
  }
69
75
  export declare class Product extends HeyApiClient {
@@ -116,10 +122,19 @@ export declare class Session extends HeyApiClient {
116
122
  /**
117
123
  * Create checkout session
118
124
  *
119
- * Generate a checkout session URL for a product by product ID
125
+ * Generate a checkout session URL for a product and customer.
126
+ *
127
+ * ```ts
128
+ * const session = await client.checkout.session.create({
129
+ * productID: "prd_01ABC123",
130
+ * customerID: "cus_01DEF456"
131
+ * });
132
+ * console.log(session.url);
133
+ * ```
120
134
  */
121
- create<ThrowOnError extends boolean = false>(parameters: {
122
- id: string;
135
+ create<ThrowOnError extends boolean = false>(parameters?: {
136
+ product?: string;
137
+ customer?: string;
123
138
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CheckoutSessionCreateResponses, CheckoutSessionCreateErrors, ThrowOnError, "fields">;
124
139
  }
125
140
  export declare class Checkout extends HeyApiClient {
@@ -28,7 +28,16 @@ export class Customer extends HeyApiClient {
28
28
  * Create a new customer with a wallet address
29
29
  */
30
30
  create(parameters, options) {
31
- const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "walletAddress" }] }]);
31
+ const params = buildClientParams([parameters], [
32
+ {
33
+ args: [
34
+ { in: "body", key: "walletAddress" },
35
+ { in: "body", key: "name" },
36
+ { in: "body", key: "email" },
37
+ { in: "body", key: "externalID" },
38
+ ],
39
+ },
40
+ ]);
32
41
  return (options?.client ?? this.client).post({
33
42
  url: "/customer/create",
34
43
  ...options,
@@ -77,7 +86,7 @@ export class Customer extends HeyApiClient {
77
86
  /**
78
87
  * Update customer
79
88
  *
80
- * Update a customer's wallet address
89
+ * Update a customer
81
90
  */
82
91
  update(parameters, options) {
83
92
  const params = buildClientParams([parameters], [
@@ -85,6 +94,9 @@ export class Customer extends HeyApiClient {
85
94
  args: [
86
95
  { in: "path", key: "id" },
87
96
  { in: "body", key: "walletAddress" },
97
+ { in: "body", key: "name" },
98
+ { in: "body", key: "email" },
99
+ { in: "body", key: "externalID" },
88
100
  ],
89
101
  },
90
102
  ]);
@@ -194,14 +206,34 @@ export class Session extends HeyApiClient {
194
206
  /**
195
207
  * Create checkout session
196
208
  *
197
- * Generate a checkout session URL for a product by product ID
209
+ * Generate a checkout session URL for a product and customer.
210
+ *
211
+ * ```ts
212
+ * const session = await client.checkout.session.create({
213
+ * productID: "prd_01ABC123",
214
+ * customerID: "cus_01DEF456"
215
+ * });
216
+ * console.log(session.url);
217
+ * ```
198
218
  */
199
219
  create(parameters, options) {
200
- const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "id" }] }]);
220
+ const params = buildClientParams([parameters], [
221
+ {
222
+ args: [
223
+ { in: "body", key: "product" },
224
+ { in: "body", key: "customer" },
225
+ ],
226
+ },
227
+ ]);
201
228
  return (options?.client ?? this.client).post({
202
- url: "/checkout/session/{id}",
229
+ url: "/checkout/session",
203
230
  ...options,
204
231
  ...params,
232
+ headers: {
233
+ "Content-Type": "application/json",
234
+ ...options?.headers,
235
+ ...params.headers,
236
+ },
205
237
  });
206
238
  }
207
239
  }
@@ -13,10 +13,10 @@ export type NotFoundError = {
13
13
  };
14
14
  export type CustomerCreateData = {
15
15
  body?: {
16
- /**
17
- * Customer's EVM-compatible wallet address
18
- */
19
16
  walletAddress: unknown;
17
+ name?: string | null;
18
+ email?: string | null;
19
+ externalID?: string | null;
20
20
  };
21
21
  path?: never;
22
22
  query?: never;
@@ -34,34 +34,15 @@ export type CustomerCreateResponses = {
34
34
  * Customer created successfully
35
35
  */
36
36
  201: {
37
- /**
38
- * Unique customer identifier
39
- */
40
37
  id: string;
41
- /**
42
- * ID of the workspace this customer belongs to
43
- */
44
38
  workspaceID: string;
45
- /**
46
- * Timestamp when the customer was created
47
- */
48
39
  timeCreated: unknown;
49
- /**
50
- * Timestamp when the customer was last updated
51
- */
52
40
  timeUpdated: unknown;
53
- /**
54
- * Timestamp when the customer was deleted, null if active
55
- */
56
41
  timeDeleted: unknown | null;
57
- /**
58
- * Customer's EVM-compatible wallet address
59
- */
60
42
  walletAddress: unknown;
61
- /**
62
- * Customer's email address
63
- */
64
43
  email: string | null;
44
+ name: string | null;
45
+ externalID: string | null;
65
46
  };
66
47
  };
67
48
  export type CustomerCreateResponse = CustomerCreateResponses[keyof CustomerCreateResponses];
@@ -76,43 +57,21 @@ export type CustomerListResponses = {
76
57
  * List of customers
77
58
  */
78
59
  200: Array<{
79
- /**
80
- * Unique customer identifier
81
- */
82
60
  id: string;
83
- /**
84
- * ID of the workspace this customer belongs to
85
- */
86
61
  workspaceID: string;
87
- /**
88
- * Timestamp when the customer was created
89
- */
90
62
  timeCreated: unknown;
91
- /**
92
- * Timestamp when the customer was last updated
93
- */
94
63
  timeUpdated: unknown;
95
- /**
96
- * Timestamp when the customer was deleted, null if active
97
- */
98
64
  timeDeleted: unknown | null;
99
- /**
100
- * Customer's EVM-compatible wallet address
101
- */
102
65
  walletAddress: unknown;
103
- /**
104
- * Customer's email address
105
- */
106
66
  email: string | null;
67
+ name: string | null;
68
+ externalID: string | null;
107
69
  }>;
108
70
  };
109
71
  export type CustomerListResponse = CustomerListResponses[keyof CustomerListResponses];
110
72
  export type CustomerDeleteData = {
111
73
  body?: never;
112
74
  path: {
113
- /**
114
- * Unique customer identifier
115
- */
116
75
  id: string;
117
76
  };
118
77
  query?: never;
@@ -139,9 +98,6 @@ export type CustomerDeleteResponse = CustomerDeleteResponses[keyof CustomerDelet
139
98
  export type CustomerGetData = {
140
99
  body?: never;
141
100
  path: {
142
- /**
143
- * Unique customer identifier
144
- */
145
101
  id: string;
146
102
  };
147
103
  query?: never;
@@ -163,48 +119,26 @@ export type CustomerGetResponses = {
163
119
  * Customer details
164
120
  */
165
121
  200: {
166
- /**
167
- * Unique customer identifier
168
- */
169
122
  id: string;
170
- /**
171
- * ID of the workspace this customer belongs to
172
- */
173
123
  workspaceID: string;
174
- /**
175
- * Timestamp when the customer was created
176
- */
177
124
  timeCreated: unknown;
178
- /**
179
- * Timestamp when the customer was last updated
180
- */
181
125
  timeUpdated: unknown;
182
- /**
183
- * Timestamp when the customer was deleted, null if active
184
- */
185
126
  timeDeleted: unknown | null;
186
- /**
187
- * Customer's EVM-compatible wallet address
188
- */
189
127
  walletAddress: unknown;
190
- /**
191
- * Customer's email address
192
- */
193
128
  email: string | null;
129
+ name: string | null;
130
+ externalID: string | null;
194
131
  };
195
132
  };
196
133
  export type CustomerGetResponse = CustomerGetResponses[keyof CustomerGetResponses];
197
134
  export type CustomerUpdateData = {
198
135
  body?: {
199
- /**
200
- * Customer's EVM-compatible wallet address
201
- */
202
136
  walletAddress?: unknown;
137
+ name?: string | null;
138
+ email?: string | null;
139
+ externalID?: string | null;
203
140
  };
204
141
  path: {
205
- /**
206
- * Unique customer identifier
207
- */
208
142
  id: string;
209
143
  };
210
144
  query?: never;
@@ -226,34 +160,15 @@ export type CustomerUpdateResponses = {
226
160
  * Customer updated successfully
227
161
  */
228
162
  200: {
229
- /**
230
- * Unique customer identifier
231
- */
232
163
  id: string;
233
- /**
234
- * ID of the workspace this customer belongs to
235
- */
236
164
  workspaceID: string;
237
- /**
238
- * Timestamp when the customer was created
239
- */
240
165
  timeCreated: unknown;
241
- /**
242
- * Timestamp when the customer was last updated
243
- */
244
166
  timeUpdated: unknown;
245
- /**
246
- * Timestamp when the customer was deleted, null if active
247
- */
248
167
  timeDeleted: unknown | null;
249
- /**
250
- * Customer's EVM-compatible wallet address
251
- */
252
168
  walletAddress: unknown;
253
- /**
254
- * Customer's email address
255
- */
256
169
  email: string | null;
170
+ name: string | null;
171
+ externalID: string | null;
257
172
  };
258
173
  };
259
174
  export type CustomerUpdateResponse = CustomerUpdateResponses[keyof CustomerUpdateResponses];
@@ -434,12 +349,13 @@ export type ProductUpdateResponses = {
434
349
  };
435
350
  export type ProductUpdateResponse = ProductUpdateResponses[keyof ProductUpdateResponses];
436
351
  export type CheckoutSessionCreateData = {
437
- body?: never;
438
- path: {
439
- id: string;
352
+ body?: {
353
+ product: string;
354
+ customer: string;
440
355
  };
356
+ path?: never;
441
357
  query?: never;
442
- url: "/checkout/session/{id}";
358
+ url: "/checkout/session";
443
359
  };
444
360
  export type CheckoutSessionCreateErrors = {
445
361
  /**
@@ -457,6 +373,7 @@ export type CheckoutSessionCreateResponses = {
457
373
  * Checkout session created successfully
458
374
  */
459
375
  200: {
376
+ id: string;
460
377
  url: string;
461
378
  };
462
379
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackup-fi/sdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "exports": {
@@ -10,8 +10,8 @@
10
10
  }
11
11
  },
12
12
  "scripts": {
13
- "generate": "sst shell -- bun script/build.ts",
14
- "publish": "bun script/publish.ts"
13
+ "build": "sst shell -- bun script/build.ts",
14
+ "release": "bun script/publish.ts"
15
15
  },
16
16
  "files": [
17
17
  "dist"