-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodeSamples.yaml
695 lines (695 loc) · 230 KB
/
codeSamples.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
overlay: 1.0.0
info:
title: CodeSamples overlay for go target
version: 0.0.0
actions:
- target: $["paths"]["/v1/advertisements/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Advertisements.List(ctx, \"<value>\", nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.AdvertisementCampaignListResource != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/advertisements/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Advertisements.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.AdvertisementCampaign != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/benefits/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.List(ctx, nil, nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceBenefit != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/benefits/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Create(ctx, components.CreateBenefitCreateBenefitDownloadablesCreate(\n components.BenefitDownloadablesCreate{\n Description: \"yuck forager beneath please shadowy foodstuffs welcome\",\n Properties: components.BenefitDownloadablesCreateProperties{\n Files: []string{\n \"<value>\",\n },\n },\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Benefit != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/benefits/{id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Delete(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/benefits/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Benefit != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/benefits/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Update(ctx, \"<value>\", operations.CreateBenefitsUpdateBenefitUpdateBenefitGitHubRepositoryUpdate(\n components.BenefitGitHubRepositoryUpdate{\n Properties: &components.BenefitGitHubRepositoryCreateProperties{\n RepositoryOwner: \"polarsource\",\n RepositoryName: \"private_repo\",\n Permission: components.BenefitGitHubRepositoryCreatePropertiesPermissionTriage,\n },\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Benefit != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/benefits/{id}/grants"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Grants(ctx, operations.BenefitsGrantsRequest{\n ID: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceBenefitGrant != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/checkout-links/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.List(ctx, operations.CheckoutLinksListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCheckoutLink != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/checkout-links/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.Create(ctx, components.CreateCheckoutLinkCreateCheckoutLinkPriceCreate(\n components.CheckoutLinkPriceCreate{\n ProductPriceID: \"<value>\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutLink != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkout-links/{id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.Delete(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkout-links/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutLink != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkout-links/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.Update(ctx, \"<value>\", components.CheckoutLinkUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutLink != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkouts/custom/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Custom.List(ctx, operations.CheckoutsCustomListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCheckout != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/checkouts/custom/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Custom.Create(ctx, components.CreateCheckoutCreateCheckoutProductCreate(\n components.CheckoutProductCreate{\n ProductID: \"<value>\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Checkout != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkouts/custom/client/{client_secret}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Custom.ClientGet(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutPublic != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkouts/custom/client/{client_secret}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Custom.ClientUpdate(ctx, \"<value>\", components.CheckoutUpdatePublic{})\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutPublic != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkouts/custom/client/{client_secret}/confirm"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Custom.ClientConfirm(ctx, \"<value>\", components.CheckoutConfirmStripe{})\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutPublicConfirmed != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkouts/custom/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Custom.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Checkout != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/checkouts/custom/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Custom.Update(ctx, \"<value>\", components.CheckoutUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Checkout != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/custom-fields/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.List(ctx, operations.CustomFieldsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomField != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/custom-fields/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.Create(ctx, components.CreateCustomFieldCreateCustomFieldCreateSelect(\n components.CustomFieldCreateSelect{\n Slug: \"<value>\",\n Name: \"<value>\",\n Properties: components.CustomFieldSelectProperties{\n Options: []components.CustomFieldSelectOption{\n components.CustomFieldSelectOption{\n Value: \"<value>\",\n Label: \"<value>\",\n },\n },\n },\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomField != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/custom-fields/{id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.Delete(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/custom-fields/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomField != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/custom-fields/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.Update(ctx, \"<value>\", components.CreateCustomFieldUpdateCustomFieldUpdateNumber(\n components.CustomFieldUpdateNumber{},\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomField != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/benefit-grants/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.BenefitGrants.List(ctx, operations.CustomerPortalBenefitGrantsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerBenefitGrant != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/customer-portal/benefit-grants/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.BenefitGrants.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerBenefitGrant != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/benefit-grants/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.BenefitGrants.Update(ctx, \"<value>\", components.CreateCustomerBenefitGrantUpdateCustomerBenefitGrantDownloadablesUpdate(\n components.CustomerBenefitGrantDownloadablesUpdate{},\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerBenefitGrant != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/customers/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Customers.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPortalCustomer != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/downloadables/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Downloadables.List(ctx, nil, nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceDownloadableRead != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/customer-portal/downloadables/{token}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Downloadables.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/license-keys/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.LicenseKeys.List(ctx, nil, nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceLicenseKeyRead != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/customer-portal/license-keys/activate"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.LicenseKeys.Activate(ctx, components.LicenseKeyActivate{\n Key: \"<key>\",\n OrganizationID: \"<value>\",\n Label: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyActivationRead != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/license-keys/deactivate"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.LicenseKeys.Deactivate(ctx, components.LicenseKeyDeactivate{\n Key: \"<key>\",\n OrganizationID: \"<value>\",\n ActivationID: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/license-keys/validate"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.LicenseKeys.Validate(ctx, components.LicenseKeyValidate{\n Key: \"<key>\",\n OrganizationID: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ValidatedLicenseKey != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/license-keys/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.LicenseKeys.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyWithActivations != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/orders/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Orders.List(ctx, operations.CustomerPortalOrdersListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerOrder != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/customer-portal/orders/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Orders.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerOrder != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/orders/{id}/invoice"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Orders.Invoice(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerOrderInvoice != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/organizations/{slug}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Organizations.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Organization != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/subscriptions/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Subscriptions.List(ctx, operations.CustomerPortalSubscriptionsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerSubscription != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/customer-portal/subscriptions/{id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Subscriptions.Cancel(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSubscription != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/subscriptions/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Subscriptions.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSubscription != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/subscriptions/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Subscriptions.Update(ctx, \"<value>\", components.CreateCustomerSubscriptionUpdateCustomerSubscriptionCancel(\n components.CustomerSubscriptionCancel{},\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSubscription != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-sessions/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerSessions.Create(ctx, components.CustomerSessionCreate{\n CustomerID: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSession != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customers/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.List(ctx, operations.CustomersListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomer != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/customers/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Create(ctx, components.CustomerCreate{\n Email: \"[email protected]\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Customer != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customers/{id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Delete(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customers/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Customer != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customers/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Update(ctx, \"<value>\", components.CustomerUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Customer != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/discounts/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.List(ctx, operations.DiscountsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceDiscount != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/discounts/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.Create(ctx, components.CreateDiscountCreateDiscountFixedRepeatDurationCreate(\n components.DiscountFixedRepeatDurationCreate{\n Duration: components.DiscountDurationForever,\n DurationInMonths: 417458,\n Type: components.DiscountTypeFixed,\n Amount: 69025,\n Name: \"<value>\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Discount != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/discounts/{id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.Delete(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/discounts/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Discount != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/discounts/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.Update(ctx, \"<value>\", components.DiscountUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Discount != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/external_organizations/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.ExternalOrganizations.List(ctx, operations.ExternalOrganizationsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceExternalOrganization != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/files/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.List(ctx, nil, nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceFileRead != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/files/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.Create(ctx, components.CreateFileCreateProductMediaFileCreate(\n components.ProductMediaFileCreate{\n Name: \"<value>\",\n MimeType: \"<value>\",\n Size: 951062,\n Upload: components.S3FileCreateMultipart{\n Parts: []components.S3FileCreatePart{\n components.S3FileCreatePart{\n Number: 86,\n ChunkStart: 169727,\n ChunkEnd: 89964,\n },\n },\n },\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.FileUpload != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/files/{id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.Delete(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/files/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.Update(ctx, \"<value>\", components.FilePatch{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseFilesUpdate != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/files/{id}/uploaded"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.Uploaded(ctx, \"<value>\", components.FileUploadCompleted{\n ID: \"<id>\",\n Path: \"/sys\",\n Parts: []components.S3FileUploadCompletedPart{\n components.S3FileUploadCompletedPart{\n Number: 173116,\n ChecksumEtag: \"<value>\",\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n },\n components.S3FileUploadCompletedPart{\n Number: 894030,\n ChecksumEtag: \"<value>\",\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n },\n components.S3FileUploadCompletedPart{\n Number: 673715,\n ChecksumEtag: \"<value>\",\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseFilesUploaded != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/license-keys"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.List(ctx, nil, nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceLicenseKeyRead != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/license-keys/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyWithActivations != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/license-keys/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.Update(ctx, \"<value>\", components.LicenseKeyUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyRead != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/license-keys/{id}/activations/{activation_id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.GetActivation(ctx, \"<value>\", \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyActivationRead != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/metrics/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Metrics.Get(ctx, operations.MetricsGetRequest{\n StartDate: types.MustDateFromString(\"2025-02-06\"),\n EndDate: types.MustDateFromString(\"2024-09-04\"),\n Interval: components.IntervalWeek,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.MetricsResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/metrics/limits"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Metrics.Limits(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.MetricsLimits != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.List(ctx, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceOAuth2Client != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/oauth2/authorize"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Authorize(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseOauth2Authorize != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/introspect"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Introspect(ctx, operations.Oauth2IntrospectTokenIntrospectTokenRequest{\n Token: \"<value>\",\n ClientID: \"<id>\",\n ClientSecret: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.IntrospectTokenResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/register"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.Create(ctx, components.OAuth2ClientConfiguration{\n RedirectUris: []string{\n \"https://inferior-chainstay.com\",\n },\n ClientName: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/register/{client_id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.Delete(ctx, \"<id>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/register/{client_id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.Get(ctx, \"<id>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/register/{client_id}"]["put"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.Update(ctx, \"<id>\", components.OAuth2ClientConfigurationUpdate{\n RedirectUris: []string{\n \"https://grown-worth.name\",\n \"https://worthwhile-avalanche.org/\",\n \"https://general-digit.com/\",\n },\n ClientName: \"<value>\",\n ClientID: \"<id>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/revoke"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Revoke(ctx, operations.Oauth2RevokeTokenRevokeTokenRequest{\n Token: \"<value>\",\n ClientID: \"<id>\",\n ClientSecret: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.RevokeTokenResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/token"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Token(ctx, operations.CreateOauth2RequestTokenRequestBodyOnev11oauth21tokenPostXComponentsAuthorizationCodeTokenRequest(\n components.Onev11oauth21tokenPostXComponentsAuthorizationCodeTokenRequest{\n ClientID: \"<id>\",\n ClientSecret: \"<value>\",\n Code: \"<value>\",\n RedirectURI: \"https://talkative-barracks.com\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.TokenResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/oauth2/userinfo"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Userinfo(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseOauth2Userinfo != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/orders/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.List(ctx, operations.OrdersListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceOrder != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/orders/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Order != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/orders/{id}/invoice"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.Invoice(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.OrderInvoice != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/organizations/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Organizations.List(ctx, nil, nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceOrganization != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/organizations/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Organizations.Create(ctx, components.OrganizationCreate{\n Name: \"<value>\",\n Slug: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Organization != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/organizations/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Organizations.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Organization != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/organizations/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Organizations.Update(ctx, \"<value>\", components.OrganizationUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Organization != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/products/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.List(ctx, operations.ProductsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceProduct != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/products/"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.Create(ctx, components.CreateProductCreateProductRecurringCreate(\n components.ProductRecurringCreate{\n Name: \"<value>\",\n Prices: components.CreateProductRecurringCreatePricesArrayOfProductPriceRecurringFixedCreate(\n []components.ProductPriceRecurringFixedCreate{\n components.ProductPriceRecurringFixedCreate{\n PriceAmount: 796474,\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n },\n ),\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Product != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/products/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Product != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/products/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.Update(ctx, \"<value>\", components.ProductUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Product != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/products/{id}/benefits"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.UpdateBenefits(ctx, \"<value>\", components.ProductBenefitsUpdate{\n Benefits: []string{\n \"<value>\",\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Product != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/repositories/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Repositories.List(ctx, operations.RepositoriesListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceRepository != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/repositories/{id}"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Repositories.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Repository != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/repositories/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Repositories.Update(ctx, \"<value>\", components.RepositoryUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Repository != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/subscriptions/"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.List(ctx, operations.SubscriptionsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceSubscription != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}"
- target: $["paths"]["/v1/subscriptions/export"]["get"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.Export(ctx, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/subscriptions/{id}"]["delete"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.Revoke(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Subscription != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/subscriptions/{id}"]["patch"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.Update(ctx, \"<value>\", components.CreateSubscriptionUpdateSubscriptionCancel(\n components.SubscriptionCancel{},\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Subscription != nil {\n // handle response\n }\n}"
- target: $["paths"]["benefit.created"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointbenefitCreatedPost(ctx, components.WebhookBenefitCreatedPayload{\n Data: components.CreateBenefitBenefitDiscord(\n components.BenefitDiscord{\n CreatedAt: types.MustTimeFromString(\"2023-04-06T19:25:41.598Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-09-11T07:25:54.518Z\"),\n ID: \"<value>\",\n Description: \"log uproot pointless pfft solace besides\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDiscordProperties{\n GuildID: \"<id>\",\n RoleID: \"<id>\",\n GuildToken: \"<value>\",\n },\n },\n ),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["benefit.updated"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointbenefitUpdatedPost(ctx, components.WebhookBenefitUpdatedPayload{\n Data: components.CreateBenefitBenefitLicenseKeys(\n components.BenefitLicenseKeys{\n CreatedAt: types.MustTimeFromString(\"2023-04-01T23:52:01.692Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-27T14:40:26.364Z\"),\n ID: \"<value>\",\n Description: \"until overconfidently masquerade once\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitLicenseKeysProperties{\n Prefix: polargo.String(\"<value>\"),\n Expires: &components.BenefitLicenseKeyExpirationProperties{\n TTL: 424968,\n Timeframe: components.TimeframeYear,\n },\n Activations: &components.BenefitLicenseKeyActivationProperties{\n Limit: 735229,\n EnableCustomerAdmin: false,\n },\n LimitUsage: polargo.Int64(923317),\n },\n },\n ),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["benefit_grant.created"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointbenefitGrantCreatedPost(ctx, components.WebhookBenefitGrantCreatedPayload{\n Data: components.BenefitGrantWebhook{\n CreatedAt: types.MustTimeFromString(\"2025-01-04T13:03:27.870Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-05-08T00:47:14.556Z\"),\n ID: \"<value>\",\n IsGranted: true,\n IsRevoked: false,\n SubscriptionID: polargo.String(\"<value>\"),\n OrderID: polargo.String(\"<value>\"),\n CustomerID: \"<value>\",\n UserID: \"<value>\",\n BenefitID: \"<value>\",\n Customer: components.Customer{\n CreatedAt: types.MustTimeFromString(\"2025-08-25T12:22:42.430Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-03-03T22:39:55.256Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomerMetadata1{\n\n },\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"El Salvador\",\n },\n TaxID: []components.CustomerTaxID{\n components.CreateCustomerTaxIDStr(\n \"<value>\",\n ),\n components.CreateCustomerTaxIDStr(\n \"ae_trn\",\n ),\n components.CreateCustomerTaxIDStr(\n \"is_vat\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://frightened-secrecy.biz\",\n },\n Properties: components.CreateBenefitGrantWebhookPropertiesBenefitGrantDiscordProperties(\n components.BenefitGrantDiscordProperties{},\n ),\n Benefit: components.CreateBenefitBenefitLicenseKeys(\n components.BenefitLicenseKeys{\n CreatedAt: types.MustTimeFromString(\"2023-11-17T13:58:04.744Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-28T12:08:54.434Z\"),\n ID: \"<value>\",\n Description: \"svelte oh yuck rebel mountain likewise since\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitLicenseKeysProperties{\n Prefix: polargo.String(\"<value>\"),\n Expires: &components.BenefitLicenseKeyExpirationProperties{\n TTL: 477461,\n Timeframe: components.TimeframeYear,\n },\n Activations: &components.BenefitLicenseKeyActivationProperties{\n Limit: 680981,\n EnableCustomerAdmin: false,\n },\n LimitUsage: polargo.Int64(301013),\n },\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["benefit_grant.revoked"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointbenefitGrantRevokedPost(ctx, components.WebhookBenefitGrantRevokedPayload{\n Data: components.BenefitGrantWebhook{\n CreatedAt: types.MustTimeFromString(\"2025-03-12T10:35:36.881Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-12T13:10:16.426Z\"),\n ID: \"<value>\",\n IsGranted: true,\n IsRevoked: false,\n SubscriptionID: polargo.String(\"<value>\"),\n OrderID: polargo.String(\"<value>\"),\n CustomerID: \"<value>\",\n UserID: \"<value>\",\n BenefitID: \"<value>\",\n Customer: components.Customer{\n CreatedAt: types.MustTimeFromString(\"2025-03-29T21:56:48.008Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-07-18T16:16:40.562Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomerMetadata1{\n\n },\n Email: \"[email protected]\",\n EmailVerified: true,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Poland\",\n },\n TaxID: []components.CustomerTaxID{\n components.CreateCustomerTaxIDStr(\n \"<value>\",\n ),\n components.CreateCustomerTaxIDStr(\n \"<value>\",\n ),\n components.CreateCustomerTaxIDStr(\n \"au_arn\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://bouncy-granny.net\",\n },\n Properties: components.CreateBenefitGrantWebhookPropertiesBenefitGrantAdsProperties(\n components.BenefitGrantAdsProperties{\n AdvertisementCampaignID: \"<id>\",\n },\n ),\n Benefit: components.CreateBenefitBenefitLicenseKeys(\n components.BenefitLicenseKeys{\n CreatedAt: types.MustTimeFromString(\"2025-01-24T10:59:47.946Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-10-10T13:39:07.288Z\"),\n ID: \"<value>\",\n Description: \"brr obsess unbearably\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitLicenseKeysProperties{\n Prefix: polargo.String(\"<value>\"),\n Expires: &components.BenefitLicenseKeyExpirationProperties{\n TTL: 339630,\n Timeframe: components.TimeframeDay,\n },\n Activations: &components.BenefitLicenseKeyActivationProperties{\n Limit: 343928,\n EnableCustomerAdmin: false,\n },\n LimitUsage: polargo.Int64(429815),\n },\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["benefit_grant.updated"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointbenefitGrantUpdatedPost(ctx, components.WebhookBenefitGrantUpdatedPayload{\n Data: components.BenefitGrantWebhook{\n CreatedAt: types.MustTimeFromString(\"2025-01-02T13:54:42.243Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-25T11:58:59.486Z\"),\n ID: \"<value>\",\n IsGranted: false,\n IsRevoked: false,\n SubscriptionID: polargo.String(\"<value>\"),\n OrderID: polargo.String(\"<value>\"),\n CustomerID: \"<value>\",\n UserID: \"<value>\",\n BenefitID: \"<value>\",\n Customer: components.Customer{\n CreatedAt: types.MustTimeFromString(\"2025-08-08T07:44:28.757Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-08-31T04:19:19.970Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomerMetadata1{\n \"key\": components.CreateCustomerMetadata1Str(\n \"<value>\",\n ),\n \"key1\": components.CreateCustomerMetadata1Integer(\n 549371,\n ),\n \"key2\": components.CreateCustomerMetadata1Integer(\n 502350,\n ),\n },\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Israel\",\n },\n TaxID: []components.CustomerTaxID{\n components.CreateCustomerTaxIDStr(\n \"<value>\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://teeming-formamide.com/\",\n },\n Properties: components.CreateBenefitGrantWebhookPropertiesBenefitGrantLicenseKeysProperties(\n components.BenefitGrantLicenseKeysProperties{},\n ),\n Benefit: components.CreateBenefitBenefitAds(\n components.BenefitAds{\n CreatedAt: types.MustTimeFromString(\"2023-12-17T22:29:17.144Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-05-01T18:11:33.063Z\"),\n ID: \"<value>\",\n Description: \"watery lest whether that stealthily ack woot provided\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitAdsProperties{},\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["checkout.created"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointcheckoutCreatedPost(ctx, components.WebhookCheckoutCreatedPayload{\n Data: components.Checkout{\n CreatedAt: types.MustTimeFromString(\"2025-11-12T14:26:42.882Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-05-27T05:08:06.235Z\"),\n ID: \"<value>\",\n PaymentProcessor: components.PaymentProcessorStripe,\n Status: components.CheckoutStatusFailed,\n ClientSecret: \"<value>\",\n URL: \"https://heavy-beret.com/\",\n ExpiresAt: types.MustTimeFromString(\"2023-02-25T02:26:48.460Z\"),\n SuccessURL: \"https://sardonic-final.info/\",\n EmbedOrigin: polargo.String(\"<value>\"),\n Amount: polargo.Int64(962818),\n TaxAmount: polargo.Int64(6400),\n Currency: polargo.String(\"Yen\"),\n SubtotalAmount: polargo.Int64(648726),\n TotalAmount: polargo.Int64(210702),\n ProductID: \"<value>\",\n ProductPriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n AllowDiscountCodes: true,\n IsDiscountApplicable: false,\n IsFreeProductPrice: false,\n IsPaymentRequired: false,\n IsPaymentSetupRequired: false,\n IsPaymentFormRequired: false,\n CustomerID: polargo.String(\"<value>\"),\n CustomerName: polargo.String(\"<value>\"),\n CustomerEmail: polargo.String(\"[email protected]\"),\n CustomerIPAddress: polargo.String(\"<value>\"),\n CustomerBillingAddress: &components.Address{\n Country: \"South Africa\",\n },\n CustomerTaxID: polargo.String(\"<id>\"),\n PaymentProcessorMetadata: components.PaymentProcessorMetadata{},\n Metadata: map[string]components.CheckoutMetadata{\n \"key\": components.CreateCheckoutMetadataInteger(\n 18677,\n ),\n \"key1\": components.CreateCheckoutMetadataInteger(\n 95370,\n ),\n },\n Product: components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2023-04-02T00:05:42.586Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-15T03:02:38.803Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"for embarrassment untidy long-term near honestly separate yet\"),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFree(\n components.ProductPriceRecurringFree{\n CreatedAt: types.MustTimeFromString(\"2025-01-27T19:10:37.564Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-07-01T11:31:44.349Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n ),\n },\n Benefits: []components.BenefitBase{\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-08-21T00:47:02.059Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-06-03T10:32:44.101Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeLicenseKeys,\n Description: \"within jacket unless\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n },\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/private/var\",\n MimeType: \"<value>\",\n Size: 245189,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2023-11-03T15:00:03.276Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2025-06-07T13:47:02.365Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://webbed-experience.name/\",\n },\n },\n },\n ProductPrice: components.CreateProductPriceProductPriceOneTime(\n components.CreateProductPriceOneTimeProductPriceOneTimeFixed(\n components.ProductPriceOneTimeFixed{\n CreatedAt: types.MustTimeFromString(\"2023-04-02T00:05:42.586Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-15T03:02:38.803Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 740296,\n },\n ),\n ),\n Discount: components.CreateCheckoutDiscountCheckoutDiscountPercentageOnceForeverDuration(\n components.CheckoutDiscountPercentageOnceForeverDuration{\n Duration: components.DiscountDurationRepeating,\n Type: components.DiscountTypeFixed,\n BasisPoints: 341163,\n ID: \"<value>\",\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n },\n ),\n SubscriptionID: polargo.String(\"<value>\"),\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldNumber(\n components.CustomFieldNumber{\n CreatedAt: types.MustTimeFromString(\"2025-06-23T16:57:50.081Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-13T18:25:33.693Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldNumberMetadata{\n \"key\": components.CreateCustomFieldNumberMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldNumberProperties{},\n },\n ),\n Order: 996863,\n Required: false,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2023-04-26T22:34:57.487Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-08-07T19:57:51.694Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataInteger(\n 856200,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldSelectProperties{\n Options: []components.CustomFieldSelectOption{\n components.CustomFieldSelectOption{\n Value: \"<value>\",\n Label: \"<value>\",\n },\n },\n },\n },\n ),\n Order: 72589,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldCheckbox(\n components.CustomFieldCheckbox{\n CreatedAt: types.MustTimeFromString(\"2025-05-25T15:20:50.694Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-27T14:29:40.329Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldCheckboxMetadata{\n \"key\": components.CreateCustomFieldCheckboxMetadataBoolean(\n false,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldCheckboxProperties{},\n },\n ),\n Order: 161325,\n Required: true,\n },\n },\n CustomerMetadata: map[string]components.CustomerMetadata{\n \"key\": components.CreateCustomerMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateCustomerMetadataStr(\n \"<value>\",\n ),\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["checkout.updated"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointcheckoutUpdatedPost(ctx, components.WebhookCheckoutUpdatedPayload{\n Data: components.Checkout{\n CreatedAt: types.MustTimeFromString(\"2025-10-04T13:06:10.658Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-10-02T21:25:15.366Z\"),\n ID: \"<value>\",\n PaymentProcessor: components.PaymentProcessorStripe,\n Status: components.CheckoutStatusFailed,\n ClientSecret: \"<value>\",\n URL: \"https://square-cafe.biz/\",\n ExpiresAt: types.MustTimeFromString(\"2025-03-25T08:55:11.873Z\"),\n SuccessURL: \"https://physical-import.name/\",\n EmbedOrigin: polargo.String(\"<value>\"),\n Amount: polargo.Int64(245418),\n TaxAmount: polargo.Int64(624213),\n Currency: polargo.String(\"Naira\"),\n SubtotalAmount: polargo.Int64(24587),\n TotalAmount: polargo.Int64(447013),\n ProductID: \"<value>\",\n ProductPriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n AllowDiscountCodes: true,\n IsDiscountApplicable: true,\n IsFreeProductPrice: true,\n IsPaymentRequired: false,\n IsPaymentSetupRequired: false,\n IsPaymentFormRequired: true,\n CustomerID: polargo.String(\"<value>\"),\n CustomerName: polargo.String(\"<value>\"),\n CustomerEmail: polargo.String(\"[email protected]\"),\n CustomerIPAddress: polargo.String(\"<value>\"),\n CustomerBillingAddress: &components.Address{\n Country: \"Greenland\",\n },\n CustomerTaxID: polargo.String(\"<id>\"),\n PaymentProcessorMetadata: components.PaymentProcessorMetadata{},\n Metadata: map[string]components.CheckoutMetadata{\n\n },\n Product: components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2025-01-24T14:28:29.444Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-09-21T12:18:51.327Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"engender reopen yahoo draft\"),\n IsRecurring: false,\n IsArchived: true,\n OrganizationID: \"<value>\",\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2025-08-02T14:33:19.677Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-17T10:36:50.593Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 226088,\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n },\n Benefits: []components.BenefitBase{\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2025-04-09T09:30:36.910Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-10-16T19:52:50.377Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeGithubRepository,\n Description: \"posh hm meatloaf politely ugh fidget to inborn putrid\",\n Selectable: false,\n Deletable: true,\n OrganizationID: \"<value>\",\n },\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-12-30T03:17:46.406Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-11-12T16:32:46.306Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeLicenseKeys,\n Description: \"blah likewise whose notwithstanding airline aboard frightened enfold colorfully\",\n Selectable: true,\n Deletable: true,\n OrganizationID: \"<value>\",\n },\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/home/user\",\n MimeType: \"<value>\",\n Size: 767806,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2024-01-15T18:22:33.094Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-02-14T06:20:54.950Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://pushy-tomatillo.org/\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/private\",\n MimeType: \"<value>\",\n Size: 432333,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2024-03-07T18:51:14.729Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2023-11-18T09:33:10.032Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://affectionate-charm.net\",\n },\n },\n },\n ProductPrice: components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2025-04-04T09:36:58.685Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-03-12T12:25:44.387Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 396660,\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n Discount: components.CreateCheckoutDiscountCheckoutDiscountFixedOnceForeverDuration(\n components.CheckoutDiscountFixedOnceForeverDuration{\n Duration: components.DiscountDurationOnce,\n Type: components.DiscountTypePercentage,\n Amount: 883154,\n Currency: \"East Caribbean Dollar\",\n ID: \"<value>\",\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n },\n ),\n SubscriptionID: polargo.String(\"<value>\"),\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldDate(\n components.CustomFieldDate{\n CreatedAt: types.MustTimeFromString(\"2023-07-11T15:52:54.020Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-24T14:28:29.444Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldDateMetadata{\n \"key\": components.CreateCustomFieldDateMetadataBoolean(\n false,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldDateProperties{},\n },\n ),\n Order: 108303,\n Required: false,\n },\n },\n CustomerMetadata: map[string]components.CustomerMetadata{\n \"key\": components.CreateCustomerMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateCustomerMetadataBoolean(\n true,\n ),\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["order.created"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointorderCreatedPost(ctx, components.WebhookOrderCreatedPayload{\n Data: components.Order{\n CreatedAt: types.MustTimeFromString(\"2024-11-11T12:46:15.007Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-03-23T03:54:38.261Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.OrderMetadata{\n \"key\": components.CreateOrderMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateOrderMetadataStr(\n \"<value>\",\n ),\n },\n Amount: 485666,\n TaxAmount: 81588,\n Currency: \"Metical\",\n BillingReason: components.OrderBillingReasonSubscriptionCycle,\n BillingAddress: &components.Address{\n Country: \"Hungary\",\n },\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n ProductPriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n SubscriptionID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n Customer: components.OrderCustomer{\n CreatedAt: types.MustTimeFromString(\"2023-09-09T08:07:10.665Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-08-18T18:18:41.438Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.OrderCustomerMetadata{\n \"key\": components.CreateOrderCustomerMetadataInteger(\n 24128,\n ),\n \"key1\": components.CreateOrderCustomerMetadataStr(\n \"<value>\",\n ),\n \"key2\": components.CreateOrderCustomerMetadataStr(\n \"<value>\",\n ),\n },\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Reunion\",\n },\n TaxID: []components.OrderCustomerTaxID{\n components.CreateOrderCustomerTaxIDStr(\n \"<value>\",\n ),\n components.CreateOrderCustomerTaxIDStr(\n \"my_sst\",\n ),\n components.CreateOrderCustomerTaxIDStr(\n \"br_cpf\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://darling-kit.org\",\n },\n UserID: \"<value>\",\n User: components.OrderUser{\n ID: \"<value>\",\n Email: \"[email protected]\",\n PublicName: \"<value>\",\n },\n Product: components.OrderProduct{\n CreatedAt: types.MustTimeFromString(\"2025-12-27T14:05:37.748Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-01T22:00:53.940Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"circle colorize given\"),\n IsRecurring: true,\n IsArchived: true,\n OrganizationID: \"<value>\",\n },\n ProductPrice: components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2025-08-11T14:36:04.800Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-12-17T11:20:04.235Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 656121,\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n Discount: components.CreateOrderDiscountDiscountPercentageRepeatDurationBase(\n components.DiscountPercentageRepeatDurationBase{\n Duration: components.DiscountDurationForever,\n DurationInMonths: 694649,\n Type: components.DiscountTypePercentage,\n BasisPoints: 683727,\n CreatedAt: types.MustTimeFromString(\"2023-05-22T16:28:34.624Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-08-31T17:55:50.952Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountPercentageRepeatDurationBaseMetadata{\n \"key\": components.CreateDiscountPercentageRepeatDurationBaseMetadataStr(\n \"<value>\",\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2024-07-01T07:12:57.258Z\"),\n EndsAt: types.MustNewTimeFromString(\"2025-10-22T16:43:41.873Z\"),\n MaxRedemptions: polargo.Int64(738266),\n RedemptionsCount: 249608,\n OrganizationID: \"<value>\",\n },\n ),\n Subscription: &components.OrderSubscription{\n Metadata: map[string]components.OrderSubscriptionMetadata{\n \"key\": components.CreateOrderSubscriptionMetadataInteger(\n 838937,\n ),\n \"key1\": components.CreateOrderSubscriptionMetadataBoolean(\n true,\n ),\n },\n CreatedAt: types.MustTimeFromString(\"2025-05-09T06:10:47.548Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-02-13T18:51:37.875Z\"),\n ID: \"<value>\",\n Amount: polargo.Int64(420337),\n Currency: polargo.String(\"New Zealand Dollar\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n Status: components.SubscriptionStatusIncomplete,\n CurrentPeriodStart: types.MustTimeFromString(\"2025-12-01T13:27:57.927Z\"),\n CurrentPeriodEnd: types.MustNewTimeFromString(\"2023-06-23T18:54:19.334Z\"),\n CancelAtPeriodEnd: false,\n CanceledAt: types.MustNewTimeFromString(\"2024-11-15T11:53:36.436Z\"),\n StartedAt: types.MustNewTimeFromString(\"2025-11-18T03:47:21.756Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-02-02T12:07:22.717Z\"),\n EndedAt: types.MustNewTimeFromString(\"2023-02-15T16:05:22.828Z\"),\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n PriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n CustomerCancellationReason: components.CustomerCancellationReasonSwitchedService.ToPointer(),\n CustomerCancellationComment: polargo.String(\"<value>\"),\n UserID: \"<value>\",\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["organization.updated"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointorganizationUpdatedPost(ctx, components.WebhookOrganizationUpdatedPayload{\n Data: components.Organization{\n CreatedAt: types.MustTimeFromString(\"2023-08-12T18:45:04.236Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-29T16:35:25.119Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Slug: \"<value>\",\n AvatarURL: polargo.String(\"https://devoted-bump.net\"),\n Bio: polargo.String(\"<value>\"),\n Company: polargo.String(\"Torp, Kuhlman and Howell\"),\n Blog: polargo.String(\"<value>\"),\n Location: polargo.String(\"<value>\"),\n Email: polargo.String(\"[email protected]\"),\n TwitterUsername: polargo.String(\"<value>\"),\n PledgeMinimumAmount: 105265,\n PledgeBadgeShowAmount: true,\n DefaultUpfrontSplitToContributors: polargo.Int64(907160),\n ProfileSettings: &components.OrganizationProfileSettings{},\n FeatureSettings: &components.OrganizationFeatureSettings{},\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["pledge.created"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointpledgeCreatedPost(ctx, components.WebhookPledgeCreatedPayload{\n Data: components.Pledge{\n CreatedAt: types.MustTimeFromString(\"2025-03-12T00:19:41.487Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-04-19T01:42:59.169Z\"),\n ID: \"<value>\",\n Amount: 330877,\n Currency: \"Jamaican Dollar\",\n State: components.PledgeStateDisputed,\n Type: components.PledgeTypePayDirectly,\n Issue: components.Issue{\n ID: \"66524b69-aa0b-47ac-bb9a-0cee5d3a9110\",\n Platform: components.PlatformsGithub,\n Number: 280857,\n Title: \"<value>\",\n State: components.StateOpen,\n IssueCreatedAt: types.MustTimeFromString(\"2024-02-26T00:33:35.289Z\"),\n NeedsConfirmationSolved: false,\n Funding: components.Funding{},\n Repository: components.Repository{\n ID: \"356e14cb-87a4-484c-bcfa-ebfe50487706\",\n Platform: components.PlatformsGithub,\n IsPrivate: true,\n Name: \"MyOrg\",\n Description: polargo.String(\"different premium tinderbox peter under often buzzing hastily\"),\n Stars: polargo.Int64(1337),\n License: polargo.String(\"<value>\"),\n Homepage: polargo.String(\"<value>\"),\n ProfileSettings: &components.RepositoryProfileSettings{},\n Organization: components.ExternalOrganization{\n ID: \"29159f56-74c0-464d-b598-8d5bc3b9cdda\",\n Platform: components.PlatformsGithub,\n Name: \"<value>\",\n AvatarURL: \"https://frightened-poppy.com/\",\n IsPersonal: false,\n Bio: polargo.String(\"<value>\"),\n PrettyName: polargo.String(\"<value>\"),\n Company: polargo.String(\"Bailey - Towne\"),\n Blog: polargo.String(\"<value>\"),\n Location: polargo.String(\"<value>\"),\n Email: polargo.String(\"[email protected]\"),\n TwitterUsername: polargo.String(\"<value>\"),\n OrganizationID: polargo.String(\"<value>\"),\n },\n InternalOrganization: &components.Organization{\n CreatedAt: types.MustTimeFromString(\"2025-01-03T15:27:13.109Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-15T22:10:17.041Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Slug: \"<value>\",\n AvatarURL: polargo.String(\"https://hard-to-find-thyme.org\"),\n Bio: polargo.String(\"<value>\"),\n Company: polargo.String(\"Schinner - Wiegand\"),\n Blog: polargo.String(\"<value>\"),\n Location: polargo.String(\"<value>\"),\n Email: polargo.String(\"[email protected]\"),\n TwitterUsername: polargo.String(\"<value>\"),\n PledgeMinimumAmount: 273260,\n PledgeBadgeShowAmount: false,\n DefaultUpfrontSplitToContributors: polargo.Int64(976949),\n ProfileSettings: &components.OrganizationProfileSettings{},\n FeatureSettings: &components.OrganizationFeatureSettings{},\n },\n },\n PledgeBadgeCurrentlyEmbedded: true,\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["pledge.updated"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointpledgeUpdatedPost(ctx, components.WebhookPledgeUpdatedPayload{\n Data: components.Pledge{\n CreatedAt: types.MustTimeFromString(\"2024-11-29T00:10:39.674Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-10-02T21:42:49.754Z\"),\n ID: \"<value>\",\n Amount: 634567,\n Currency: \"Singapore Dollar\",\n State: components.PledgeStateRefunded,\n Type: components.PledgeTypePayOnCompletion,\n Issue: components.Issue{\n ID: \"d2e1349d-085a-441c-abf4-379a1f21d0da\",\n Platform: components.PlatformsGithub,\n Number: 218372,\n Title: \"<value>\",\n State: components.StateClosed,\n IssueCreatedAt: types.MustTimeFromString(\"2024-08-12T14:08:31.083Z\"),\n NeedsConfirmationSolved: true,\n Funding: components.Funding{},\n Repository: components.Repository{\n ID: \"814bd7c6-3412-4f11-b523-7b38c659f44a\",\n Platform: components.PlatformsGithub,\n IsPrivate: false,\n Name: \"MyOrg\",\n Description: polargo.String(\"hm however microchip\"),\n Stars: polargo.Int64(1337),\n License: polargo.String(\"<value>\"),\n Homepage: polargo.String(\"<value>\"),\n ProfileSettings: &components.RepositoryProfileSettings{},\n Organization: components.ExternalOrganization{\n ID: \"3ddd5cc2-de10-41ef-baa1-7551cf671cc3\",\n Platform: components.PlatformsGithub,\n Name: \"<value>\",\n AvatarURL: \"https://gummy-interviewer.biz\",\n IsPersonal: false,\n Bio: polargo.String(\"<value>\"),\n PrettyName: polargo.String(\"<value>\"),\n Company: polargo.String(\"Ferry - Tremblay\"),\n Blog: polargo.String(\"<value>\"),\n Location: polargo.String(\"<value>\"),\n Email: polargo.String(\"[email protected]\"),\n TwitterUsername: polargo.String(\"<value>\"),\n OrganizationID: polargo.String(\"<value>\"),\n },\n InternalOrganization: &components.Organization{\n CreatedAt: types.MustTimeFromString(\"2025-12-13T11:00:39.217Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-02T09:51:26.214Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Slug: \"<value>\",\n AvatarURL: polargo.String(\"https://memorable-numeracy.com/\"),\n Bio: polargo.String(\"<value>\"),\n Company: polargo.String(\"Schuster - Crooks\"),\n Blog: polargo.String(\"<value>\"),\n Location: polargo.String(\"<value>\"),\n Email: polargo.String(\"[email protected]\"),\n TwitterUsername: polargo.String(\"<value>\"),\n PledgeMinimumAmount: 653584,\n PledgeBadgeShowAmount: false,\n DefaultUpfrontSplitToContributors: polargo.Int64(175899),\n ProfileSettings: &components.OrganizationProfileSettings{},\n FeatureSettings: &components.OrganizationFeatureSettings{},\n },\n },\n PledgeBadgeCurrentlyEmbedded: false,\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["product.created"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointproductCreatedPost(ctx, components.WebhookProductCreatedPayload{\n Data: components.Product{\n CreatedAt: types.MustTimeFromString(\"2023-03-27T06:36:20.130Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-21T12:05:16.637Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"into horst metal grimy clinch big grounded industrialize\"),\n IsRecurring: true,\n IsArchived: true,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n\n },\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceOneTime(\n components.CreateProductPriceOneTimeProductPriceOneTimeCustom(\n components.ProductPriceOneTimeCustom{\n CreatedAt: types.MustTimeFromString(\"2023-02-03T03:46:28.818Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-03-12T22:34:53.042Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(249521),\n MaximumAmount: polargo.Int64(723329),\n PresetAmount: polargo.Int64(675965),\n },\n ),\n ),\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringCustom(\n components.ProductPriceRecurringCustom{\n CreatedAt: types.MustTimeFromString(\"2025-12-18T17:38:35.838Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-09-21T07:48:34.028Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(399325),\n MaximumAmount: polargo.Int64(862650),\n PresetAmount: polargo.Int64(434249),\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitGitHubRepository(\n components.BenefitGitHubRepository{\n CreatedAt: types.MustTimeFromString(\"2024-09-29T01:35:30.554Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-07T02:06:02.757Z\"),\n ID: \"<value>\",\n Description: \"phooey coarse mmm venture every\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitGitHubRepositoryProperties{\n RepositoryOwner: \"polarsource\",\n RepositoryName: \"private_repo\",\n Permission: components.PermissionAdmin,\n },\n },\n ),\n components.CreateBenefitBenefitLicenseKeys(\n components.BenefitLicenseKeys{\n CreatedAt: types.MustTimeFromString(\"2023-06-21T15:29:47.140Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-08-03T05:27:40.759Z\"),\n ID: \"<value>\",\n Description: \"whoever provided besides whether\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitLicenseKeysProperties{\n Prefix: polargo.String(\"<value>\"),\n Expires: &components.BenefitLicenseKeyExpirationProperties{\n TTL: 192106,\n Timeframe: components.TimeframeMonth,\n },\n Activations: &components.BenefitLicenseKeyActivationProperties{\n Limit: 584727,\n EnableCustomerAdmin: false,\n },\n LimitUsage: polargo.Int64(720229),\n },\n },\n ),\n components.CreateBenefitBenefitDownloadables(\n components.BenefitDownloadables{\n CreatedAt: types.MustTimeFromString(\"2023-09-25T06:48:53.071Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-06-15T10:56:39.139Z\"),\n ID: \"<value>\",\n Description: \"faraway fibre distorted seagull final accidentally joyously responsibility after\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDownloadablesProperties{\n Archived: map[string]bool{\n \"key\": false,\n },\n Files: []string{\n \"<value>\",\n },\n },\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/Users\",\n MimeType: \"<value>\",\n Size: 692895,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2023-02-28T01:03:14.537Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-06-03T00:39:20.038Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://monstrous-cop-out.net\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/var/mail\",\n MimeType: \"<value>\",\n Size: 843323,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2023-04-23T21:31:25.476Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-07-19T01:29:35.587Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://well-made-farm.com\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/root\",\n MimeType: \"<value>\",\n Size: 849549,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2023-07-30T13:09:33.963Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-10-02T20:39:40.444Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://simplistic-devastation.com\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldDate(\n components.CustomFieldDate{\n CreatedAt: types.MustTimeFromString(\"2023-08-25T09:54:34.570Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-03-22T10:22:09.584Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldDateMetadata{\n \"key\": components.CreateCustomFieldDateMetadataBoolean(\n false,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldDateProperties{},\n },\n ),\n Order: 317196,\n Required: false,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldNumber(\n components.CustomFieldNumber{\n CreatedAt: types.MustTimeFromString(\"2025-02-12T16:46:51.894Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-20T05:40:24.943Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldNumberMetadata{\n \"key\": components.CreateCustomFieldNumberMetadataBoolean(\n false,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldNumberProperties{},\n },\n ),\n Order: 492053,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldCheckbox(\n components.CustomFieldCheckbox{\n CreatedAt: types.MustTimeFromString(\"2025-10-21T08:02:08.197Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-02-07T01:56:51.342Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldCheckboxMetadata{\n \"key\": components.CreateCustomFieldCheckboxMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldCheckboxProperties{},\n },\n ),\n Order: 17631,\n Required: true,\n },\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["product.updated"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointproductUpdatedPost(ctx, components.WebhookProductUpdatedPayload{\n Data: components.Product{\n CreatedAt: types.MustTimeFromString(\"2024-06-25T03:46:32.479Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-06-04T01:47:33.158Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"er ick birdcage\"),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n\n },\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2024-07-16T21:09:51.818Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-03-20T08:40:07.478Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 604318,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitDiscord(\n components.BenefitDiscord{\n CreatedAt: types.MustTimeFromString(\"2025-05-20T12:53:47.146Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-04-21T12:36:34.746Z\"),\n ID: \"<value>\",\n Description: \"sometimes lest uselessly brr aftermath behind pfft unrealistic abseil\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDiscordProperties{\n GuildID: \"<id>\",\n RoleID: \"<id>\",\n GuildToken: \"<value>\",\n },\n },\n ),\n components.CreateBenefitBenefitDownloadables(\n components.BenefitDownloadables{\n CreatedAt: types.MustTimeFromString(\"2024-06-18T20:15:14.004Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-08-28T23:32:17.658Z\"),\n ID: \"<value>\",\n Description: \"blindly after whoa charter\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDownloadablesProperties{\n Archived: map[string]bool{\n \"key\": false,\n },\n Files: []string{\n \"<value>\",\n },\n },\n },\n ),\n components.CreateBenefitBenefitDownloadables(\n components.BenefitDownloadables{\n CreatedAt: types.MustTimeFromString(\"2024-11-03T07:22:50.678Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-03-23T03:59:25.986Z\"),\n ID: \"<value>\",\n Description: \"nor scratchy inasmuch shipper these range as notwithstanding\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDownloadablesProperties{\n Archived: map[string]bool{\n \"key\": false,\n },\n Files: []string{\n \"<value>\",\n },\n },\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/dev\",\n MimeType: \"<value>\",\n Size: 37455,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2025-09-15T21:42:22.500Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2025-06-18T16:17:48.946Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://unknown-lava.com\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldText(\n components.CustomFieldText{\n CreatedAt: types.MustTimeFromString(\"2025-12-02T04:10:31.923Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-06-06T15:01:23.581Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldTextMetadata{\n \"key\": components.CreateCustomFieldTextMetadataInteger(\n 767516,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldTextProperties{},\n },\n ),\n Order: 19557,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldCheckbox(\n components.CustomFieldCheckbox{\n CreatedAt: types.MustTimeFromString(\"2023-04-26T16:11:06.774Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-01-27T07:09:12.561Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldCheckboxMetadata{\n \"key\": components.CreateCustomFieldCheckboxMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldCheckboxProperties{},\n },\n ),\n Order: 753420,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldText(\n components.CustomFieldText{\n CreatedAt: types.MustTimeFromString(\"2024-03-21T07:09:29.044Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-30T13:16:31.036Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldTextMetadata{\n \"key\": components.CreateCustomFieldTextMetadataBoolean(\n false,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldTextProperties{},\n },\n ),\n Order: 454407,\n Required: true,\n },\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["subscription.active"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointsubscriptionActivePost(ctx, components.WebhookSubscriptionActivePayload{\n Data: components.Subscription{\n CreatedAt: types.MustTimeFromString(\"2023-09-17T11:03:44.679Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-07-24T20:02:17.426Z\"),\n ID: \"<value>\",\n Amount: polargo.Int64(116760),\n Currency: polargo.String(\"Quetzal\"),\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n Status: components.SubscriptionStatusIncomplete,\n CurrentPeriodStart: types.MustTimeFromString(\"2023-08-25T00:14:50.252Z\"),\n CurrentPeriodEnd: types.MustNewTimeFromString(\"2023-12-10T18:25:01.577Z\"),\n CancelAtPeriodEnd: false,\n CanceledAt: types.MustNewTimeFromString(\"2024-07-05T14:07:23.099Z\"),\n StartedAt: types.MustNewTimeFromString(\"2024-06-30T08:12:48.355Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-06-29T07:42:54.895Z\"),\n EndedAt: types.MustNewTimeFromString(\"2025-10-30T02:51:06.576Z\"),\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n PriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n CustomerCancellationReason: components.CustomerCancellationReasonSwitchedService.ToPointer(),\n CustomerCancellationComment: polargo.String(\"<value>\"),\n Metadata: map[string]components.Metadata{\n \"key\": components.CreateMetadataBoolean(\n true,\n ),\n \"key1\": components.CreateMetadataStr(\n \"<value>\",\n ),\n \"key2\": components.CreateMetadataInteger(\n 615212,\n ),\n },\n Customer: components.SubscriptionCustomer{\n CreatedAt: types.MustTimeFromString(\"2023-04-25T08:49:41.567Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-09-05T08:50:11.879Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.SubscriptionCustomerMetadata{\n\n },\n Email: \"[email protected]\",\n EmailVerified: true,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Cuba\",\n },\n TaxID: []components.TaxID{\n components.CreateTaxIDStr(\n \"pe_ruc\",\n ),\n components.CreateTaxIDStr(\n \"tr_tin\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://steel-zebra.biz/\",\n },\n UserID: \"<value>\",\n User: components.SubscriptionUser{\n ID: \"<value>\",\n Email: \"[email protected]\",\n PublicName: \"<value>\",\n },\n Product: components.Product{\n CreatedAt: types.MustTimeFromString(\"2024-08-26T12:17:17.429Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-06-15T18:12:34.300Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"during boo place enchanting\"),\n IsRecurring: false,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n\n },\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2025-03-03T05:42:43.472Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-25T20:49:29.186Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 548993,\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitAds(\n components.BenefitAds{\n CreatedAt: types.MustTimeFromString(\"2023-08-21T14:23:30.730Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-02-06T12:14:24.412Z\"),\n ID: \"<value>\",\n Description: \"unconscious athwart metal inasmuch\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitAdsProperties{},\n },\n ),\n components.CreateBenefitBenefitDiscord(\n components.BenefitDiscord{\n CreatedAt: types.MustTimeFromString(\"2023-03-05T19:10:12.474Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-06-21T03:03:13.950Z\"),\n ID: \"<value>\",\n Description: \"times seemingly by wring any enchanting nervously\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDiscordProperties{\n GuildID: \"<id>\",\n RoleID: \"<id>\",\n GuildToken: \"<value>\",\n },\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/media\",\n MimeType: \"<value>\",\n Size: 931655,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2023-06-07T17:40:48.757Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-07-27T18:04:02.928Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://remorseful-hamburger.name\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldDate(\n components.CustomFieldDate{\n CreatedAt: types.MustTimeFromString(\"2024-04-08T21:18:58.564Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-07-25T23:15:00.286Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldDateMetadata{\n \"key\": components.CreateCustomFieldDateMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldDateProperties{},\n },\n ),\n Order: 769742,\n Required: false,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldText(\n components.CustomFieldText{\n CreatedAt: types.MustTimeFromString(\"2025-08-21T14:16:55.057Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-10-24T23:47:56.996Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldTextMetadata{\n \"key\": components.CreateCustomFieldTextMetadataInteger(\n 40876,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldTextProperties{},\n },\n ),\n Order: 61975,\n Required: false,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldNumber(\n components.CustomFieldNumber{\n CreatedAt: types.MustTimeFromString(\"2023-04-21T18:01:48.119Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-04-25T22:22:19.388Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldNumberMetadata{\n \"key\": components.CreateCustomFieldNumberMetadataInteger(\n 540792,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldNumberProperties{},\n },\n ),\n Order: 531803,\n Required: true,\n },\n },\n },\n Price: components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2023-12-23T16:15:36.650Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-10-26T16:01:57.187Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 910219,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n Discount: components.CreateSubscriptionDiscountDiscountPercentageOnceForeverDurationBase(\n components.DiscountPercentageOnceForeverDurationBase{\n Duration: components.DiscountDurationRepeating,\n Type: components.DiscountTypePercentage,\n BasisPoints: 722311,\n CreatedAt: types.MustTimeFromString(\"2025-09-04T07:15:12.730Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-10-06T11:12:50.335Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountPercentageOnceForeverDurationBaseMetadata{\n \"key\": components.CreateDiscountPercentageOnceForeverDurationBaseMetadataInteger(\n 85516,\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2025-11-16T18:30:55.860Z\"),\n EndsAt: types.MustNewTimeFromString(\"2025-02-08T03:34:15.957Z\"),\n MaxRedemptions: polargo.Int64(692583),\n RedemptionsCount: 78638,\n OrganizationID: \"<value>\",\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["subscription.canceled"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointsubscriptionCanceledPost(ctx, components.WebhookSubscriptionCanceledPayload{\n Data: components.Subscription{\n CreatedAt: types.MustTimeFromString(\"2024-02-08T10:04:43.200Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-02-20T09:16:44.963Z\"),\n ID: \"<value>\",\n Amount: polargo.Int64(384017),\n Currency: polargo.String(\"Nakfa\"),\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n Status: components.SubscriptionStatusCanceled,\n CurrentPeriodStart: types.MustTimeFromString(\"2025-08-29T23:51:26.505Z\"),\n CurrentPeriodEnd: types.MustNewTimeFromString(\"2024-01-30T14:57:29.126Z\"),\n CancelAtPeriodEnd: false,\n CanceledAt: types.MustNewTimeFromString(\"2023-05-31T10:57:35.559Z\"),\n StartedAt: types.MustNewTimeFromString(\"2024-10-31T08:13:37.012Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-08-22T21:50:14.399Z\"),\n EndedAt: types.MustNewTimeFromString(\"2023-07-13T20:08:34.251Z\"),\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n PriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n CustomerCancellationReason: components.CustomerCancellationReasonTooExpensive.ToPointer(),\n CustomerCancellationComment: polargo.String(\"<value>\"),\n Metadata: map[string]components.Metadata{\n \"key\": components.CreateMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateMetadataStr(\n \"<value>\",\n ),\n \"key2\": components.CreateMetadataInteger(\n 199269,\n ),\n },\n Customer: components.SubscriptionCustomer{\n CreatedAt: types.MustTimeFromString(\"2023-12-04T19:57:16.999Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-03T00:48:16.846Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.SubscriptionCustomerMetadata{\n \"key\": components.CreateSubscriptionCustomerMetadataStr(\n \"<value>\",\n ),\n },\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Costa Rica\",\n },\n TaxID: []components.TaxID{\n components.CreateTaxIDStr(\n \"eu_oss_vat\",\n ),\n components.CreateTaxIDStr(\n \"in_gst\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://pretty-t-shirt.info/\",\n },\n UserID: \"<value>\",\n User: components.SubscriptionUser{\n ID: \"<value>\",\n Email: \"[email protected]\",\n PublicName: \"<value>\",\n },\n Product: components.Product{\n CreatedAt: types.MustTimeFromString(\"2024-12-23T22:35:56.583Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-10-09T20:16:33.963Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"where yogurt atop\"),\n IsRecurring: false,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateProductMetadataInteger(\n 62716,\n ),\n \"key2\": components.CreateProductMetadataInteger(\n 761239,\n ),\n },\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringCustom(\n components.ProductPriceRecurringCustom{\n CreatedAt: types.MustTimeFromString(\"2024-08-21T02:54:54.408Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-07-28T01:03:20.167Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(122485),\n MaximumAmount: polargo.Int64(395618),\n PresetAmount: polargo.Int64(265744),\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFree(\n components.ProductPriceRecurringFree{\n CreatedAt: types.MustTimeFromString(\"2024-08-08T00:11:25.600Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-12-03T09:30:25.375Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n components.CreateProductPriceProductPriceOneTime(\n components.CreateProductPriceOneTimeProductPriceOneTimeCustom(\n components.ProductPriceOneTimeCustom{\n CreatedAt: types.MustTimeFromString(\"2024-07-03T23:27:48.693Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-28T22:13:40.467Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(720813),\n MaximumAmount: polargo.Int64(169607),\n PresetAmount: polargo.Int64(887638),\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitCustom(\n components.BenefitCustom{\n CreatedAt: types.MustTimeFromString(\"2024-06-13T07:16:17.167Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-09-11T15:15:55.577Z\"),\n ID: \"<value>\",\n Description: \"tag if institute\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitCustomProperties{\n Note: polargo.String(\"<value>\"),\n },\n IsTaxApplicable: false,\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/root\",\n MimeType: \"<value>\",\n Size: 856792,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2023-05-15T05:51:11.123Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-10-19T06:08:48.337Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://delirious-stir-fry.name\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/mnt\",\n MimeType: \"<value>\",\n Size: 683673,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2025-12-28T00:16:36.233Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2024-07-03T23:27:48.693Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://self-reliant-comestible.org\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldNumber(\n components.CustomFieldNumber{\n CreatedAt: types.MustTimeFromString(\"2025-08-24T04:18:58.722Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-14T09:37:03.033Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldNumberMetadata{\n \"key\": components.CreateCustomFieldNumberMetadataInteger(\n 837929,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldNumberProperties{},\n },\n ),\n Order: 765648,\n Required: false,\n },\n },\n },\n Price: components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2024-01-22T19:23:36.032Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-12-01T05:29:47.613Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 333671,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n Discount: components.CreateSubscriptionDiscountDiscountPercentageRepeatDurationBase(\n components.DiscountPercentageRepeatDurationBase{\n Duration: components.DiscountDurationForever,\n DurationInMonths: 475886,\n Type: components.DiscountTypeFixed,\n BasisPoints: 790486,\n CreatedAt: types.MustTimeFromString(\"2023-09-02T10:00:40.401Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-04-04T09:00:42.582Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountPercentageRepeatDurationBaseMetadata{\n \"key\": components.CreateDiscountPercentageRepeatDurationBaseMetadataBoolean(\n false,\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2023-09-17T02:05:01.437Z\"),\n EndsAt: types.MustNewTimeFromString(\"2024-12-15T09:27:49.446Z\"),\n MaxRedemptions: polargo.Int64(508456),\n RedemptionsCount: 131154,\n OrganizationID: \"<value>\",\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["subscription.created"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointsubscriptionCreatedPost(ctx, components.WebhookSubscriptionCreatedPayload{\n Data: components.Subscription{\n CreatedAt: types.MustTimeFromString(\"2024-07-03T01:29:40.920Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-02-20T03:35:25.500Z\"),\n ID: \"<value>\",\n Amount: polargo.Int64(78980),\n Currency: polargo.String(\"Dong\"),\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n Status: components.SubscriptionStatusIncompleteExpired,\n CurrentPeriodStart: types.MustTimeFromString(\"2025-01-25T02:46:12.208Z\"),\n CurrentPeriodEnd: types.MustNewTimeFromString(\"2023-10-08T16:07:22.449Z\"),\n CancelAtPeriodEnd: false,\n CanceledAt: types.MustNewTimeFromString(\"2025-10-17T20:21:29.819Z\"),\n StartedAt: types.MustNewTimeFromString(\"2023-02-26T17:52:17.099Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-07-04T19:46:53.033Z\"),\n EndedAt: types.MustNewTimeFromString(\"2023-09-06T09:33:34.348Z\"),\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n PriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n CustomerCancellationReason: components.CustomerCancellationReasonUnused.ToPointer(),\n CustomerCancellationComment: polargo.String(\"<value>\"),\n Metadata: map[string]components.Metadata{\n \"key\": components.CreateMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateMetadataInteger(\n 229409,\n ),\n },\n Customer: components.SubscriptionCustomer{\n CreatedAt: types.MustTimeFromString(\"2023-04-01T11:22:10.531Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-06-26T00:08:47.301Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.SubscriptionCustomerMetadata{\n \"key\": components.CreateSubscriptionCustomerMetadataBoolean(\n true,\n ),\n },\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Bhutan\",\n },\n TaxID: []components.TaxID{\n components.CreateTaxIDStr(\n \"il_vat\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://tense-convection.net/\",\n },\n UserID: \"<value>\",\n User: components.SubscriptionUser{\n ID: \"<value>\",\n Email: \"[email protected]\",\n PublicName: \"<value>\",\n },\n Product: components.Product{\n CreatedAt: types.MustTimeFromString(\"2023-03-19T22:51:30.621Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-17T16:08:26.249Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"twine deed um on sudden\"),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n\n },\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2024-10-20T04:11:00.112Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-10-15T04:37:01.123Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 393819,\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitGitHubRepository(\n components.BenefitGitHubRepository{\n CreatedAt: types.MustTimeFromString(\"2023-03-11T21:19:16.841Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-17T14:25:00.377Z\"),\n ID: \"<value>\",\n Description: \"requite unfreeze version oddball ornery cantaloupe\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitGitHubRepositoryProperties{\n RepositoryOwner: \"polarsource\",\n RepositoryName: \"private_repo\",\n Permission: components.PermissionTriage,\n },\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/sys\",\n MimeType: \"<value>\",\n Size: 580222,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2025-06-23T21:40:44.558Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2024-07-20T01:51:58.643Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://dapper-marimba.com/\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2024-03-05T01:33:52.385Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-24T03:01:46.062Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldSelectProperties{\n Options: []components.CustomFieldSelectOption{\n components.CustomFieldSelectOption{\n Value: \"<value>\",\n Label: \"<value>\",\n },\n },\n },\n },\n ),\n Order: 144670,\n Required: false,\n },\n },\n },\n Price: components.CreateProductPriceRecurringProductPriceRecurringFree(\n components.ProductPriceRecurringFree{\n CreatedAt: types.MustTimeFromString(\"2023-06-21T22:51:37.278Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-01-29T05:08:10.453Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n Discount: components.CreateSubscriptionDiscountDiscountFixedRepeatDurationBase(\n components.DiscountFixedRepeatDurationBase{\n Duration: components.DiscountDurationOnce,\n DurationInMonths: 884463,\n Type: components.DiscountTypePercentage,\n Amount: 762760,\n Currency: \"Armenian Dram\",\n CreatedAt: types.MustTimeFromString(\"2024-12-30T11:33:29.704Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-08-07T10:12:08.922Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountFixedRepeatDurationBaseMetadata{\n \"key\": components.CreateDiscountFixedRepeatDurationBaseMetadataBoolean(\n false,\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2024-11-25T15:12:50.077Z\"),\n EndsAt: types.MustNewTimeFromString(\"2024-02-21T18:53:58.260Z\"),\n MaxRedemptions: polargo.Int64(884322),\n RedemptionsCount: 188933,\n OrganizationID: \"<value>\",\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["subscription.revoked"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointsubscriptionRevokedPost(ctx, components.WebhookSubscriptionRevokedPayload{\n Data: components.Subscription{\n CreatedAt: types.MustTimeFromString(\"2025-11-29T12:00:55.925Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-03-13T04:36:55.320Z\"),\n ID: \"<value>\",\n Amount: polargo.Int64(780683),\n Currency: polargo.String(\"CFP Franc\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n Status: components.SubscriptionStatusTrialing,\n CurrentPeriodStart: types.MustTimeFromString(\"2023-06-20T05:55:42.170Z\"),\n CurrentPeriodEnd: types.MustNewTimeFromString(\"2024-05-16T17:55:53.899Z\"),\n CancelAtPeriodEnd: true,\n CanceledAt: types.MustNewTimeFromString(\"2025-10-25T10:04:20.460Z\"),\n StartedAt: types.MustNewTimeFromString(\"2024-09-29T18:36:35.285Z\"),\n EndsAt: types.MustNewTimeFromString(\"2024-02-23T17:26:12.806Z\"),\n EndedAt: types.MustNewTimeFromString(\"2024-01-24T11:12:57.680Z\"),\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n PriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n CustomerCancellationReason: components.CustomerCancellationReasonTooExpensive.ToPointer(),\n CustomerCancellationComment: polargo.String(\"<value>\"),\n Metadata: map[string]components.Metadata{\n\n },\n Customer: components.SubscriptionCustomer{\n CreatedAt: types.MustTimeFromString(\"2025-09-02T15:09:07.489Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-06-23T22:13:15.423Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.SubscriptionCustomerMetadata{\n \"key\": components.CreateSubscriptionCustomerMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateSubscriptionCustomerMetadataInteger(\n 182663,\n ),\n },\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Portugal\",\n },\n TaxID: []components.TaxID{\n components.CreateTaxIDTaxIDFormat(\n components.TaxIDFormatTwVat,\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://exotic-traffic.com/\",\n },\n UserID: \"<value>\",\n User: components.SubscriptionUser{\n ID: \"<value>\",\n Email: \"[email protected]\",\n PublicName: \"<value>\",\n },\n Product: components.Product{\n CreatedAt: types.MustTimeFromString(\"2024-10-17T20:35:01.045Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-05-01T17:14:35.906Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"scout second management whose underachieve weakly yippee\"),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n\n },\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFree(\n components.ProductPriceRecurringFree{\n CreatedAt: types.MustTimeFromString(\"2023-10-09T19:55:20.541Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-03-23T11:24:56.774Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n components.CreateProductPriceProductPriceOneTime(\n components.CreateProductPriceOneTimeProductPriceOneTimeCustom(\n components.ProductPriceOneTimeCustom{\n CreatedAt: types.MustTimeFromString(\"2023-03-27T09:29:11.539Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-01-15T05:03:13.776Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(893478),\n MaximumAmount: polargo.Int64(131527),\n PresetAmount: polargo.Int64(742218),\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitDiscord(\n components.BenefitDiscord{\n CreatedAt: types.MustTimeFromString(\"2023-01-06T18:53:09.581Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-22T20:31:52.541Z\"),\n ID: \"<value>\",\n Description: \"shrill including giant when modulo than cleaner popularity geez\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDiscordProperties{\n GuildID: \"<id>\",\n RoleID: \"<id>\",\n GuildToken: \"<value>\",\n },\n },\n ),\n components.CreateBenefitBenefitGitHubRepository(\n components.BenefitGitHubRepository{\n CreatedAt: types.MustTimeFromString(\"2023-02-28T00:48:07.967Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-06-03T08:19:48.070Z\"),\n ID: \"<value>\",\n Description: \"resource scarily smoothly same\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitGitHubRepositoryProperties{\n RepositoryOwner: \"polarsource\",\n RepositoryName: \"private_repo\",\n Permission: components.PermissionPush,\n },\n },\n ),\n components.CreateBenefitBenefitDownloadables(\n components.BenefitDownloadables{\n CreatedAt: types.MustTimeFromString(\"2025-09-25T18:49:07.195Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-04-23T18:43:10.741Z\"),\n ID: \"<value>\",\n Description: \"er strictly provided\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDownloadablesProperties{\n Archived: map[string]bool{\n \"key\": false,\n },\n Files: []string{\n \"<value>\",\n },\n },\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/usr/bin\",\n MimeType: \"<value>\",\n Size: 406671,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2025-03-28T05:43:23.560Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-04-23T18:43:10.741Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://fragrant-appliance.name/\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/lost+found\",\n MimeType: \"<value>\",\n Size: 76103,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2024-01-01T17:02:54.395Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2025-07-29T05:29:45.670Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://calculating-lieu.biz\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldDate(\n components.CustomFieldDate{\n CreatedAt: types.MustTimeFromString(\"2023-06-25T15:31:04.595Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-09-30T02:02:28.275Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldDateMetadata{\n \"key\": components.CreateCustomFieldDateMetadataInteger(\n 258573,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldDateProperties{},\n },\n ),\n Order: 474835,\n Required: false,\n },\n },\n },\n Price: components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2023-12-25T03:14:41.345Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-02-16T03:38:52.727Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 99218,\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n Discount: components.CreateSubscriptionDiscountDiscountPercentageRepeatDurationBase(\n components.DiscountPercentageRepeatDurationBase{\n Duration: components.DiscountDurationForever,\n DurationInMonths: 91775,\n Type: components.DiscountTypeFixed,\n BasisPoints: 365528,\n CreatedAt: types.MustTimeFromString(\"2025-11-17T07:57:17.698Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-06-09T18:52:08.825Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountPercentageRepeatDurationBaseMetadata{\n \"key\": components.CreateDiscountPercentageRepeatDurationBaseMetadataStr(\n \"<value>\",\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2023-01-29T22:05:17.496Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-10-06T21:41:05.513Z\"),\n MaxRedemptions: polargo.Int64(463882),\n RedemptionsCount: 599631,\n OrganizationID: \"<value>\",\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["subscription.uncanceled"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointsubscriptionUncanceledPost(ctx, components.WebhookSubscriptionUncanceledPayload{\n Data: components.Subscription{\n CreatedAt: types.MustTimeFromString(\"2024-06-17T13:11:57.598Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-03-19T00:33:29.972Z\"),\n ID: \"<value>\",\n Amount: polargo.Int64(243909),\n Currency: polargo.String(\"Swiss Franc\"),\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n Status: components.SubscriptionStatusPastDue,\n CurrentPeriodStart: types.MustTimeFromString(\"2025-04-10T22:53:35.005Z\"),\n CurrentPeriodEnd: types.MustNewTimeFromString(\"2025-11-06T14:37:36.152Z\"),\n CancelAtPeriodEnd: false,\n CanceledAt: types.MustNewTimeFromString(\"2025-11-20T17:26:51.612Z\"),\n StartedAt: types.MustNewTimeFromString(\"2023-03-17T23:30:29.508Z\"),\n EndsAt: types.MustNewTimeFromString(\"2024-09-26T10:53:58.966Z\"),\n EndedAt: types.MustNewTimeFromString(\"2023-07-03T15:11:27.108Z\"),\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n PriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n CustomerCancellationReason: components.CustomerCancellationReasonLowQuality.ToPointer(),\n CustomerCancellationComment: polargo.String(\"<value>\"),\n Metadata: map[string]components.Metadata{\n \"key\": components.CreateMetadataInteger(\n 21399,\n ),\n \"key1\": components.CreateMetadataStr(\n \"<value>\",\n ),\n },\n Customer: components.SubscriptionCustomer{\n CreatedAt: types.MustTimeFromString(\"2023-12-13T17:38:34.053Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-30T22:08:30.455Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.SubscriptionCustomerMetadata{\n\n },\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Bangladesh\",\n },\n TaxID: []components.TaxID{\n components.CreateTaxIDStr(\n \"us_ein\",\n ),\n components.CreateTaxIDStr(\n \"jp_trn\",\n ),\n components.CreateTaxIDStr(\n \"ca_gst_hst\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://direct-ferret.org/\",\n },\n UserID: \"<value>\",\n User: components.SubscriptionUser{\n ID: \"<value>\",\n Email: \"[email protected]\",\n PublicName: \"<value>\",\n },\n Product: components.Product{\n CreatedAt: types.MustTimeFromString(\"2023-03-30T10:41:05.586Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-10-18T00:21:05.189Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"fully pepper hm jovially outside coal bah fax midst\"),\n IsRecurring: false,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataBoolean(\n false,\n ),\n },\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceOneTime(\n components.CreateProductPriceOneTimeProductPriceOneTimeCustom(\n components.ProductPriceOneTimeCustom{\n CreatedAt: types.MustTimeFromString(\"2023-06-18T04:43:20.642Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-05-02T08:47:34.373Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(108556),\n MaximumAmount: polargo.Int64(564252),\n PresetAmount: polargo.Int64(876393),\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitLicenseKeys(\n components.BenefitLicenseKeys{\n CreatedAt: types.MustTimeFromString(\"2024-12-31T09:20:50.627Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-16T05:06:27.930Z\"),\n ID: \"<value>\",\n Description: \"pfft partially terribly youthfully gorgeous\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitLicenseKeysProperties{\n Prefix: polargo.String(\"<value>\"),\n Expires: &components.BenefitLicenseKeyExpirationProperties{\n TTL: 957072,\n Timeframe: components.TimeframeYear,\n },\n Activations: &components.BenefitLicenseKeyActivationProperties{\n Limit: 140123,\n EnableCustomerAdmin: false,\n },\n LimitUsage: polargo.Int64(513004),\n },\n },\n ),\n components.CreateBenefitBenefitAds(\n components.BenefitAds{\n CreatedAt: types.MustTimeFromString(\"2025-10-26T09:56:41.885Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-08-06T23:04:03.832Z\"),\n ID: \"<value>\",\n Description: \"forenenst jovially versus\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitAdsProperties{},\n },\n ),\n components.CreateBenefitBenefitAds(\n components.BenefitAds{\n CreatedAt: types.MustTimeFromString(\"2023-08-19T12:01:12.439Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-07-18T05:23:31.551Z\"),\n ID: \"<value>\",\n Description: \"please intervention lest huzzah wonderful\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitAdsProperties{},\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/rescue\",\n MimeType: \"<value>\",\n Size: 406629,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2025-11-25T05:13:22.395Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-01-12T01:04:51.744Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://major-scenario.com/\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/System\",\n MimeType: \"<value>\",\n Size: 743911,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2024-07-30T00:48:09.915Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2023-01-08T04:01:53.027Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://mild-earth.info/\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldNumber(\n components.CustomFieldNumber{\n CreatedAt: types.MustTimeFromString(\"2025-06-14T07:00:03.679Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-26T14:44:29.951Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldNumberMetadata{\n \"key\": components.CreateCustomFieldNumberMetadataBoolean(\n false,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldNumberProperties{},\n },\n ),\n Order: 696517,\n Required: false,\n },\n },\n },\n Price: components.CreateProductPriceRecurringProductPriceRecurringFixed(\n components.ProductPriceRecurringFixed{\n CreatedAt: types.MustTimeFromString(\"2024-08-01T06:02:27.996Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-05-08T03:02:40.497Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n PriceCurrency: \"<value>\",\n PriceAmount: 968810,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n Discount: components.CreateSubscriptionDiscountDiscountFixedOnceForeverDurationBase(\n components.DiscountFixedOnceForeverDurationBase{\n Duration: components.DiscountDurationOnce,\n Type: components.DiscountTypeFixed,\n Amount: 215911,\n Currency: \"New Zealand Dollar\",\n CreatedAt: types.MustTimeFromString(\"2025-06-07T04:10:46.730Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-08-14T11:04:48.998Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountFixedOnceForeverDurationBaseMetadata{\n \"key\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataBoolean(\n false,\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2025-03-03T08:36:58.492Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-12-02T07:45:29.359Z\"),\n MaxRedemptions: polargo.Int64(132362),\n RedemptionsCount: 644131,\n OrganizationID: \"<value>\",\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["subscription.updated"]["post"]
update:
"x-codeSamples":
- "lang": "go"
"label": "Go (SDK)"
"source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := polargo.New()\n\n res, err := s.EndpointsubscriptionUpdatedPost(ctx, components.WebhookSubscriptionUpdatedPayload{\n Data: components.Subscription{\n CreatedAt: types.MustTimeFromString(\"2023-08-16T06:35:49.390Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-11-13T10:48:05.575Z\"),\n ID: \"<value>\",\n Amount: polargo.Int64(299644),\n Currency: polargo.String(\"Baht\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n Status: components.SubscriptionStatusTrialing,\n CurrentPeriodStart: types.MustTimeFromString(\"2025-10-06T07:01:55.000Z\"),\n CurrentPeriodEnd: types.MustNewTimeFromString(\"2025-01-20T06:59:31.349Z\"),\n CancelAtPeriodEnd: false,\n CanceledAt: types.MustNewTimeFromString(\"2023-10-04T04:56:04.382Z\"),\n StartedAt: types.MustNewTimeFromString(\"2023-01-22T12:57:07.430Z\"),\n EndsAt: types.MustNewTimeFromString(\"2025-08-08T17:53:12.513Z\"),\n EndedAt: types.MustNewTimeFromString(\"2023-10-08T02:40:52.099Z\"),\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n PriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n CustomerCancellationReason: components.CustomerCancellationReasonTooExpensive.ToPointer(),\n CustomerCancellationComment: polargo.String(\"<value>\"),\n Metadata: map[string]components.Metadata{\n \"key\": components.CreateMetadataInteger(\n 394013,\n ),\n },\n Customer: components.SubscriptionCustomer{\n CreatedAt: types.MustTimeFromString(\"2025-09-14T04:37:19.722Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-03-24T00:03:13.207Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.SubscriptionCustomerMetadata{\n \"key\": components.CreateSubscriptionCustomerMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateSubscriptionCustomerMetadataBoolean(\n true,\n ),\n \"key2\": components.CreateSubscriptionCustomerMetadataInteger(\n 392900,\n ),\n },\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Sweden\",\n },\n TaxID: []components.TaxID{\n components.CreateTaxIDStr(\n \"mx_rfc\",\n ),\n components.CreateTaxIDStr(\n \"gb_vat\",\n ),\n components.CreateTaxIDStr(\n \"<value>\",\n ),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://worthy-place.biz\",\n },\n UserID: \"<value>\",\n User: components.SubscriptionUser{\n ID: \"<value>\",\n Email: \"[email protected]\",\n PublicName: \"<value>\",\n },\n Product: components.Product{\n CreatedAt: types.MustTimeFromString(\"2024-06-11T14:55:33.574Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-06-02T07:14:13.619Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"intent that yowza\"),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateProductMetadataBoolean(\n true,\n ),\n },\n Prices: []components.ProductPrice{\n components.CreateProductPriceProductPriceRecurring(\n components.CreateProductPriceRecurringProductPriceRecurringFree(\n components.ProductPriceRecurringFree{\n CreatedAt: types.MustTimeFromString(\"2023-02-04T10:40:02.757Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-03-05T14:45:21.856Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitDownloadables(\n components.BenefitDownloadables{\n CreatedAt: types.MustTimeFromString(\"2025-08-20T20:05:26.320Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-10-31T08:07:46.637Z\"),\n ID: \"<value>\",\n Description: \"rare foolishly far vastly gah until how considering yahoo\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitDownloadablesProperties{\n Archived: map[string]bool{\n \"key\": false,\n },\n Files: []string{\n \"<value>\",\n },\n },\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/lost+found\",\n MimeType: \"<value>\",\n Size: 562154,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2025-08-06T03:20:53.935Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-09-06T09:54:32.715Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://rare-trash.info\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/etc/ppp\",\n MimeType: \"<value>\",\n Size: 66044,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2025-07-07T23:54:00.303Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-10-11T04:49:26.739Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://worse-ceramic.org\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/home\",\n MimeType: \"<value>\",\n Size: 75695,\n StorageVersion: polargo.String(\"<value>\"),\n ChecksumEtag: polargo.String(\"<value>\"),\n ChecksumSha256Base64: polargo.String(\"<value>\"),\n ChecksumSha256Hex: polargo.String(\"<value>\"),\n LastModifiedAt: types.MustNewTimeFromString(\"2023-09-16T06:56:23.715Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-06-22T20:54:57.375Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://closed-seafood.info\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2024-03-26T06:41:23.276Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-09-01T19:58:32.729Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldSelectProperties{\n Options: []components.CustomFieldSelectOption{\n components.CustomFieldSelectOption{\n Value: \"<value>\",\n Label: \"<value>\",\n },\n },\n },\n },\n ),\n Order: 553735,\n Required: false,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldCheckbox(\n components.CustomFieldCheckbox{\n CreatedAt: types.MustTimeFromString(\"2024-05-04T17:22:39.312Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-04-14T22:18:43.778Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldCheckboxMetadata{\n \"key\": components.CreateCustomFieldCheckboxMetadataInteger(\n 628033,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldCheckboxProperties{},\n },\n ),\n Order: 892169,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCustomFieldCheckbox(\n components.CustomFieldCheckbox{\n CreatedAt: types.MustTimeFromString(\"2024-03-01T13:08:49.991Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-03-20T14:00:49.875Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldCheckboxMetadata{\n \"key\": components.CreateCustomFieldCheckboxMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldCheckboxProperties{},\n },\n ),\n Order: 578881,\n Required: false,\n },\n },\n },\n Price: components.CreateProductPriceRecurringProductPriceRecurringFree(\n components.ProductPriceRecurringFree{\n CreatedAt: types.MustTimeFromString(\"2025-06-19T09:42:14.287Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-03-12T15:28:25.287Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n },\n ),\n Discount: components.CreateSubscriptionDiscountDiscountFixedOnceForeverDurationBase(\n components.DiscountFixedOnceForeverDurationBase{\n Duration: components.DiscountDurationRepeating,\n Type: components.DiscountTypePercentage,\n Amount: 212227,\n Currency: \"Leone\",\n CreatedAt: types.MustTimeFromString(\"2024-08-19T10:09:40.057Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-03-03T12:17:34.471Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountFixedOnceForeverDurationBaseMetadata{\n \"key\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataInteger(\n 925710,\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2023-06-18T09:38:27.851Z\"),\n EndsAt: types.MustNewTimeFromString(\"2025-12-13T05:04:14.428Z\"),\n MaxRedemptions: polargo.Int64(341415),\n RedemptionsCount: 222865,\n OrganizationID: \"<value>\",\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"