@polar-sh/sdk 0.36.0 → 0.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +24 -19
  2. package/bin/mcp-server.js +224 -66
  3. package/bin/mcp-server.js.map +8 -8
  4. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
  5. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
  6. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js +110 -0
  7. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
  8. package/dist/commonjs/lib/config.d.ts +2 -2
  9. package/dist/commonjs/lib/config.js +2 -2
  10. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  11. package/dist/commonjs/mcp-server/server.js +1 -1
  12. package/dist/commonjs/models/components/checkout.d.ts +10 -0
  13. package/dist/commonjs/models/components/checkout.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/checkout.js +8 -0
  15. package/dist/commonjs/models/components/checkout.js.map +1 -1
  16. package/dist/commonjs/models/components/checkoutcreate.d.ts +5 -0
  17. package/dist/commonjs/models/components/checkoutcreate.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/checkoutcreate.js +4 -0
  19. package/dist/commonjs/models/components/checkoutcreate.js.map +1 -1
  20. package/dist/commonjs/models/components/checkoutpublic.d.ts +10 -0
  21. package/dist/commonjs/models/components/checkoutpublic.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/checkoutpublic.js +8 -0
  23. package/dist/commonjs/models/components/checkoutpublic.js.map +1 -1
  24. package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts +10 -0
  25. package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/checkoutpublicconfirmed.js +8 -0
  27. package/dist/commonjs/models/components/checkoutpublicconfirmed.js.map +1 -1
  28. package/dist/commonjs/models/components/checkoutupdate.d.ts +5 -0
  29. package/dist/commonjs/models/components/checkoutupdate.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/checkoutupdate.js +4 -0
  31. package/dist/commonjs/models/components/checkoutupdate.js.map +1 -1
  32. package/dist/commonjs/models/components/customercustomersession.d.ts +31 -0
  33. package/dist/commonjs/models/components/customercustomersession.d.ts.map +1 -0
  34. package/dist/commonjs/models/components/customercustomersession.js +82 -0
  35. package/dist/commonjs/models/components/customercustomersession.js.map +1 -0
  36. package/dist/commonjs/models/components/customersession.d.ts +2 -0
  37. package/dist/commonjs/models/components/customersession.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/customersession.js +4 -0
  39. package/dist/commonjs/models/components/customersession.js.map +1 -1
  40. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
  41. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js +4 -0
  43. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
  44. package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts +5 -0
  45. package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
  46. package/dist/commonjs/models/components/customersessioncustomeridcreate.js +4 -0
  47. package/dist/commonjs/models/components/customersessioncustomeridcreate.js.map +1 -1
  48. package/dist/commonjs/models/components/productcreateonetime.d.ts +44 -4
  49. package/dist/commonjs/models/components/productcreateonetime.d.ts.map +1 -1
  50. package/dist/commonjs/models/components/productcreateonetime.js +60 -20
  51. package/dist/commonjs/models/components/productcreateonetime.js.map +1 -1
  52. package/dist/commonjs/models/components/productcreaterecurring.d.ts +44 -4
  53. package/dist/commonjs/models/components/productcreaterecurring.d.ts.map +1 -1
  54. package/dist/commonjs/models/components/productcreaterecurring.js +60 -20
  55. package/dist/commonjs/models/components/productcreaterecurring.js.map +1 -1
  56. package/dist/commonjs/models/components/productupdate.d.ts +85 -4
  57. package/dist/commonjs/models/components/productupdate.d.ts.map +1 -1
  58. package/dist/commonjs/models/components/productupdate.js +117 -21
  59. package/dist/commonjs/models/components/productupdate.js.map +1 -1
  60. package/dist/commonjs/models/components/webtokenrequest.d.ts +67 -0
  61. package/dist/commonjs/models/components/webtokenrequest.d.ts.map +1 -0
  62. package/dist/commonjs/models/components/webtokenrequest.js +117 -0
  63. package/dist/commonjs/models/components/webtokenrequest.js.map +1 -0
  64. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
  65. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
  66. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js +78 -0
  67. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
  68. package/dist/commonjs/models/operations/oauth2requesttoken.d.ts +3 -2
  69. package/dist/commonjs/models/operations/oauth2requesttoken.d.ts.map +1 -1
  70. package/dist/commonjs/models/operations/oauth2requesttoken.js +3 -0
  71. package/dist/commonjs/models/operations/oauth2requesttoken.js.map +1 -1
  72. package/dist/commonjs/sdk/customerportal.d.ts +3 -0
  73. package/dist/commonjs/sdk/customerportal.d.ts.map +1 -1
  74. package/dist/commonjs/sdk/customerportal.js +4 -0
  75. package/dist/commonjs/sdk/customerportal.js.map +1 -1
  76. package/dist/commonjs/sdk/customersession.d.ts +15 -0
  77. package/dist/commonjs/sdk/customersession.d.ts.map +1 -0
  78. package/dist/commonjs/sdk/customersession.js +24 -0
  79. package/dist/commonjs/sdk/customersession.js.map +1 -0
  80. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
  81. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
  82. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js +74 -0
  83. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
  84. package/dist/esm/lib/config.d.ts +2 -2
  85. package/dist/esm/lib/config.js +2 -2
  86. package/dist/esm/mcp-server/mcp-server.js +1 -1
  87. package/dist/esm/mcp-server/server.js +1 -1
  88. package/dist/esm/models/components/checkout.d.ts +10 -0
  89. package/dist/esm/models/components/checkout.d.ts.map +1 -1
  90. package/dist/esm/models/components/checkout.js +8 -0
  91. package/dist/esm/models/components/checkout.js.map +1 -1
  92. package/dist/esm/models/components/checkoutcreate.d.ts +5 -0
  93. package/dist/esm/models/components/checkoutcreate.d.ts.map +1 -1
  94. package/dist/esm/models/components/checkoutcreate.js +4 -0
  95. package/dist/esm/models/components/checkoutcreate.js.map +1 -1
  96. package/dist/esm/models/components/checkoutpublic.d.ts +10 -0
  97. package/dist/esm/models/components/checkoutpublic.d.ts.map +1 -1
  98. package/dist/esm/models/components/checkoutpublic.js +8 -0
  99. package/dist/esm/models/components/checkoutpublic.js.map +1 -1
  100. package/dist/esm/models/components/checkoutpublicconfirmed.d.ts +10 -0
  101. package/dist/esm/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
  102. package/dist/esm/models/components/checkoutpublicconfirmed.js +8 -0
  103. package/dist/esm/models/components/checkoutpublicconfirmed.js.map +1 -1
  104. package/dist/esm/models/components/checkoutupdate.d.ts +5 -0
  105. package/dist/esm/models/components/checkoutupdate.d.ts.map +1 -1
  106. package/dist/esm/models/components/checkoutupdate.js +4 -0
  107. package/dist/esm/models/components/checkoutupdate.js.map +1 -1
  108. package/dist/esm/models/components/customercustomersession.d.ts +31 -0
  109. package/dist/esm/models/components/customercustomersession.d.ts.map +1 -0
  110. package/dist/esm/models/components/customercustomersession.js +44 -0
  111. package/dist/esm/models/components/customercustomersession.js.map +1 -0
  112. package/dist/esm/models/components/customersession.d.ts +2 -0
  113. package/dist/esm/models/components/customersession.d.ts.map +1 -1
  114. package/dist/esm/models/components/customersession.js +4 -0
  115. package/dist/esm/models/components/customersession.js.map +1 -1
  116. package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
  117. package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
  118. package/dist/esm/models/components/customersessioncustomerexternalidcreate.js +4 -0
  119. package/dist/esm/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
  120. package/dist/esm/models/components/customersessioncustomeridcreate.d.ts +5 -0
  121. package/dist/esm/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
  122. package/dist/esm/models/components/customersessioncustomeridcreate.js +4 -0
  123. package/dist/esm/models/components/customersessioncustomeridcreate.js.map +1 -1
  124. package/dist/esm/models/components/productcreateonetime.d.ts +44 -4
  125. package/dist/esm/models/components/productcreateonetime.d.ts.map +1 -1
  126. package/dist/esm/models/components/productcreateonetime.js +60 -20
  127. package/dist/esm/models/components/productcreateonetime.js.map +1 -1
  128. package/dist/esm/models/components/productcreaterecurring.d.ts +44 -4
  129. package/dist/esm/models/components/productcreaterecurring.d.ts.map +1 -1
  130. package/dist/esm/models/components/productcreaterecurring.js +60 -20
  131. package/dist/esm/models/components/productcreaterecurring.js.map +1 -1
  132. package/dist/esm/models/components/productupdate.d.ts +85 -4
  133. package/dist/esm/models/components/productupdate.d.ts.map +1 -1
  134. package/dist/esm/models/components/productupdate.js +114 -20
  135. package/dist/esm/models/components/productupdate.js.map +1 -1
  136. package/dist/esm/models/components/webtokenrequest.d.ts +67 -0
  137. package/dist/esm/models/components/webtokenrequest.d.ts.map +1 -0
  138. package/dist/esm/models/components/webtokenrequest.js +79 -0
  139. package/dist/esm/models/components/webtokenrequest.js.map +1 -0
  140. package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
  141. package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
  142. package/dist/esm/models/operations/customerportalcustomersessionintrospect.js +40 -0
  143. package/dist/esm/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
  144. package/dist/esm/models/operations/oauth2requesttoken.d.ts +3 -2
  145. package/dist/esm/models/operations/oauth2requesttoken.d.ts.map +1 -1
  146. package/dist/esm/models/operations/oauth2requesttoken.js +3 -0
  147. package/dist/esm/models/operations/oauth2requesttoken.js.map +1 -1
  148. package/dist/esm/sdk/customerportal.d.ts +3 -0
  149. package/dist/esm/sdk/customerportal.d.ts.map +1 -1
  150. package/dist/esm/sdk/customerportal.js +4 -0
  151. package/dist/esm/sdk/customerportal.js.map +1 -1
  152. package/dist/esm/sdk/customersession.d.ts +15 -0
  153. package/dist/esm/sdk/customersession.d.ts.map +1 -0
  154. package/dist/esm/sdk/customersession.js +20 -0
  155. package/dist/esm/sdk/customersession.js.map +1 -0
  156. package/docs/sdks/customersession/README.md +79 -0
  157. package/examples/package-lock.json +1 -1
  158. package/jsr.json +1 -1
  159. package/package.json +1 -1
  160. package/src/funcs/customerPortalCustomerSessionIntrospect.ts +157 -0
  161. package/src/lib/config.ts +2 -2
  162. package/src/mcp-server/mcp-server.ts +1 -1
  163. package/src/mcp-server/server.ts +1 -1
  164. package/src/models/components/checkout.ts +18 -0
  165. package/src/models/components/checkoutcreate.ts +9 -0
  166. package/src/models/components/checkoutpublic.ts +18 -0
  167. package/src/models/components/checkoutpublicconfirmed.ts +18 -0
  168. package/src/models/components/checkoutupdate.ts +9 -0
  169. package/src/models/components/customercustomersession.ts +81 -0
  170. package/src/models/components/customersession.ts +6 -0
  171. package/src/models/components/customersessioncustomerexternalidcreate.ts +9 -0
  172. package/src/models/components/customersessioncustomeridcreate.ts +9 -0
  173. package/src/models/components/productcreateonetime.ts +120 -40
  174. package/src/models/components/productcreaterecurring.ts +120 -40
  175. package/src/models/components/productupdate.ts +233 -40
  176. package/src/models/components/webtokenrequest.ts +133 -0
  177. package/src/models/operations/customerportalcustomersessionintrospect.ts +89 -0
  178. package/src/models/operations/oauth2requesttoken.ts +12 -2
  179. package/src/sdk/customerportal.ts +6 -0
  180. package/src/sdk/customersession.ts +30 -0
