-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodeSamples.yaml
827 lines (827 loc) · 283 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
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
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.CreateBenefitCreateDownloadables(\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\"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.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\"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.Create(ctx, operations.CreateCheckoutLinksCreateCheckoutLinkCreateCheckoutLinkCreateProduct(\n components.CheckoutLinkCreateProduct{\n ProductID: \"<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/"]["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.List(ctx, operations.CheckoutsListRequest{})\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/"]["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.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/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.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/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.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/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.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/{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.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/{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.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.CreateCustomFieldCreateSelect(\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.CreateCustomFieldUpdateNumber(\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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.BenefitGrants.List(ctx, operations.CustomerPortalBenefitGrantsListRequest{}, operations.CustomerPortalBenefitGrantsListSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n })\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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\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\n res, err := s.CustomerPortal.BenefitGrants.Get(ctx, operations.CustomerPortalBenefitGrantsGetSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"os\"\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\n res, err := s.CustomerPortal.BenefitGrants.Update(ctx, operations.CustomerPortalBenefitGrantsUpdateSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<value>\", components.CreateCustomerBenefitGrantUpdateDownloadables(\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/me"]["get"]
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\"os\"\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\n res, err := s.CustomerPortal.Customers.Get(ctx, operations.CustomerPortalCustomersGetSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPortalCustomer != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/customers/me"]["patch"]
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/models/components\"\n\t\"os\"\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\n res, err := s.CustomerPortal.Customers.Update(ctx, components.CustomerPortalCustomerUpdate{}, operations.CustomerPortalCustomersUpdateSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPortalCustomer != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/customers/me/payment-methods"]["get"]
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\"os\"\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\n res, err := s.CustomerPortal.Customers.GetPaymentMethods(ctx, operations.CustomerPortalCustomersGetPaymentMethodsSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceUnionPaymentMethodCardPaymentMethodGeneric != 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/customers/me/payment-methods"]["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/models/components\"\n\t\"os\"\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\n res, err := s.CustomerPortal.Customers.AddPaymentMethod(ctx, components.CustomerPaymentMethodCreate{\n ConfirmationTokenID: \"<id>\",\n SetDefault: false,\n ReturnURL: \"https://slight-digestive.info\",\n }, operations.CustomerPortalCustomersAddPaymentMethodSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseCustomerPortalCustomersAddPaymentMethod != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customer-portal/customers/me/payment-methods/{id}"]["delete"]
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\"os\"\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\n res, err := s.CustomerPortal.Customers.DeletePaymentMethod(ctx, operations.CustomerPortalCustomersDeletePaymentMethodSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<id>\")\n if err != nil {\n log.Fatal(err)\n }\n if res != 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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\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\n res, err := s.CustomerPortal.Downloadables.List(ctx, operations.CustomerPortalDownloadablesListSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, 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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\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\n res, err := s.CustomerPortal.LicenseKeys.List(ctx, operations.CustomerPortalLicenseKeysListSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, 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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\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\n res, err := s.CustomerPortal.LicenseKeys.Get(ctx, operations.CustomerPortalLicenseKeysGetSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Orders.List(ctx, operations.CustomerPortalOrdersListRequest{}, operations.CustomerPortalOrdersListSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n })\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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\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\n res, err := s.CustomerPortal.Orders.Get(ctx, operations.CustomerPortalOrdersGetSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\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\n res, err := s.CustomerPortal.Orders.Invoice(ctx, operations.CustomerPortalOrdersInvoiceSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<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.CustomerOrganization != 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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Subscriptions.List(ctx, operations.CustomerPortalSubscriptionsListRequest{}, operations.CustomerPortalSubscriptionsListSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n })\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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\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\n res, err := s.CustomerPortal.Subscriptions.Cancel(ctx, operations.CustomerPortalSubscriptionsCancelSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\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\n res, err := s.CustomerPortal.Subscriptions.Get(ctx, operations.CustomerPortalSubscriptionsGetSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<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\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"os\"\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\n res, err := s.CustomerPortal.Subscriptions.Update(ctx, operations.CustomerPortalSubscriptionsUpdateSecurity{\n CustomerSession: os.Getenv(\"POLAR_CUSTOMER_SESSION\"),\n }, \"<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\"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.CustomerSessions.Create(ctx, operations.CreateCustomerSessionsCreateCustomerSessionCreateCustomerSessionCustomerIDCreate(\n components.CustomerSessionCustomerIDCreate{\n CustomerID: \"<value>\",\n },\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/external/{external_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.DeleteExternal(ctx, \"<id>\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customers/external/{external_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.GetExternal(ctx, \"<id>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Customer != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/customers/external/{external_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.UpdateExternal(ctx, \"<id>\", components.CustomerUpdate{})\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/events/"]["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.Events.List(ctx, operations.EventsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceEvent != 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/events/ingest"]["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.Events.Ingest(ctx, components.EventsIngest{\n Events: []components.Events{\n components.CreateEventsEventCreateCustomer(\n components.EventCreateCustomer{\n Name: \"<value>\",\n CustomerID: \"<value>\",\n },\n ),\n components.CreateEventsEventCreateExternalCustomer(\n components.EventCreateExternalCustomer{\n Name: \"<value>\",\n ExternalCustomerID: \"<id>\",\n },\n ),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.EventsIngestResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/events/{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.Events.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Event != 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.CreateFileCreateProductMedia(\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/meters/"]["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.Meters.List(ctx, operations.MetersListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceMeter != 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/meters/"]["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.Meters.Create(ctx, components.MeterCreate{\n Name: \"<value>\",\n Filter: components.Filter{\n Conjunction: components.FilterConjunctionAnd,\n Clauses: []components.Clauses{\n\n },\n },\n Aggregation: components.CreateMeterCreateAggregationAvg(\n components.PropertyAggregation{\n Func: components.FuncSum,\n Property: \"<value>\",\n },\n ),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Meter != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/meters/{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.Meters.Get(ctx, \"<value>\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Meter != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/meters/{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.Meters.Update(ctx, \"<value>\", components.MeterUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Meter != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/meters/{id}/events"]["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.Meters.Events(ctx, \"<value>\", nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceEvent != 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/meters/{id}/quantities"]["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.Meters.Quantities(ctx, operations.MetersQuantitiesRequest{\n ID: \"<value>\",\n StartTimestamp: types.MustTimeFromString(\"2023-09-17T00:45:34.608Z\"),\n EndTimestamp: types.MustTimeFromString(\"2023-07-21T18:11:39.069Z\"),\n Interval: components.TimeIntervalHour,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.MeterQuantities != 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.TimeIntervalWeek,\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/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.Introspect(ctx, components.IntrospectTokenRequest{\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/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.Revoke(ctx, components.RevokeTokenRequest{\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\"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.Token(ctx, operations.CreateOauth2RequestTokenRequestBodyAuthorizationCodeTokenRequest(\n components.AuthorizationCodeTokenRequest{\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.ProductCreate{\n Name: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n Prices: []components.ProductCreatePrices{\n components.CreateProductCreatePricesProductPriceCustomCreate(\n components.ProductPriceCustomCreate{},\n ),\n components.CreateProductCreatePricesProductPriceFixedCreate(\n components.ProductPriceFixedCreate{\n PriceAmount: 69025,\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/refunds/"]["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.Refunds.List(ctx, operations.RefundsListRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceRefund != 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/refunds/"]["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.Refunds.Create(ctx, components.RefundCreate{\n OrderID: \"<value>\",\n Reason: components.RefundReasonCustomerRequest,\n Amount: 638424,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Refund != 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}"]["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.Get(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 ExternalID: polargo.String(\"<id>\"),\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 polargo.Pointer(components.CreateCustomerTaxIDStr(\n \"<id>\",\n )),\n polargo.Pointer(components.CreateCustomerTaxIDStr(\n \"ae_trn\",\n )),\n polargo.Pointer(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.CreateBenefitBenefitDiscord(\n components.BenefitDiscord{\n CreatedAt: types.MustTimeFromString(\"2023-10-19T20:53:31.071Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-03T18:38:09.769Z\"),\n ID: \"<value>\",\n Description: \"sesame upwardly ah split\",\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 })\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 ExternalID: polargo.String(\"<id>\"),\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 polargo.Pointer(components.CreateCustomerTaxIDStr(\n \"<id>\",\n )),\n polargo.Pointer(components.CreateCustomerTaxIDStr(\n \"<id>\",\n )),\n polargo.Pointer(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 ExternalID: polargo.String(\"<id>\"),\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 polargo.Pointer(components.CreateCustomerTaxIDStr(\n \"<id>\",\n )),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://teeming-formamide.com/\",\n },\n Properties: components.CreateBenefitGrantWebhookPropertiesBenefitGrantDiscordProperties(\n components.BenefitGrantDiscordProperties{},\n ),\n Benefit: components.CreateBenefitBenefitGitHubRepository(\n components.BenefitGitHubRepository{\n CreatedAt: types.MustTimeFromString(\"2023-10-09T00:37:43.210Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-06-05T05:30:06.450Z\"),\n ID: \"<value>\",\n Description: \"inasmuch massage censor\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitGitHubRepositoryProperties{\n RepositoryOwner: \"polarsource\",\n RepositoryName: \"private_repo\",\n Permission: components.PermissionMaintain,\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"]["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(\"<value>\"),\n CustomerIPAddress: polargo.String(\"<value>\"),\n CustomerBillingAddress: &components.Address{\n Country: \"Solomon Islands\",\n },\n CustomerTaxID: polargo.String(\"<id>\"),\n PaymentProcessorMetadata: map[string]string{\n \"key\": \"<value>\",\n \"key1\": \"<value>\",\n \"key2\": \"<value>\",\n },\n Metadata: map[string]components.CheckoutMetadata{\n \"key\": components.CreateCheckoutMetadataStr(\n \"<value>\",\n ),\n },\n Products: []components.CheckoutProduct{\n components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2024-02-27T04:46:39.621Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-07T04:30:48.802Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"really capitalize um restructure prickly rationale certainly these restfully\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Prices: []components.CheckoutProductPrices{\n components.CreateCheckoutProductPricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2025-12-25T02:24:08.035Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-11-17T03:28:31.594Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(239004),\n MaximumAmount: polargo.Int64(603759),\n PresetAmount: polargo.Int64(476477),\n },\n ),\n ),\n },\n Benefits: []components.BenefitBase{\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2025-10-01T00:10:58.922Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-01-30T18:58:55.355Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeGithubRepository,\n Description: \"via archaeology scientific forsaken who suspiciously mmm bleak\",\n Selectable: true,\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: \"/usr/include\",\n MimeType: \"<value>\",\n Size: 169862,\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-26T19:30:29.818Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2024-10-05T17:30:08.836Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://spanish-essence.name\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/etc/mail\",\n MimeType: \"<value>\",\n Size: 852701,\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-01-15T00:45:10.927Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2023-01-18T00:51:17.880Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://best-pharmacopoeia.org/\",\n },\n },\n },\n components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2024-03-12T06:20:21.161Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-06-27T20:20:27.400Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"since hollow massive offensively painfully what questionably destock pish\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Prices: []components.CheckoutProductPrices{\n components.CreateCheckoutProductPricesProductPrice(\n components.CreateProductPriceProductPriceFree(\n components.ProductPriceFree{\n CreatedAt: types.MustTimeFromString(\"2024-08-10T14:02:02.989Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-10-29T00:32:24.235Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n },\n ),\n ),\n components.CreateCheckoutProductPricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-06-12T07:35:26.368Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-01-01T03:32:54.177Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeOneTime,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(267787),\n MaximumAmount: polargo.Int64(257118),\n PresetAmount: polargo.Int64(729217),\n },\n ),\n ),\n },\n Benefits: []components.BenefitBase{\n\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/etc/namedb\",\n MimeType: \"<value>\",\n Size: 721019,\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-18T04:40:39.968Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2023-09-29T18:20:07.088Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://similar-impostor.info/\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/root\",\n MimeType: \"<value>\",\n Size: 907325,\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-26T14:50:51.751Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2025-03-01T12:36:21.395Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://thin-illusion.org/\",\n },\n },\n },\n },\n Product: components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2023-09-09T02:18:18.878Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-30T17:25:31.182Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"roundabout gah oh hm over\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n IsRecurring: false,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Prices: []components.CheckoutProductPrices{\n components.CreateCheckoutProductPricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-12-10T06:44:06.426Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-11-05T18:06:37.266Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(102328),\n MaximumAmount: polargo.Int64(332863),\n PresetAmount: polargo.Int64(287633),\n },\n ),\n ),\n components.CreateCheckoutProductPricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-09-15T18:10:19.969Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-08T10:05:37.208Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(674791),\n MaximumAmount: polargo.Int64(138001),\n PresetAmount: polargo.Int64(879649),\n },\n ),\n ),\n },\n Benefits: []components.BenefitBase{\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-05-22T12:15:14.230Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-05-10T15:49:09.927Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeDownloadables,\n Description: \"consequently pant ha\",\n Selectable: true,\n Deletable: true,\n OrganizationID: \"<value>\",\n },\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-09-05T11:03:30.226Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-10-27T06:30:15.454Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeAds,\n Description: \"failing clonk kowtow kookily sunbathe ugh delirious now boohoo lean\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n },\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-04-20T16:45:08.626Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-10-27T21:24:45.236Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeDiscord,\n Description: \"until tenderly chapel quantify optimistically excluding aw because amongst emulsify\",\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: \"/etc/ppp\",\n MimeType: \"<value>\",\n Size: 933572,\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-28T08:49:03.364Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-07-14T04:00:39.280Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://back-pear.name/\",\n },\n },\n },\n ProductPrice: components.CreateCheckoutProductPriceProductPrice(\n components.CreateProductPriceProductPriceFixed(\n components.ProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2025-01-07T06:19:30.216Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-22T08:06:55.176Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeOneTime,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n PriceAmount: 449076,\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateCheckoutDiscountCheckoutDiscountPercentageRepeatDuration(\n components.CheckoutDiscountPercentageRepeatDuration{\n Duration: components.DiscountDurationRepeating,\n DurationInMonths: 41338,\n Type: components.DiscountTypePercentage,\n BasisPoints: 818655,\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.CreateCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2023-07-01T09:35:23.526Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-09-05T11:14:58.018Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataBoolean(\n false,\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: 552387,\n Required: false,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldText(\n components.CustomFieldText{\n CreatedAt: types.MustTimeFromString(\"2024-12-03T12:38:50.277Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-05-21T13:41:47.986Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldTextMetadata{\n \"key\": components.CreateCustomFieldTextMetadataInteger(\n 473941,\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldTextProperties{},\n },\n ),\n Order: 576333,\n Required: false,\n },\n },\n CustomerMetadata: map[string]components.CustomerMetadata{\n \"key\": components.CreateCustomerMetadataInteger(\n 667273,\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(\"<value>\"),\n CustomerIPAddress: polargo.String(\"<value>\"),\n CustomerBillingAddress: &components.Address{\n Country: \"Zambia\",\n },\n CustomerTaxID: polargo.String(\"<id>\"),\n PaymentProcessorMetadata: map[string]string{\n \"key\": \"<value>\",\n },\n Metadata: map[string]components.CheckoutMetadata{\n\n },\n Products: []components.CheckoutProduct{\n components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2024-03-12T12:25:44.387Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-03-10T17:45:08.857Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"on likewise growing capsize lest overcook vice independence strategy magnetize\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n IsRecurring: false,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Prices: []components.CheckoutProductPrices{\n\n },\n Benefits: []components.BenefitBase{\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2023-02-02T21:51:07.680Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-02-22T05:03:37.259Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeGithubRepository,\n Description: \"kiddingly likewise inveigle\",\n Selectable: true,\n Deletable: false,\n OrganizationID: \"<value>\",\n },\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-03-23T22:28:05.345Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-30T11:01:37.991Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeLicenseKeys,\n Description: \"repeatedly perky capsize shred loudly though whoever millet\",\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: \"/home\",\n MimeType: \"<value>\",\n Size: 339556,\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-09-01T01:36:50.867Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2025-06-17T05:19:25.570Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://forceful-peninsula.name/\",\n },\n },\n },\n components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2023-01-07T16:39:06.170Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-07-02T04:06:47.300Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"ruin wiggly abaft\"),\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: false,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Prices: []components.CheckoutProductPrices{\n\n },\n Benefits: []components.BenefitBase{\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2023-01-13T15:01:23.486Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-22T18:51:34.092Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeDiscord,\n Description: \"that resource whoa scarcely\",\n Selectable: true,\n Deletable: true,\n OrganizationID: \"<value>\",\n },\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2025-10-31T20:58:36.719Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-11-05T11:15:53.647Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeCustom,\n Description: \"recovery queasily despite concrete independence celsius ouch\",\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: \"/boot\",\n MimeType: \"<value>\",\n Size: 913510,\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-10T21:22:45.561Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2023-05-08T03:57:28.293Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://stable-fort.org\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/System\",\n MimeType: \"<value>\",\n Size: 604454,\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-05-15T10:29:39.214Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2024-01-19T16:36:20.955Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://simplistic-simple.biz\",\n },\n },\n },\n components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2024-04-10T05:20:18.358Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-06-22T09:12:37.578Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"yesterday bleakly sheathe yawningly tinted untrue\"),\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Prices: []components.CheckoutProductPrices{\n components.CreateCheckoutProductPricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceCustom(\n components.LegacyRecurringProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-09-20T00:38:14.122Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-08-26T04:21:14.007Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(306316),\n MaximumAmount: polargo.Int64(264075),\n PresetAmount: polargo.Int64(930336),\n },\n ),\n ),\n components.CreateCheckoutProductPricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFixed(\n components.LegacyRecurringProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2023-08-23T23:19:11.110Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-18T05:14:02.577Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n PriceCurrency: \"<value>\",\n PriceAmount: 264823,\n },\n ),\n ),\n components.CreateCheckoutProductPricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-08-26T15:47:31.253Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-09T09:30:36.910Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeOneTime,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(865220),\n MaximumAmount: polargo.Int64(481255),\n PresetAmount: polargo.Int64(955348),\n },\n ),\n ),\n },\n Benefits: []components.BenefitBase{\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-07-07T23:56:09.903Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-09-12T11:04:17.318Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeAds,\n Description: \"knottily huzzah ick\",\n Selectable: true,\n Deletable: false,\n OrganizationID: \"<value>\",\n },\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-02-14T16:02:41.163Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-04-28T06:23:40.197Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeDiscord,\n Description: \"before inasmuch appreciate\",\n Selectable: true,\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: \"/usr/sbin\",\n MimeType: \"<value>\",\n Size: 165243,\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-06-20T00:42:56.885Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2024-06-03T23:30:54.188Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://pleasing-provider.biz\",\n },\n },\n },\n },\n Product: components.CheckoutProduct{\n CreatedAt: types.MustTimeFromString(\"2025-03-02T07:44:00.713Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-07T21:48:42.673Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"recommendation soupy tuxedo emboss unlike inscribe frankly zowie um\"),\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Prices: []components.CheckoutProductPrices{\n components.CreateCheckoutProductPricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFixed(\n components.LegacyRecurringProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2025-04-06T08:25:40.789Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-08T14:45:28.061Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n PriceCurrency: \"<value>\",\n PriceAmount: 226694,\n },\n ),\n ),\n components.CreateCheckoutProductPricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceCustom(\n components.LegacyRecurringProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-02-12T00:39:35.478Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-07T23:48:14.060Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(354986),\n MaximumAmount: polargo.Int64(540406),\n PresetAmount: polargo.Int64(860632),\n },\n ),\n ),\n },\n Benefits: []components.BenefitBase{\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2023-08-11T22:46:57.443Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-04-27T10:34:15.837Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeGithubRepository,\n Description: \"of sit jut\",\n Selectable: true,\n Deletable: false,\n OrganizationID: \"<value>\",\n },\n components.BenefitBase{\n CreatedAt: types.MustTimeFromString(\"2024-08-22T01:13:57.044Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-09-18T08:20:48.636Z\"),\n ID: \"<value>\",\n Type: components.BenefitTypeDownloadables,\n Description: \"relative curiously grim to\",\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: \"/home/user\",\n MimeType: \"<value>\",\n Size: 558866,\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-21T12:30:10.295Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2023-11-12T16:29:20.536Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://silver-contractor.org\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/usr/ports\",\n MimeType: \"<value>\",\n Size: 934999,\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-19T02:05:47.978Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-04-19T21:25:09.653Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://ashamed-platter.com\",\n },\n },\n },\n ProductPrice: components.CreateCheckoutProductPriceProductPrice(\n components.CreateProductPriceProductPriceFree(\n components.ProductPriceFree{\n CreatedAt: types.MustTimeFromString(\"2023-10-18T01:24:03.442Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-22T12:37:08.562Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateCheckoutDiscountCheckoutDiscountPercentageOnceForeverDuration(\n components.CheckoutDiscountPercentageOnceForeverDuration{\n Duration: components.DiscountDurationForever,\n Type: components.DiscountTypePercentage,\n BasisPoints: 701511,\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.CreateCustomFieldNumber(\n components.CustomFieldNumber{\n CreatedAt: types.MustTimeFromString(\"2024-08-09T11:06:23.029Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-06-16T19:14:31.857Z\"),\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: 177975,\n Required: false,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCheckbox(\n components.CustomFieldCheckbox{\n CreatedAt: types.MustTimeFromString(\"2024-10-03T20:56:21.950Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-02-02T21:51:07.680Z\"),\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: 492106,\n Required: true,\n },\n },\n CustomerMetadata: map[string]components.CustomerMetadata{\n \"key\": components.CreateCustomerMetadataInteger(\n 354923,\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/models/components\"\n\t\"github.com/polarsource/polar-go/types\"\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 Status: \"<value>\",\n Amount: 485666,\n TaxAmount: 81588,\n RefundedAmount: 605593,\n RefundedTaxAmount: 738083,\n Currency: \"Jamaican Dollar\",\n BillingReason: components.OrderBillingReasonPurchase,\n BillingAddress: &components.Address{\n Country: \"Maldives\",\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(\"2025-09-23T11:59:51.286Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-14T00:30:10.871Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.OrderCustomerMetadata{\n \"key\": components.CreateOrderCustomerMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateOrderCustomerMetadataStr(\n \"<value>\",\n ),\n \"key2\": components.CreateOrderCustomerMetadataInteger(\n 386855,\n ),\n },\n ExternalID: polargo.String(\"<id>\"),\n Email: \"[email protected]\",\n EmailVerified: false,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Hong Kong\",\n },\n TaxID: []*components.OrderCustomerTaxID{\n polargo.Pointer(components.CreateOrderCustomerTaxIDStr(\n \"no_vat\",\n )),\n polargo.Pointer(components.CreateOrderCustomerTaxIDStr(\n \"<id>\",\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 RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: true,\n IsArchived: false,\n OrganizationID: \"<value>\",\n },\n ProductPrice: components.CreateOrderProductPriceProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2025-03-27T08:15:55.821Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-11-08T15:41:27.758Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeOneTime,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(81588),\n MaximumAmount: polargo.Int64(605593),\n PresetAmount: polargo.Int64(738083),\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateOrderDiscountDiscountFixedOnceForeverDurationBase(\n components.DiscountFixedOnceForeverDurationBase{\n Duration: components.DiscountDurationRepeating,\n Type: components.DiscountTypeFixed,\n Amount: 228282,\n Currency: \"Baht\",\n CreatedAt: types.MustTimeFromString(\"2023-04-06T06:29:00.267Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-03-01T18:48:46.167Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountFixedOnceForeverDurationBaseMetadata{\n \"key\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataStr(\n \"<value>\",\n ),\n \"key2\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataStr(\n \"<value>\",\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2023-12-14T21:08:51.727Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-08-24T00:05:31.570Z\"),\n MaxRedemptions: polargo.Int64(133794),\n RedemptionsCount: 558400,\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"]["order.refunded"]["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/models/components\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.EndpointorderRefundedPost(ctx, components.WebhookOrderRefundedPayload{\n Data: components.Order{\n CreatedAt: types.MustTimeFromString(\"2023-01-02T23:38:59.363Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-02-28T12:31:35.473Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.OrderMetadata{\n \"key\": components.CreateOrderMetadataBoolean(\n true,\n ),\n \"key1\": components.CreateOrderMetadataBoolean(\n true,\n ),\n \"key2\": components.CreateOrderMetadataStr(\n \"<value>\",\n ),\n },\n Status: \"<value>\",\n Amount: 528865,\n TaxAmount: 824083,\n RefundedAmount: 158895,\n RefundedTaxAmount: 509231,\n Currency: \"US Dollar\",\n BillingReason: components.OrderBillingReasonSubscriptionUpdate,\n BillingAddress: &components.Address{\n Country: \"Mozambique\",\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-06-06T13:40:41.280Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-12-12T14:47:44.609Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.OrderCustomerMetadata{\n \"key\": components.CreateOrderCustomerMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateOrderCustomerMetadataBoolean(\n true,\n ),\n },\n ExternalID: polargo.String(\"<id>\"),\n Email: \"[email protected]\",\n EmailVerified: true,\n Name: polargo.String(\"<value>\"),\n BillingAddress: &components.Address{\n Country: \"Gabon\",\n },\n TaxID: []*components.OrderCustomerTaxID{\n polargo.Pointer(components.CreateOrderCustomerTaxIDStr(\n \"tw_vat\",\n )),\n },\n OrganizationID: \"<value>\",\n AvatarURL: \"https://authorized-planula.info/\",\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-08-20T03:33:42.720Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-01-12T20:44:44.199Z\"),\n ID: \"<value>\",\n Name: \"<value>\",\n Description: polargo.String(\"wholly till ill-fated ignite shyly timely duh\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n IsRecurring: true,\n IsArchived: true,\n OrganizationID: \"<value>\",\n },\n ProductPrice: components.CreateOrderProductPriceLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFree(\n components.LegacyRecurringProductPriceFree{\n CreatedAt: types.MustTimeFromString(\"2025-10-05T18:25:49.221Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-10-25T11:18:00.181Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateOrderDiscountDiscountFixedOnceForeverDurationBase(\n components.DiscountFixedOnceForeverDurationBase{\n Duration: components.DiscountDurationForever,\n Type: components.DiscountTypePercentage,\n Amount: 798101,\n Currency: \"UAE Dirham\",\n CreatedAt: types.MustTimeFromString(\"2023-07-31T17:16:21.805Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-19T01:36:36.664Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountFixedOnceForeverDurationBaseMetadata{\n \"key\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataInteger(\n 802290,\n ),\n \"key1\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataInteger(\n 6677,\n ),\n \"key2\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataInteger(\n 898371,\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2025-10-04T09:22:51.824Z\"),\n EndsAt: types.MustNewTimeFromString(\"2025-05-25T20:59:26.748Z\"),\n MaxRedemptions: polargo.Int64(625636),\n RedemptionsCount: 302499,\n OrganizationID: \"<value>\",\n },\n )),\n Subscription: &components.OrderSubscription{\n Metadata: map[string]components.OrderSubscriptionMetadata{\n \"key\": components.CreateOrderSubscriptionMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateOrderSubscriptionMetadataInteger(\n 434679,\n ),\n },\n CreatedAt: types.MustTimeFromString(\"2023-03-11T03:15:27.257Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-08-05T00:21:50.603Z\"),\n ID: \"<value>\",\n Amount: polargo.Int64(690659),\n Currency: polargo.String(\"Lari\"),\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n Status: components.SubscriptionStatusCanceled,\n CurrentPeriodStart: types.MustTimeFromString(\"2025-08-31T07:32:06.622Z\"),\n CurrentPeriodEnd: types.MustNewTimeFromString(\"2023-12-09T23:03:57.242Z\"),\n CancelAtPeriodEnd: false,\n CanceledAt: types.MustNewTimeFromString(\"2024-09-03T00:25:25.397Z\"),\n StartedAt: types.MustNewTimeFromString(\"2023-07-04T15:25:35.943Z\"),\n EndsAt: types.MustNewTimeFromString(\"2024-09-24T05:43:42.179Z\"),\n EndedAt: types.MustNewTimeFromString(\"2024-11-02T16:14:59.150Z\"),\n CustomerID: \"<value>\",\n ProductID: \"<value>\",\n PriceID: \"<value>\",\n DiscountID: polargo.String(\"<value>\"),\n CheckoutID: polargo.String(\"<value>\"),\n CustomerCancellationReason: components.CustomerCancellationReasonMissingFeatures.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 SubscriptionSettings: components.OrganizationSubscriptionSettings{\n AllowMultipleSubscriptions: false,\n AllowCustomerUpdates: true,\n ProrationBehavior: components.SubscriptionProrationBehaviorProrate,\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.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 SubscriptionSettings: components.OrganizationSubscriptionSettings{\n AllowMultipleSubscriptions: true,\n AllowCustomerUpdates: true,\n ProrationBehavior: components.SubscriptionProrationBehaviorInvoice,\n },\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"]["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 SubscriptionSettings: components.OrganizationSubscriptionSettings{\n AllowMultipleSubscriptions: false,\n AllowCustomerUpdates: true,\n ProrationBehavior: components.SubscriptionProrationBehaviorInvoice,\n },\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"]["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 RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: true,\n IsArchived: true,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateProductMetadataStr(\n \"<value>\",\n ),\n },\n Prices: []components.Prices{\n components.CreatePricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFixed(\n components.LegacyRecurringProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2024-04-18T23:00:14.080Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-06-07T10:26:36.077Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalYear,\n PriceCurrency: \"<value>\",\n PriceAmount: 825279,\n },\n ),\n ),\n components.CreatePricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-01-18T04:41:58.879Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-07-17T22:09:03.517Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeOneTime,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(531959),\n MaximumAmount: polargo.Int64(921348),\n PresetAmount: polargo.Int64(252153),\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitGitHubRepository(\n components.BenefitGitHubRepository{\n CreatedAt: types.MustTimeFromString(\"2024-08-06T15:43:28.424Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-08-02T16:23:05.246Z\"),\n ID: \"<value>\",\n Description: \"till quintessential boohoo slowly\",\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.CreateBenefitBenefitCustom(\n components.BenefitCustom{\n CreatedAt: types.MustTimeFromString(\"2023-01-05T01:34:43.378Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-08-14T02:06:05.446Z\"),\n ID: \"<value>\",\n Description: \"commandeer whereas what wear zowie huzzah immediately disk unbalance\",\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 components.CreateBenefitBenefitDownloadables(\n components.BenefitDownloadables{\n CreatedAt: types.MustTimeFromString(\"2023-02-01T15:40:30.914Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-19T08:49:45.995Z\"),\n ID: \"<value>\",\n Description: \"during trick recommendation goose tool cluttered present folklore quadruple safely\",\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/obj\",\n MimeType: \"<value>\",\n Size: 260470,\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-18T19:34:49.881Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2025-05-10T10:45:18.149Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://yellow-reasoning.biz/\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldText(\n components.CustomFieldText{\n CreatedAt: types.MustTimeFromString(\"2025-11-09T05:36:13.494Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-09-07T15:46:04.206Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldTextMetadata{\n \"key\": components.CreateCustomFieldTextMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldTextProperties{},\n },\n ),\n Order: 752699,\n Required: false,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2024-06-20T22:56:14.733Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-12-05T12:01:05.263Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataInteger(\n 757560,\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: 425950,\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 RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: false,\n IsArchived: true,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataInteger(\n 498845,\n ),\n },\n Prices: []components.Prices{\n components.CreatePricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFree(\n components.LegacyRecurringProductPriceFree{\n CreatedAt: types.MustTimeFromString(\"2025-06-27T06:24:22.937Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-18T13:25:32.721Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitAds(\n components.BenefitAds{\n CreatedAt: types.MustTimeFromString(\"2024-04-24T09:18:36.586Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-05T22:16:47.940Z\"),\n ID: \"<value>\",\n Description: \"abnormally fun lightly off expatiate\",\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: \"/etc/defaults\",\n MimeType: \"<value>\",\n Size: 132814,\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-04-24T09:18:36.586Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-02-12T19:04:33.442Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://kaleidoscopic-quart.name/\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/mnt\",\n MimeType: \"<value>\",\n Size: 173885,\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-01-02T06:55:06.076Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2024-08-06T03:21:47.848Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://total-pigpen.com/\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2023-01-01T15:04:33.535Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-04-09T20:24:15.645Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataBoolean(\n false,\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: 326849,\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"]["refund.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.EndpointrefundCreatedPost(ctx, components.WebhookRefundCreatedPayload{\n Data: components.Refund{\n CreatedAt: types.MustTimeFromString(\"2025-12-29T06:17:19.062Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-06-28T13:27:59.588Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.RefundMetadata{\n \"key\": components.CreateRefundMetadataStr(\n \"<value>\",\n ),\n \"key1\": components.CreateRefundMetadataBoolean(\n true,\n ),\n },\n Status: components.RefundStatusCanceled,\n Reason: components.RefundReasonFraudulent,\n Amount: 872325,\n TaxAmount: 273821,\n Currency: \"New Israeli Sheqel\",\n OrganizationID: \"<value>\",\n OrderID: \"<value>\",\n SubscriptionID: polargo.String(\"<value>\"),\n CustomerID: \"<value>\",\n RevokeBenefits: true,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}"
- target: $["paths"]["refund.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.EndpointrefundUpdatedPost(ctx, components.WebhookRefundUpdatedPayload{\n Data: components.Refund{\n CreatedAt: types.MustTimeFromString(\"2024-01-23T03:57:31.216Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-04-24T01:16:45.429Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.RefundMetadata{\n\n },\n Status: components.RefundStatusSucceeded,\n Reason: components.RefundReasonOther,\n Amount: 397442,\n TaxAmount: 509120,\n Currency: \"Rufiyaa\",\n OrganizationID: \"<value>\",\n OrderID: \"<value>\",\n SubscriptionID: polargo.String(\"<value>\"),\n CustomerID: \"<value>\",\n RevokeBenefits: false,\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 ExternalID: polargo.String(\"<id>\"),\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 polargo.Pointer(components.CreateTaxIDStr(\n \"pe_ruc\",\n )),\n polargo.Pointer(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 RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n IsRecurring: false,\n IsArchived: true,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataInteger(\n 390560,\n ),\n },\n Prices: []components.Prices{\n\n },\n Benefits: []components.Benefit{\n\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/etc/periodic\",\n MimeType: \"<value>\",\n Size: 368833,\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-18T05:20:53.809Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2025-02-15T09:26:15.001Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://scornful-flood.org\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/private/var\",\n MimeType: \"<value>\",\n Size: 135533,\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-08T01:38:58.555Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-02-13T01:11:01.495Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://small-monocle.org\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldText(\n components.CustomFieldText{\n CreatedAt: types.MustTimeFromString(\"2024-06-20T14:46:16.535Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-05-10T05:22:19.943Z\"),\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: 18363,\n Required: false,\n },\n },\n },\n Price: components.CreatePriceLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceCustom(\n components.LegacyRecurringProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-12-11T02:53:20.817Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-05T06:32:30.065Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(892672),\n MaximumAmount: polargo.Int64(126766),\n PresetAmount: polargo.Int64(790721),\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateSubscriptionDiscountDiscountPercentageRepeatDurationBase(\n components.DiscountPercentageRepeatDurationBase{\n Duration: components.DiscountDurationForever,\n DurationInMonths: 764641,\n Type: components.DiscountTypePercentage,\n BasisPoints: 267197,\n CreatedAt: types.MustTimeFromString(\"2024-10-19T13:44:20.141Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-08-30T17:40:05.617Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountPercentageRepeatDurationBaseMetadata{\n \"key\": components.CreateDiscountPercentageRepeatDurationBaseMetadataInteger(\n 275346,\n ),\n \"key1\": components.CreateDiscountPercentageRepeatDurationBaseMetadataStr(\n \"<value>\",\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2024-07-06T18:40:04.116Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-05-12T20:57:57.609Z\"),\n MaxRedemptions: polargo.Int64(365189),\n RedemptionsCount: 573023,\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 ExternalID: polargo.String(\"<id>\"),\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 polargo.Pointer(components.CreateTaxIDStr(\n \"eu_oss_vat\",\n )),\n polargo.Pointer(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 RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n IsRecurring: false,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n\n },\n Prices: []components.Prices{\n components.CreatePricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFixed(\n components.LegacyRecurringProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2024-08-22T17:07:21.257Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-08-24T04:18:58.722Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n PriceCurrency: \"<value>\",\n PriceAmount: 525988,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitLicenseKeys(\n components.BenefitLicenseKeys{\n CreatedAt: types.MustTimeFromString(\"2023-06-23T12:56:40.348Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-01-22T19:23:36.032Z\"),\n ID: \"<value>\",\n Description: \"ack ceramic outside apropos minister\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitLicenseKeysProperties{\n Prefix: polargo.String(\"<value>\"),\n Expires: &components.BenefitLicenseKeyExpirationProperties{\n TTL: 638492,\n Timeframe: components.TimeframeYear,\n },\n Activations: &components.BenefitLicenseKeyActivationProperties{\n Limit: 981882,\n EnableCustomerAdmin: false,\n },\n LimitUsage: polargo.Int64(330881),\n },\n },\n ),\n components.CreateBenefitBenefitDownloadables(\n components.BenefitDownloadables{\n CreatedAt: types.MustTimeFromString(\"2025-09-20T09:10:24.548Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-03-19T11:41:38.700Z\"),\n ID: \"<value>\",\n Description: \"rightfully ameliorate than\",\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.CreateBenefitBenefitCustom(\n components.BenefitCustom{\n CreatedAt: types.MustTimeFromString(\"2025-03-17T08:11:20.839Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-05-20T03:54:15.435Z\"),\n ID: \"<value>\",\n Description: \"abnegate rigidly solidly\",\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\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2025-02-04T09:37:38.573Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-02-20T01:06:28.646Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataInteger(\n 900549,\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: 722899,\n Required: true,\n },\n },\n },\n Price: components.CreatePriceProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2023-01-10T11:22:27.852Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-10-30T04:36:22.649Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(505653),\n MaximumAmount: polargo.Int64(641631),\n PresetAmount: polargo.Int64(817419),\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateSubscriptionDiscountDiscountPercentageRepeatDurationBase(\n components.DiscountPercentageRepeatDurationBase{\n Duration: components.DiscountDurationForever,\n DurationInMonths: 430541,\n Type: components.DiscountTypeFixed,\n BasisPoints: 609664,\n CreatedAt: types.MustTimeFromString(\"2025-06-05T02:50:38.815Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-02-01T19:29:19.952Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountPercentageRepeatDurationBaseMetadata{\n \"key\": components.CreateDiscountPercentageRepeatDurationBaseMetadataInteger(\n 817419,\n ),\n \"key1\": components.CreateDiscountPercentageRepeatDurationBaseMetadataInteger(\n 247251,\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2024-05-29T08:36:46.000Z\"),\n EndsAt: types.MustNewTimeFromString(\"2025-10-18T20:11:55.955Z\"),\n MaxRedemptions: polargo.Int64(132079),\n RedemptionsCount: 69009,\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 ExternalID: polargo.String(\"<id>\"),\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 polargo.Pointer(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 RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: false,\n IsArchived: true,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataStr(\n \"<value>\",\n ),\n },\n Prices: []components.Prices{\n components.CreatePricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2025-11-21T06:18:56.937Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-31T02:17:16.458Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeOneTime,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(580222),\n MaximumAmount: polargo.Int64(825642),\n PresetAmount: polargo.Int64(388665),\n },\n ),\n ),\n components.CreatePricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2023-06-28T18:52:35.046Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-08-27T23:16:18.790Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeOneTime,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(700179),\n MaximumAmount: polargo.Int64(391483),\n PresetAmount: polargo.Int64(382414),\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitAds(\n components.BenefitAds{\n CreatedAt: types.MustTimeFromString(\"2023-06-08T13:24:23.215Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-04-26T06:50:11.633Z\"),\n ID: \"<value>\",\n Description: \"phew underneath ugh barring\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitAdsProperties{},\n },\n ),\n components.CreateBenefitBenefitLicenseKeys(\n components.BenefitLicenseKeys{\n CreatedAt: types.MustTimeFromString(\"2025-10-12T19:22:25.442Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-09-06T17:58:23.098Z\"),\n ID: \"<value>\",\n Description: \"when unearth toaster pillbox about querulous\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitLicenseKeysProperties{\n Prefix: polargo.String(\"<value>\"),\n Expires: &components.BenefitLicenseKeyExpirationProperties{\n TTL: 580262,\n Timeframe: components.TimeframeMonth,\n },\n Activations: &components.BenefitLicenseKeyActivationProperties{\n Limit: 660061,\n EnableCustomerAdmin: false,\n },\n LimitUsage: polargo.Int64(339490),\n },\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/usr/share\",\n MimeType: \"<value>\",\n Size: 586409,\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-08-31T15:18:05.996Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2024-01-15T17:54:00.133Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://moist-hydrocarbon.info/\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/etc/defaults\",\n MimeType: \"<value>\",\n Size: 914697,\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-03T04:55:47.377Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-03-13T02:22:01.631Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://stormy-sock.net\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/lib\",\n MimeType: \"<value>\",\n Size: 179605,\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-05-17T17:16:41.803Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2025-06-21T23:06:39.354Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://animated-vicinity.info/\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldDate(\n components.CustomFieldDate{\n CreatedAt: types.MustTimeFromString(\"2024-05-19T18:03:19.817Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-07-24T18:34:19.421Z\"),\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: 388741,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldNumber(\n components.CustomFieldNumber{\n CreatedAt: types.MustTimeFromString(\"2025-05-07T13:44:00.705Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-11-21T11:37:28.520Z\"),\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: 287379,\n Required: false,\n },\n },\n },\n Price: components.CreatePriceProductPrice(\n components.CreateProductPriceProductPriceFixed(\n components.ProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2023-06-21T10:25:06.367Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-11-11T23:13:22.856Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n PriceCurrency: \"<value>\",\n PriceAmount: 800332,\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateSubscriptionDiscountDiscountPercentageRepeatDurationBase(\n components.DiscountPercentageRepeatDurationBase{\n Duration: components.DiscountDurationForever,\n DurationInMonths: 181099,\n Type: components.DiscountTypePercentage,\n BasisPoints: 476081,\n CreatedAt: types.MustTimeFromString(\"2024-08-19T11:00:20.002Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-01T07:02:24.223Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountPercentageRepeatDurationBaseMetadata{\n\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2025-07-01T06:15:52.967Z\"),\n EndsAt: types.MustNewTimeFromString(\"2025-03-29T17:45:51.057Z\"),\n MaxRedemptions: polargo.Int64(700007),\n RedemptionsCount: 24340,\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 ExternalID: polargo.String(\"<id>\"),\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\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 RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: false,\n IsArchived: true,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataBoolean(\n true,\n ),\n \"key1\": components.CreateProductMetadataBoolean(\n false,\n ),\n },\n Prices: []components.Prices{\n components.CreatePricesProductPrice(\n components.CreateProductPriceProductPriceFixed(\n components.ProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2024-10-17T16:46:10.227Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-03-12T15:50:00.264Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n PriceCurrency: \"<value>\",\n PriceAmount: 812657,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitGitHubRepository(\n components.BenefitGitHubRepository{\n CreatedAt: types.MustTimeFromString(\"2025-03-26T22:16:05.821Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-09-27T16:23:43.110Z\"),\n ID: \"<value>\",\n Description: \"as phew psst bitterly\",\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.CreateBenefitBenefitAds(\n components.BenefitAds{\n CreatedAt: types.MustTimeFromString(\"2023-05-20T15:08:40.297Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-20T18:07:31.855Z\"),\n ID: \"<value>\",\n Description: \"amongst until absent even\",\n Selectable: false,\n Deletable: false,\n OrganizationID: \"<value>\",\n Properties: components.BenefitAdsProperties{},\n },\n ),\n },\n Medias: []components.ProductMediaFileRead{\n\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2023-07-10T13:02:53.009Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-06-21T21:36:29.038Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataBoolean(\n false,\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: 679852,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldCheckbox(\n components.CustomFieldCheckbox{\n CreatedAt: types.MustTimeFromString(\"2024-08-04T01:33:08.166Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-01-04T02:19:46.902Z\"),\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: 63475,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldText(\n components.CustomFieldText{\n CreatedAt: types.MustTimeFromString(\"2025-01-29T23:50:59.422Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-02-16T23:24:58.135Z\"),\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: 436843,\n Required: true,\n },\n },\n },\n Price: components.CreatePriceLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFixed(\n components.LegacyRecurringProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2025-06-29T00:07:52.093Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-03-26T22:10:02.657Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n PriceCurrency: \"<value>\",\n PriceAmount: 580218,\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateSubscriptionDiscountDiscountFixedOnceForeverDurationBase(\n components.DiscountFixedOnceForeverDurationBase{\n Duration: components.DiscountDurationForever,\n Type: components.DiscountTypeFixed,\n Amount: 80847,\n Currency: \"Leone\",\n CreatedAt: types.MustTimeFromString(\"2024-10-04T15:58:28.010Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-10-23T10:13:26.881Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountFixedOnceForeverDurationBaseMetadata{\n \"key\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataInteger(\n 156123,\n ),\n \"key1\": components.CreateDiscountFixedOnceForeverDurationBaseMetadataStr(\n \"<value>\",\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2024-01-03T19:38:21.378Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-06-25T15:31:04.595Z\"),\n MaxRedemptions: polargo.Int64(915224),\n RedemptionsCount: 505961,\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 ExternalID: polargo.String(\"<id>\"),\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 polargo.Pointer(components.CreateTaxIDStr(\n \"us_ein\",\n )),\n polargo.Pointer(components.CreateTaxIDStr(\n \"jp_trn\",\n )),\n polargo.Pointer(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 RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n IsRecurring: false,\n IsArchived: true,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n \"key\": components.CreateProductMetadataBoolean(\n true,\n ),\n \"key1\": components.CreateProductMetadataInteger(\n 126221,\n ),\n \"key2\": components.CreateProductMetadataStr(\n \"<value>\",\n ),\n },\n Prices: []components.Prices{\n\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitDiscord(\n components.BenefitDiscord{\n CreatedAt: types.MustTimeFromString(\"2023-08-12T07:17:32.104Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-11-08T10:21:05.522Z\"),\n ID: \"<value>\",\n Description: \"coal bah fax midst tray oh minor boom\",\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: \"/usr/src\",\n MimeType: \"<value>\",\n Size: 297045,\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-10-31T23:41:23.146Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2025-09-28T06:56:53.284Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://quarrelsome-cauliflower.com/\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/var/spool\",\n MimeType: \"<value>\",\n Size: 364012,\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-12-04T23:56:43.538Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-05-30T06:21:31.559Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://illiterate-airline.org/\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/usr/include\",\n MimeType: \"<value>\",\n Size: 597598,\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-18T04:43:20.642Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-04-29T23:28:30.708Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://ugly-unique.name\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldNumber(\n components.CustomFieldNumber{\n CreatedAt: types.MustTimeFromString(\"2023-07-25T18:33:49.249Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-05-16T15:11:49.398Z\"),\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: 756036,\n Required: true,\n },\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldSelect(\n components.CustomFieldSelect{\n CreatedAt: types.MustTimeFromString(\"2025-07-18T17:46:04.263Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-06-03T22:25:12.163Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldSelectMetadata{\n \"key\": components.CreateCustomFieldSelectMetadataBoolean(\n false,\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: 123447,\n Required: true,\n },\n },\n },\n Price: components.CreatePriceProductPrice(\n components.CreateProductPriceProductPriceFixed(\n components.ProductPriceFixed{\n CreatedAt: types.MustTimeFromString(\"2023-04-16T12:10:13.074Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-01-10T20:00:53.719Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeOneTime,\n RecurringInterval: components.SubscriptionRecurringIntervalYear.ToPointer(),\n PriceCurrency: \"<value>\",\n PriceAmount: 920569,\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateSubscriptionDiscountDiscountFixedRepeatDurationBase(\n components.DiscountFixedRepeatDurationBase{\n Duration: components.DiscountDurationOnce,\n DurationInMonths: 124703,\n Type: components.DiscountTypeFixed,\n Amount: 999504,\n Currency: \"Kina\",\n CreatedAt: types.MustTimeFromString(\"2025-06-23T01:13:00.462Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-12-24T01:11:49.705Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountFixedRepeatDurationBaseMetadata{\n \"key\": components.CreateDiscountFixedRepeatDurationBaseMetadataBoolean(\n false,\n ),\n \"key1\": components.CreateDiscountFixedRepeatDurationBaseMetadataStr(\n \"<value>\",\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2025-11-14T22:48:21.529Z\"),\n EndsAt: types.MustNewTimeFromString(\"2023-01-05T01:25:46.479Z\"),\n MaxRedemptions: polargo.Int64(140123),\n RedemptionsCount: 513004,\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 ExternalID: polargo.String(\"<id>\"),\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 polargo.Pointer(components.CreateTaxIDStr(\n \"mx_rfc\",\n )),\n polargo.Pointer(components.CreateTaxIDStr(\n \"gb_vat\",\n )),\n polargo.Pointer(components.CreateTaxIDStr(\n \"<id>\",\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 RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n IsRecurring: false,\n IsArchived: false,\n OrganizationID: \"<value>\",\n Metadata: map[string]components.ProductMetadata{\n\n },\n Prices: []components.Prices{\n components.CreatePricesProductPrice(\n components.CreateProductPriceProductPriceCustom(\n components.ProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2024-11-19T13:24:54.810Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-12-31T04:45:00.027Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n Type: components.ProductPriceTypeRecurring,\n RecurringInterval: components.SubscriptionRecurringIntervalMonth.ToPointer(),\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(172538),\n MaximumAmount: polargo.Int64(66044),\n PresetAmount: polargo.Int64(838500),\n },\n ),\n ),\n components.CreatePricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceCustom(\n components.LegacyRecurringProductPriceCustom{\n CreatedAt: types.MustTimeFromString(\"2025-05-30T13:10:48.001Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-12-12T00:26:44.150Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n PriceCurrency: \"<value>\",\n MinimumAmount: polargo.Int64(902240),\n MaximumAmount: polargo.Int64(199966),\n PresetAmount: polargo.Int64(75695),\n },\n ),\n ),\n components.CreatePricesLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFree(\n components.LegacyRecurringProductPriceFree{\n CreatedAt: types.MustTimeFromString(\"2024-06-22T20:54:57.375Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-06-18T15:11:45.647Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n ),\n },\n Benefits: []components.Benefit{\n components.CreateBenefitBenefitDownloadables(\n components.BenefitDownloadables{\n CreatedAt: types.MustTimeFromString(\"2024-01-15T19:30:57.749Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2025-10-03T06:31:47.366Z\"),\n ID: \"<value>\",\n Description: \"mid solvency woot\",\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.CreateBenefitBenefitCustom(\n components.BenefitCustom{\n CreatedAt: types.MustTimeFromString(\"2024-09-26T10:52:31.232Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-10-22T00:38:08.110Z\"),\n ID: \"<value>\",\n Description: \"knife bug silently stigmatize valuable if shyly litter\",\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: \"/etc/periodic\",\n MimeType: \"<value>\",\n Size: 982857,\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-10T04:34:23.991Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2023-09-24T05:10:51.411Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://gaseous-scorpion.net\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/bin\",\n MimeType: \"<value>\",\n Size: 900741,\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-03T14:50:28.387Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: true,\n CreatedAt: types.MustTimeFromString(\"2025-03-17T21:34:29.382Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://fatal-adrenalin.org\",\n },\n components.ProductMediaFileRead{\n ID: \"<value>\",\n OrganizationID: \"<value>\",\n Name: \"<value>\",\n Path: \"/private/tmp\",\n MimeType: \"<value>\",\n Size: 964994,\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-08-02T02:45:10.380Z\"),\n Version: polargo.String(\"<value>\"),\n IsUploaded: false,\n CreatedAt: types.MustTimeFromString(\"2025-04-01T15:44:20.788Z\"),\n SizeReadable: \"<value>\",\n PublicURL: \"https://bruised-bid.net/\",\n },\n },\n AttachedCustomFields: []components.AttachedCustomField{\n components.AttachedCustomField{\n CustomFieldID: \"<value>\",\n CustomField: components.CreateCustomFieldText(\n components.CustomFieldText{\n CreatedAt: types.MustTimeFromString(\"2025-04-01T15:44:20.788Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-02-27T05:29:03.456Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.CustomFieldTextMetadata{\n \"key\": components.CreateCustomFieldTextMetadataStr(\n \"<value>\",\n ),\n },\n Slug: \"<value>\",\n Name: \"<value>\",\n OrganizationID: \"<value>\",\n Properties: components.CustomFieldTextProperties{},\n },\n ),\n Order: 456613,\n Required: true,\n },\n },\n },\n Price: components.CreatePriceLegacyRecurringProductPrice(\n components.CreateLegacyRecurringProductPriceFree(\n components.LegacyRecurringProductPriceFree{\n CreatedAt: types.MustTimeFromString(\"2023-12-24T01:34:51.740Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2024-07-13T05:37:01.860Z\"),\n ID: \"<value>\",\n IsArchived: false,\n ProductID: \"<value>\",\n RecurringInterval: components.SubscriptionRecurringIntervalMonth,\n },\n ),\n ),\n Discount: polargo.Pointer(components.CreateSubscriptionDiscountDiscountPercentageOnceForeverDurationBase(\n components.DiscountPercentageOnceForeverDurationBase{\n Duration: components.DiscountDurationForever,\n Type: components.DiscountTypePercentage,\n BasisPoints: 348833,\n CreatedAt: types.MustTimeFromString(\"2025-01-17T18:55:09.118Z\"),\n ModifiedAt: types.MustNewTimeFromString(\"2023-08-24T20:25:51.621Z\"),\n ID: \"<value>\",\n Metadata: map[string]components.DiscountPercentageOnceForeverDurationBaseMetadata{\n \"key\": components.CreateDiscountPercentageOnceForeverDurationBaseMetadataBoolean(\n true,\n ),\n \"key1\": components.CreateDiscountPercentageOnceForeverDurationBaseMetadataBoolean(\n false,\n ),\n },\n Name: \"<value>\",\n Code: polargo.String(\"<value>\"),\n StartsAt: types.MustNewTimeFromString(\"2023-06-05T09:14:00.691Z\"),\n EndsAt: types.MustNewTimeFromString(\"2025-02-12T07:29:32.508Z\"),\n MaxRedemptions: polargo.Int64(29535),\n RedemptionsCount: 59919,\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}"