@@ -176,212 +176,16 @@ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
176
176
``` typescript
177
177
import { Polar } from " @polar-sh/sdk" ;
178
178
179
- const polar = new Polar ();
179
+ const polar = new Polar ({
180
+ accessToken: process .env [" POLAR_ACCESS_TOKEN" ] ?? " " ,
181
+ });
180
182
181
183
async function run() {
182
- const result = await polar .endpointcheckoutCreatedPost ({
183
- type: " checkout.created" ,
184
- data: {
185
- createdAt: new Date (" 2023-02-15T15:44:21.478Z" ),
186
- modifiedAt: new Date (" 2025-09-12T19:48:15.814Z" ),
187
- id: " <value>" ,
188
- paymentProcessor: " stripe" ,
189
- status: " expired" ,
190
- clientSecret: " <value>" ,
191
- url: " https://fair-veto.com/" ,
192
- expiresAt: new Date (" 2025-03-15T14:26:53.109Z" ),
193
- successUrl: " https://junior-linseed.net/" ,
194
- embedOrigin: " <value>" ,
195
- amount: 631188 ,
196
- discountAmount: 968968 ,
197
- netAmount: 929514 ,
198
- taxAmount: 323773 ,
199
- totalAmount: 115799 ,
200
- currency: " Som" ,
201
- productId: " <value>" ,
202
- productPriceId: " <value>" ,
203
- discountId: " <value>" ,
204
- allowDiscountCodes: true ,
205
- requireBillingAddress: false ,
206
- isDiscountApplicable: true ,
207
- isFreeProductPrice: true ,
208
- isPaymentRequired: true ,
209
- isPaymentSetupRequired: true ,
210
- isPaymentFormRequired: true ,
211
- customerId: " <value>" ,
212
- isBusinessCustomer: true ,
213
- customerName: " <value>" ,
214
- customerEmail: " <value>" ,
215
- customerIpAddress: " <value>" ,
216
- customerBillingName: " <value>" ,
217
- customerBillingAddress: {
218
- country: " US" ,
219
- },
220
- customerTaxId: " <id>" ,
221
- paymentProcessorMetadata: {},
222
- billingAddressFields: {
223
- country: " required" ,
224
- state: " disabled" ,
225
- city: " required" ,
226
- postalCode: " required" ,
227
- line1: " required" ,
228
- line2: " disabled" ,
229
- },
230
- metadata: {
231
- " key" : " <value>" ,
232
- },
233
- externalCustomerId: null ,
234
- customerExternalId: " <id>" ,
235
- products: [],
236
- product: {
237
- createdAt: new Date (" 2025-03-29T00:34:40.708Z" ),
238
- modifiedAt: new Date (" 2024-04-06T18:48:21.449Z" ),
239
- id: " <value>" ,
240
- name: " <value>" ,
241
- description: " stall for mousse" ,
242
- recurringInterval: " year" ,
243
- isRecurring: false ,
244
- isArchived: true ,
245
- organizationId: " <value>" ,
246
- prices: [
247
- {
248
- createdAt: new Date (" 2023-09-13T08:36:46.434Z" ),
249
- modifiedAt: new Date (" 2023-10-05T12:55:46.428Z" ),
250
- id: " <value>" ,
251
- amountType: " free" ,
252
- isArchived: false ,
253
- productId: " <value>" ,
254
- type: " recurring" ,
255
- recurringInterval: " month" ,
256
- legacy: true ,
257
- },
258
- {
259
- createdAt: new Date (" 2024-05-02T18:25:33.974Z" ),
260
- modifiedAt: new Date (" 2025-02-06T12:55:07.640Z" ),
261
- id: " <value>" ,
262
- amountType: " fixed" ,
263
- isArchived: false ,
264
- productId: " <value>" ,
265
- type: " recurring" ,
266
- recurringInterval: " month" ,
267
- priceCurrency: " <value>" ,
268
- priceAmount: 115799 ,
269
- legacy: true ,
270
- },
271
- ],
272
- benefits: [],
273
- medias: [
274
- {
275
- id: " <value>" ,
276
- organizationId: " <value>" ,
277
- name: " <value>" ,
278
- path: " /private/tmp" ,
279
- mimeType: " <value>" ,
280
- size: 225502 ,
281
- storageVersion: " <value>" ,
282
- checksumEtag: " <value>" ,
283
- checksumSha256Base64: " <value>" ,
284
- checksumSha256Hex: " <value>" ,
285
- lastModifiedAt: new Date (" 2024-07-06T07:35:44.280Z" ),
286
- version: " <value>" ,
287
- service: " product_media" ,
288
- isUploaded: true ,
289
- createdAt: new Date (" 2024-10-08T20:45:26.653Z" ),
290
- sizeReadable: " <value>" ,
291
- publicUrl: " https://graceful-battle.info" ,
292
- },
293
- {
294
- id: " <value>" ,
295
- organizationId: " <value>" ,
296
- name: " <value>" ,
297
- path: " /private/tmp" ,
298
- mimeType: " <value>" ,
299
- size: 225502 ,
300
- storageVersion: " <value>" ,
301
- checksumEtag: " <value>" ,
302
- checksumSha256Base64: " <value>" ,
303
- checksumSha256Hex: " <value>" ,
304
- lastModifiedAt: new Date (" 2024-07-06T07:35:44.280Z" ),
305
- version: " <value>" ,
306
- service: " product_media" ,
307
- isUploaded: true ,
308
- createdAt: new Date (" 2024-10-08T20:45:26.653Z" ),
309
- sizeReadable: " <value>" ,
310
- publicUrl: " https://graceful-battle.info" ,
311
- },
312
- {
313
- id: " <value>" ,
314
- organizationId: " <value>" ,
315
- name: " <value>" ,
316
- path: " /private/tmp" ,
317
- mimeType: " <value>" ,
318
- size: 225502 ,
319
- storageVersion: " <value>" ,
320
- checksumEtag: " <value>" ,
321
- checksumSha256Base64: " <value>" ,
322
- checksumSha256Hex: " <value>" ,
323
- lastModifiedAt: new Date (" 2024-07-06T07:35:44.280Z" ),
324
- version: " <value>" ,
325
- service: " product_media" ,
326
- isUploaded: true ,
327
- createdAt: new Date (" 2024-10-08T20:45:26.653Z" ),
328
- sizeReadable: " <value>" ,
329
- publicUrl: " https://graceful-battle.info" ,
330
- },
331
- ],
332
- },
333
- productPrice: {
334
- createdAt: new Date (" 2025-09-16T11:22:24.287Z" ),
335
- modifiedAt: new Date (" 2025-11-04T08:41:40.941Z" ),
336
- id: " <value>" ,
337
- amountType: " free" ,
338
- isArchived: false ,
339
- productId: " <value>" ,
340
- type: " recurring" ,
341
- recurringInterval: " year" ,
342
- legacy: true ,
343
- },
344
- discount: {
345
- duration: " once" ,
346
- type: " fixed" ,
347
- amount: 405691 ,
348
- currency: " Dobra" ,
349
- id: " <value>" ,
350
- name: " <value>" ,
351
- code: " <value>" ,
352
- },
353
- subscriptionId: " <value>" ,
354
- attachedCustomFields: [
355
- {
356
- customFieldId: " <value>" ,
357
- customField: {
358
- createdAt: new Date (" 2025-06-07T12:37:50.969Z" ),
359
- modifiedAt: new Date (" 2023-11-20T09:37:39.033Z" ),
360
- id: " <value>" ,
361
- metadata: {
362
- " key" : true ,
363
- " key1" : " <value>" ,
364
- " key2" : " <value>" ,
365
- },
366
- type: " text" ,
367
- slug: " <value>" ,
368
- name: " <value>" ,
369
- organizationId: " 1dbfc517-0bbf-4301-9ba8-555ca42b9737" ,
370
- properties: {},
371
- },
372
- order: 168537 ,
373
- required: false ,
374
- },
375
- ],
376
- customerMetadata: {
377
- " key" : true ,
378
- " key1" : false ,
379
- " key2" : 851435 ,
380
- },
381
- },
382
- });
184
+ const result = await polar .organizations .list ({});
383
185
384
- console .log (result );
186
+ for await (const page of result ) {
187
+ console .log (page );
188
+ }
385
189
}
386
190
387
191
run ();
0 commit comments