@@ -140,6 +140,10 @@ export type Checkout = {
140
140
  * URL where the customer will be redirected after a successful payment.
141
141
  */
142
142
  successUrl: string;
143
+ /**
144
+ * When set, a back button will be shown in the checkout to return to this URL.
145
+ */
146
+ returnUrl: string | null;
143
147
  /**
144
148
  * When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.
145
149
  */
@@ -152,6 +156,10 @@ export type Checkout = {
152
156
  * Number of seats for seat-based pricing.
153
157
  */
154
158
  seats?: number | null | undefined;
159
+ /**
160
+ * Price per seat in cents for the current seat count, based on the applicable tier. Only relevant for seat-based pricing.
161
+ */
162
+ pricePerSeat?: number | null | undefined;
155
163
  /**
156
164
  * Discount amount in cents.
157
165
  */
@@ -586,9 +594,11 @@ export const Checkout$inboundSchema: z.ZodType<
586
594
  url: z.string(),
587
595
  expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
588
596
  success_url: z.string(),
597
+ return_url: z.nullable(z.string()),
589
598
  embed_origin: z.nullable(z.string()),
590
599
  amount: z.number().int(),
591
600
  seats: z.nullable(z.number().int()).optional(),
601
+ price_per_seat: z.nullable(z.number().int()).optional(),
592
602
  discount_amount: z.number().int(),
593
603
  net_amount: z.number().int(),
594
604
  tax_amount: z.nullable(z.number().int()),
@@ -654,7 +664,9 @@ export const Checkout$inboundSchema: z.ZodType<
654
664
  "client_secret": "clientSecret",
655
665
  "expires_at": "expiresAt",
656
666
  "success_url": "successUrl",
667
+ "return_url": "returnUrl",
657
668
  "embed_origin": "embedOrigin",
669
+ "price_per_seat": "pricePerSeat",
658
670
  "discount_amount": "discountAmount",
659
671
  "net_amount": "netAmount",
660
672
  "tax_amount": "taxAmount",
@@ -707,9 +719,11 @@ export type Checkout$Outbound = {
707
719
  url: string;
708
720
  expires_at: string;
709
721
  success_url: string;
722
+ return_url: string | null;
710
723
  embed_origin: string | null;
711
724
  amount: number;
712
725
  seats?: number | null | undefined;
726
+ price_per_seat?: number | null | undefined;
713
727
  discount_amount: number;
714
728
  net_amount: number;
715
729
  tax_amount: number | null;
@@ -782,9 +796,11 @@ export const Checkout$outboundSchema: z.ZodType<
782
796
  url: z.string(),
783
797
  expiresAt: z.date().transform(v => v.toISOString()),
784
798
  successUrl: z.string(),
799
+ returnUrl: z.nullable(z.string()),
785
800
  embedOrigin: z.nullable(z.string()),
786
801
  amount: z.number().int(),
787
802
  seats: z.nullable(z.number().int()).optional(),
803
+ pricePerSeat: z.nullable(z.number().int()).optional(),
788
804
  discountAmount: z.number().int(),
789
805
  netAmount: z.number().int(),
790
806
  taxAmount: z.nullable(z.number().int()),
@@ -848,7 +864,9 @@ export const Checkout$outboundSchema: z.ZodType<
848
864
  clientSecret: "client_secret",
849
865
  expiresAt: "expires_at",
850
866
  successUrl: "success_url",
867
+ returnUrl: "return_url",
851
868
  embedOrigin: "embed_origin",
869
+ pricePerSeat: "price_per_seat",
852
870
  discountAmount: "discount_amount",
853
871
  netAmount: "net_amount",
854
872
  taxAmount: "tax_amount",
@@ -126,6 +126,10 @@ export type CheckoutCreate = {
126
126
  * URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id.
127
127
  */
128
128
  successUrl?: string | null | undefined;
129
+ /**
130
+ * When set, a back button will be shown in the checkout to return to this URL.
131
+ */
132
+ returnUrl?: string | null | undefined;
129
133
  /**
130
134
  * If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page.
131
135
  */
@@ -346,6 +350,7 @@ export const CheckoutCreate$inboundSchema: z.ZodType<
346
350
  ).optional(),
347
351
  subscription_id: z.nullable(z.string()).optional(),
348
352
  success_url: z.nullable(z.string()).optional(),
353
+ return_url: z.nullable(z.string()).optional(),
349
354
  embed_origin: z.nullable(z.string()).optional(),
350
355
  products: z.array(z.string()),
351
356
  }).transform((v) => {
@@ -368,6 +373,7 @@ export const CheckoutCreate$inboundSchema: z.ZodType<
368
373
  "customer_metadata": "customerMetadata",
369
374
  "subscription_id": "subscriptionId",
370
375
  "success_url": "successUrl",
376
+ "return_url": "returnUrl",
371
377
  "embed_origin": "embedOrigin",
372
378
  });
373
379
  });
@@ -399,6 +405,7 @@ export type CheckoutCreate$Outbound = {
399
405
  | undefined;
400
406
  subscription_id?: string | null | undefined;
401
407
  success_url?: string | null | undefined;
408
+ return_url?: string | null | undefined;
402
409
  embed_origin?: string | null | undefined;
403
410
  products: Array<string>;
404
411
  };
@@ -443,6 +450,7 @@ export const CheckoutCreate$outboundSchema: z.ZodType<
443
450
  ).optional(),
444
451
  subscriptionId: z.nullable(z.string()).optional(),
445
452
  successUrl: z.nullable(z.string()).optional(),
453
+ returnUrl: z.nullable(z.string()).optional(),
446
454
  embedOrigin: z.nullable(z.string()).optional(),
447
455
  products: z.array(z.string()),
448
456
  }).transform((v) => {
@@ -465,6 +473,7 @@ export const CheckoutCreate$outboundSchema: z.ZodType<
465
473
  customerMetadata: "customer_metadata",
466
474
  subscriptionId: "subscription_id",
467
475
  successUrl: "success_url",
476
+ returnUrl: "return_url",
468
477
  embedOrigin: "embed_origin",
469
478
  });
470
479
  });
@@ -144,6 +144,10 @@ export type CheckoutPublic = {
144
144
  * URL where the customer will be redirected after a successful payment.
145
145
  */
146
146
  successUrl: string;
147
+ /**
148
+ * When set, a back button will be shown in the checkout to return to this URL.
149
+ */
150
+ returnUrl: string | null;
147
151
  /**
148
152
  * When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.
149
153
  */
@@ -156,6 +160,10 @@ export type CheckoutPublic = {
156
160
  * Number of seats for seat-based pricing.
157
161
  */
158
162
  seats?: number | null | undefined;
163
+ /**
164
+ * Price per seat in cents for the current seat count, based on the applicable tier. Only relevant for seat-based pricing.
165
+ */
166
+ pricePerSeat?: number | null | undefined;
159
167
  /**
160
168
  * Discount amount in cents.
161
169
  */
@@ -478,9 +486,11 @@ export const CheckoutPublic$inboundSchema: z.ZodType<
478
486
  url: z.string(),
479
487
  expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
480
488
  success_url: z.string(),
489
+ return_url: z.nullable(z.string()),
481
490
  embed_origin: z.nullable(z.string()),
482
491
  amount: z.number().int(),
483
492
  seats: z.nullable(z.number().int()).optional(),
493
+ price_per_seat: z.nullable(z.number().int()).optional(),
484
494
  discount_amount: z.number().int(),
485
495
  net_amount: z.number().int(),
486
496
  tax_amount: z.nullable(z.number().int()),
@@ -536,7 +546,9 @@ export const CheckoutPublic$inboundSchema: z.ZodType<
536
546
  "client_secret": "clientSecret",
537
547
  "expires_at": "expiresAt",
538
548
  "success_url": "successUrl",
549
+ "return_url": "returnUrl",
539
550
  "embed_origin": "embedOrigin",
551
+ "price_per_seat": "pricePerSeat",
540
552
  "discount_amount": "discountAmount",
541
553
  "net_amount": "netAmount",
542
554
  "tax_amount": "taxAmount",
@@ -583,9 +595,11 @@ export type CheckoutPublic$Outbound = {
583
595
  url: string;
584
596
  expires_at: string;
585
597
  success_url: string;
598
+ return_url: string | null;
586
599
  embed_origin: string | null;
587
600
  amount: number;
588
601
  seats?: number | null | undefined;
602
+ price_per_seat?: number | null | undefined;
589
603
  discount_amount: number;
590
604
  net_amount: number;
591
605
  tax_amount: number | null;
@@ -652,9 +666,11 @@ export const CheckoutPublic$outboundSchema: z.ZodType<
652
666
  url: z.string(),
653
667
  expiresAt: z.date().transform(v => v.toISOString()),
654
668
  successUrl: z.string(),
669
+ returnUrl: z.nullable(z.string()),
655
670
  embedOrigin: z.nullable(z.string()),
656
671
  amount: z.number().int(),
657
672
  seats: z.nullable(z.number().int()).optional(),
673
+ pricePerSeat: z.nullable(z.number().int()).optional(),
658
674
  discountAmount: z.number().int(),
659
675
  netAmount: z.number().int(),
660
676
  taxAmount: z.nullable(z.number().int()),
@@ -708,7 +724,9 @@ export const CheckoutPublic$outboundSchema: z.ZodType<
708
724
  clientSecret: "client_secret",
709
725
  expiresAt: "expires_at",
710
726
  successUrl: "success_url",
727
+ returnUrl: "return_url",
711
728
  embedOrigin: "embed_origin",
729
+ pricePerSeat: "price_per_seat",
712
730
  discountAmount: "discount_amount",
713
731
  netAmount: "net_amount",
714
732
  taxAmount: "tax_amount",
@@ -148,6 +148,10 @@ export type CheckoutPublicConfirmed = {
148
148
  * URL where the customer will be redirected after a successful payment.
149
149
  */
150
150
  successUrl: string;
151
+ /**
152
+ * When set, a back button will be shown in the checkout to return to this URL.
153
+ */
154
+ returnUrl: string | null;
151
155
  /**
152
156
  * When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.
153
157
  */
@@ -160,6 +164,10 @@ export type CheckoutPublicConfirmed = {
160
164
  * Number of seats for seat-based pricing.
161
165
  */
162
166
  seats?: number | null | undefined;
167
+ /**
168
+ * Price per seat in cents for the current seat count, based on the applicable tier. Only relevant for seat-based pricing.
169
+ */
170
+ pricePerSeat?: number | null | undefined;
163
171
  /**
164
172
  * Discount amount in cents.
165
173
  */
@@ -494,9 +502,11 @@ export const CheckoutPublicConfirmed$inboundSchema: z.ZodType<
494
502
  url: z.string(),
495
503
  expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
496
504
  success_url: z.string(),
505
+ return_url: z.nullable(z.string()),
497
506
  embed_origin: z.nullable(z.string()),
498
507
  amount: z.number().int(),
499
508
  seats: z.nullable(z.number().int()).optional(),
509
+ price_per_seat: z.nullable(z.number().int()).optional(),
500
510
  discount_amount: z.number().int(),
501
511
  net_amount: z.number().int(),
502
512
  tax_amount: z.nullable(z.number().int()),
@@ -553,7 +563,9 @@ export const CheckoutPublicConfirmed$inboundSchema: z.ZodType<
553
563
  "client_secret": "clientSecret",
554
564
  "expires_at": "expiresAt",
555
565
  "success_url": "successUrl",
566
+ "return_url": "returnUrl",
556
567
  "embed_origin": "embedOrigin",
568
+ "price_per_seat": "pricePerSeat",
557
569
  "discount_amount": "discountAmount",
558
570
  "net_amount": "netAmount",
559
571
  "tax_amount": "taxAmount",
@@ -601,9 +613,11 @@ export type CheckoutPublicConfirmed$Outbound = {
601
613
  url: string;
602
614
  expires_at: string;
603
615
  success_url: string;
616
+ return_url: string | null;
604
617
  embed_origin: string | null;
605
618
  amount: number;
606
619
  seats?: number | null | undefined;
620
+ price_per_seat?: number | null | undefined;
607
621
  discount_amount: number;
608
622
  net_amount: number;
609
623
  tax_amount: number | null;
@@ -671,9 +685,11 @@ export const CheckoutPublicConfirmed$outboundSchema: z.ZodType<
671
685
  url: z.string(),
672
686
  expiresAt: z.date().transform(v => v.toISOString()),
673
687
  successUrl: z.string(),
688
+ returnUrl: z.nullable(z.string()),
674
689
  embedOrigin: z.nullable(z.string()),
675
690
  amount: z.number().int(),
676
691
  seats: z.nullable(z.number().int()).optional(),
692
+ pricePerSeat: z.nullable(z.number().int()).optional(),
677
693
  discountAmount: z.number().int(),
678
694
  netAmount: z.number().int(),
679
695
  taxAmount: z.nullable(z.number().int()),
@@ -728,7 +744,9 @@ export const CheckoutPublicConfirmed$outboundSchema: z.ZodType<
728
744
  clientSecret: "client_secret",
729
745
  expiresAt: "expires_at",
730
746
  successUrl: "success_url",
747
+ returnUrl: "return_url",
731
748
  embedOrigin: "embed_origin",
749
+ pricePerSeat: "price_per_seat",
732
750
  discountAmount: "discount_amount",
733
751
  netAmount: "net_amount",
734
752
  taxAmount: "tax_amount",
@@ -116,6 +116,10 @@ export type CheckoutUpdate = {
116
116
  * URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id.
117
117
  */
118
118
  successUrl?: string | null | undefined;
119
+ /**
120
+ * When set, a back button will be shown in the checkout to return to this URL.
121
+ */
122
+ returnUrl?: string | null | undefined;
119
123
  /**
120
124
  * If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page.
121
125
  */
@@ -331,6 +335,7 @@ export const CheckoutUpdate$inboundSchema: z.ZodType<
331
335
  z.record(z.union([z.string(), z.number().int(), z.number(), z.boolean()])),
332
336
  ).optional(),
333
337
  success_url: z.nullable(z.string()).optional(),
338
+ return_url: z.nullable(z.string()).optional(),
334
339
  embed_origin: z.nullable(z.string()).optional(),
335
340
  }).transform((v) => {
336
341
  return remap$(v, {
@@ -351,6 +356,7 @@ export const CheckoutUpdate$inboundSchema: z.ZodType<
351
356
  "customer_ip_address": "customerIpAddress",
352
357
  "customer_metadata": "customerMetadata",
353
358
  "success_url": "successUrl",
359
+ "return_url": "returnUrl",
354
360
  "embed_origin": "embedOrigin",
355
361
  });
356
362
  });
@@ -382,6 +388,7 @@ export type CheckoutUpdate$Outbound = {
382
388
  | null
383
389
  | undefined;
384
390
  success_url?: string | null | undefined;
391
+ return_url?: string | null | undefined;
385
392
  embed_origin?: string | null | undefined;
386
393
  };
387
394
 
@@ -424,6 +431,7 @@ export const CheckoutUpdate$outboundSchema: z.ZodType<
424
431
  z.record(z.union([z.string(), z.number().int(), z.number(), z.boolean()])),
425
432
  ).optional(),
426
433
  successUrl: z.nullable(z.string()).optional(),
434
+ returnUrl: z.nullable(z.string()).optional(),
427
435
  embedOrigin: z.nullable(z.string()).optional(),
428
436
  }).transform((v) => {
429
437
  return remap$(v, {
@@ -444,6 +452,7 @@ export const CheckoutUpdate$outboundSchema: z.ZodType<
444
452
  customerIpAddress: "customer_ip_address",
445
453
  customerMetadata: "customer_metadata",
446
454
  successUrl: "success_url",
455
+ returnUrl: "return_url",
447
456
  embedOrigin: "embed_origin",
448
457
  });
449
458
  });
@@ -0,0 +1,81 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type CustomerCustomerSession = {
12
+ expiresAt: Date;
13
+ returnUrl: string | null;
14
+ };
15
+
16
+ /** @internal */
17
+ export const CustomerCustomerSession$inboundSchema: z.ZodType<
18
+ CustomerCustomerSession,
19
+ z.ZodTypeDef,
20
+ unknown
21
+ > = z.object({
22
+ expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
23
+ return_url: z.nullable(z.string()),
24
+ }).transform((v) => {
25
+ return remap$(v, {
26
+ "expires_at": "expiresAt",
27
+ "return_url": "returnUrl",
28
+ });
29
+ });
30
+
31
+ /** @internal */
32
+ export type CustomerCustomerSession$Outbound = {
33
+ expires_at: string;
34
+ return_url: string | null;
35
+ };
36
+
37
+ /** @internal */
38
+ export const CustomerCustomerSession$outboundSchema: z.ZodType<
39
+ CustomerCustomerSession$Outbound,
40
+ z.ZodTypeDef,
41
+ CustomerCustomerSession
42
+ > = z.object({
43
+ expiresAt: z.date().transform(v => v.toISOString()),
44
+ returnUrl: z.nullable(z.string()),
45
+ }).transform((v) => {
46
+ return remap$(v, {
47
+ expiresAt: "expires_at",
48
+ returnUrl: "return_url",
49
+ });
50
+ });
51
+
52
+ /**
53
+ * @internal
54
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
55
+ */
56
+ export namespace CustomerCustomerSession$ {
57
+ /** @deprecated use `CustomerCustomerSession$inboundSchema` instead. */
58
+ export const inboundSchema = CustomerCustomerSession$inboundSchema;
59
+ /** @deprecated use `CustomerCustomerSession$outboundSchema` instead. */
60
+ export const outboundSchema = CustomerCustomerSession$outboundSchema;
61
+ /** @deprecated use `CustomerCustomerSession$Outbound` instead. */
62
+ export type Outbound = CustomerCustomerSession$Outbound;
63
+ }
64
+
65
+ export function customerCustomerSessionToJSON(
66
+ customerCustomerSession: CustomerCustomerSession,
67
+ ): string {
68
+ return JSON.stringify(
69
+ CustomerCustomerSession$outboundSchema.parse(customerCustomerSession),
70
+ );
71
+ }
72
+
73
+ export function customerCustomerSessionFromJSON(
74
+ jsonString: string,
75
+ ): SafeParseResult<CustomerCustomerSession, SDKValidationError> {
76
+ return safeParse(
77
+ jsonString,
78
+ (x) => CustomerCustomerSession$inboundSchema.parse(JSON.parse(x)),
79
+ `Failed to parse 'CustomerCustomerSession' from JSON`,
80
+ );
81
+ }
@@ -32,6 +32,7 @@ export type CustomerSession = {
32
32
  id: string;
33
33
  token: string;
34
34
  expiresAt: Date;
35
+ returnUrl: string | null;
35
36
  customerPortalUrl: string;
36
37
  customerId: string;
37
38
  /**
@@ -53,6 +54,7 @@ export const CustomerSession$inboundSchema: z.ZodType<
53
54
  id: z.string(),
54
55
  token: z.string(),
55
56
  expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
57
+ return_url: z.nullable(z.string()),
56
58
  customer_portal_url: z.string(),
57
59
  customer_id: z.string(),
58
60
  customer: Customer$inboundSchema,
@@ -61,6 +63,7 @@ export const CustomerSession$inboundSchema: z.ZodType<
61
63
  "created_at": "createdAt",
62
64
  "modified_at": "modifiedAt",
63
65
  "expires_at": "expiresAt",
66
+ "return_url": "returnUrl",
64
67
  "customer_portal_url": "customerPortalUrl",
65
68
  "customer_id": "customerId",
66
69
  });
@@ -73,6 +76,7 @@ export type CustomerSession$Outbound = {
73
76
  id: string;
74
77
  token: string;
75
78
  expires_at: string;
79
+ return_url: string | null;
76
80
  customer_portal_url: string;
77
81
  customer_id: string;
78
82
  customer: Customer$Outbound;
@@ -89,6 +93,7 @@ export const CustomerSession$outboundSchema: z.ZodType<
89
93
  id: z.string(),
90
94
  token: z.string(),
91
95
  expiresAt: z.date().transform(v => v.toISOString()),
96
+ returnUrl: z.nullable(z.string()),
92
97
  customerPortalUrl: z.string(),
93
98
  customerId: z.string(),
94
99
  customer: Customer$outboundSchema,
@@ -97,6 +102,7 @@ export const CustomerSession$outboundSchema: z.ZodType<
97
102
  createdAt: "created_at",
98
103
  modifiedAt: "modified_at",
99
104
  expiresAt: "expires_at",
105
+ returnUrl: "return_url",
100
106
  customerPortalUrl: "customer_portal_url",
101
107
  customerId: "customer_id",
102
108
  });
@@ -12,6 +12,10 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
12
  * Schema for creating a customer session using an external customer ID.
13
13
  */
14
14
  export type CustomerSessionCustomerExternalIDCreate = {
15
+ /**
16
+ * When set, a back button will be shown in the customer portal to return to this URL.
17
+ */
18
+ returnUrl?: string | null | undefined;
15
19
  /**
16
20
  * External ID of the customer to create a session for.
17
21
  */
@@ -24,15 +28,18 @@ export const CustomerSessionCustomerExternalIDCreate$inboundSchema: z.ZodType<
24
28
  z.ZodTypeDef,
25
29
  unknown
26
30
  > = z.object({
31
+ return_url: z.nullable(z.string()).optional(),
27
32
  external_customer_id: z.string(),
28
33
  }).transform((v) => {
29
34
  return remap$(v, {
35
+ "return_url": "returnUrl",
30
36
  "external_customer_id": "externalCustomerId",
31
37
  });
32
38
  });
33
39
 
34
40
  /** @internal */
35
41
  export type CustomerSessionCustomerExternalIDCreate$Outbound = {
42
+ return_url?: string | null | undefined;
36
43
  external_customer_id: string;
37
44
  };
38
45
 
@@ -42,9 +49,11 @@ export const CustomerSessionCustomerExternalIDCreate$outboundSchema: z.ZodType<
42
49
  z.ZodTypeDef,
43
50
  CustomerSessionCustomerExternalIDCreate
44
51
  > = z.object({
52
+ returnUrl: z.nullable(z.string()).optional(),
45
53
  externalCustomerId: z.string(),
46
54
  }).transform((v) => {
47
55
  return remap$(v, {
56
+ returnUrl: "return_url",
48
57
  externalCustomerId: "external_customer_id",
49
58
  });
50
59
  });
@@ -12,6 +12,10 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
12
  * Schema for creating a customer session using a customer ID.
13
13
  */
14
14
  export type CustomerSessionCustomerIDCreate = {
15
+ /**
16
+ * When set, a back button will be shown in the customer portal to return to this URL.
17
+ */
18
+ returnUrl?: string | null | undefined;
15
19
  /**
16
20
  * ID of the customer to create a session for.
17
21
  */
@@ -24,15 +28,18 @@ export const CustomerSessionCustomerIDCreate$inboundSchema: z.ZodType<
24
28
  z.ZodTypeDef,
25
29
  unknown
26
30
  > = z.object({
31
+ return_url: z.nullable(z.string()).optional(),
27
32
  customer_id: z.string(),
28
33
  }).transform((v) => {
29
34
  return remap$(v, {
35
+ "return_url": "returnUrl",
30
36
  "customer_id": "customerId",
31
37
  });
32
38
  });
33
39
 
34
40
  /** @internal */
35
41
  export type CustomerSessionCustomerIDCreate$Outbound = {
42
+ return_url?: string | null | undefined;
36
43
  customer_id: string;
37
44
  };
38
45
 
@@ -42,9 +49,11 @@ export const CustomerSessionCustomerIDCreate$outboundSchema: z.ZodType<
42
49
  z.ZodTypeDef,
43
50
  CustomerSessionCustomerIDCreate
44
51
  > = z.object({
52
+ returnUrl: z.nullable(z.string()).optional(),
45
53
  customerId: z.string(),
46
54
  }).transform((v) => {
47
55
  return remap$(v, {
56
+ returnUrl: "return_url",
48
57
  customerId: "customer_id",
49
58
  });
50
59
  });