@polar-sh/sdk 0.40.3 → 0.41.0

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 (244) hide show
  1. package/README.md +1 -1
  2. package/dist/commonjs/funcs/eventsList.js +1 -0
  3. package/dist/commonjs/funcs/eventsList.js.map +1 -1
  4. package/dist/commonjs/lib/config.d.ts +3 -3
  5. package/dist/commonjs/lib/config.js +3 -3
  6. package/dist/commonjs/models/components/benefitcycledevent.d.ts +5 -0
  7. package/dist/commonjs/models/components/benefitcycledevent.d.ts.map +1 -1
  8. package/dist/commonjs/models/components/benefitcycledevent.js +4 -0
  9. package/dist/commonjs/models/components/benefitcycledevent.js.map +1 -1
  10. package/dist/commonjs/models/components/benefitgrantedevent.d.ts +5 -0
  11. package/dist/commonjs/models/components/benefitgrantedevent.d.ts.map +1 -1
  12. package/dist/commonjs/models/components/benefitgrantedevent.js +4 -0
  13. package/dist/commonjs/models/components/benefitgrantedevent.js.map +1 -1
  14. package/dist/commonjs/models/components/benefitrevokedevent.d.ts +5 -0
  15. package/dist/commonjs/models/components/benefitrevokedevent.d.ts.map +1 -1
  16. package/dist/commonjs/models/components/benefitrevokedevent.js +4 -0
  17. package/dist/commonjs/models/components/benefitrevokedevent.js.map +1 -1
  18. package/dist/commonjs/models/components/benefitupdatedevent.d.ts +5 -0
  19. package/dist/commonjs/models/components/benefitupdatedevent.d.ts.map +1 -1
  20. package/dist/commonjs/models/components/benefitupdatedevent.js +4 -0
  21. package/dist/commonjs/models/components/benefitupdatedevent.js.map +1 -1
  22. package/dist/commonjs/models/components/customercreate.d.ts +0 -3
  23. package/dist/commonjs/models/components/customercreate.d.ts.map +1 -1
  24. package/dist/commonjs/models/components/customercreate.js.map +1 -1
  25. package/dist/commonjs/models/components/customercreatedevent.d.ts +5 -0
  26. package/dist/commonjs/models/components/customercreatedevent.d.ts.map +1 -1
  27. package/dist/commonjs/models/components/customercreatedevent.js +4 -0
  28. package/dist/commonjs/models/components/customercreatedevent.js.map +1 -1
  29. package/dist/commonjs/models/components/customerdeletedevent.d.ts +5 -0
  30. package/dist/commonjs/models/components/customerdeletedevent.d.ts.map +1 -1
  31. package/dist/commonjs/models/components/customerdeletedevent.js +4 -0
  32. package/dist/commonjs/models/components/customerdeletedevent.js.map +1 -1
  33. package/dist/commonjs/models/components/customerupdate.d.ts +0 -3
  34. package/dist/commonjs/models/components/customerupdate.d.ts.map +1 -1
  35. package/dist/commonjs/models/components/customerupdate.js.map +1 -1
  36. package/dist/commonjs/models/components/customerupdatedevent.d.ts +5 -0
  37. package/dist/commonjs/models/components/customerupdatedevent.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/customerupdatedevent.js +4 -0
  39. package/dist/commonjs/models/components/customerupdatedevent.js.map +1 -1
  40. package/dist/commonjs/models/components/customerupdateexternalid.d.ts +0 -3
  41. package/dist/commonjs/models/components/customerupdateexternalid.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/customerupdateexternalid.js.map +1 -1
  43. package/dist/commonjs/models/components/eventcreatecustomer.d.ts +10 -0
  44. package/dist/commonjs/models/components/eventcreatecustomer.d.ts.map +1 -1
  45. package/dist/commonjs/models/components/eventcreatecustomer.js +8 -0
  46. package/dist/commonjs/models/components/eventcreatecustomer.js.map +1 -1
  47. package/dist/commonjs/models/components/eventcreateexternalcustomer.d.ts +10 -0
  48. package/dist/commonjs/models/components/eventcreateexternalcustomer.d.ts.map +1 -1
  49. package/dist/commonjs/models/components/eventcreateexternalcustomer.js +8 -0
  50. package/dist/commonjs/models/components/eventcreateexternalcustomer.js.map +1 -1
  51. package/dist/commonjs/models/components/eventsingestresponse.d.ts +5 -0
  52. package/dist/commonjs/models/components/eventsingestresponse.d.ts.map +1 -1
  53. package/dist/commonjs/models/components/eventsingestresponse.js +2 -0
  54. package/dist/commonjs/models/components/eventsingestresponse.js.map +1 -1
  55. package/dist/commonjs/models/components/metercreditevent.d.ts +5 -0
  56. package/dist/commonjs/models/components/metercreditevent.d.ts.map +1 -1
  57. package/dist/commonjs/models/components/metercreditevent.js +4 -0
  58. package/dist/commonjs/models/components/metercreditevent.js.map +1 -1
  59. package/dist/commonjs/models/components/meterresetevent.d.ts +5 -0
  60. package/dist/commonjs/models/components/meterresetevent.d.ts.map +1 -1
  61. package/dist/commonjs/models/components/meterresetevent.js +4 -0
  62. package/dist/commonjs/models/components/meterresetevent.js.map +1 -1
  63. package/dist/commonjs/models/components/orderpaidevent.d.ts +5 -0
  64. package/dist/commonjs/models/components/orderpaidevent.d.ts.map +1 -1
  65. package/dist/commonjs/models/components/orderpaidevent.js +4 -0
  66. package/dist/commonjs/models/components/orderpaidevent.js.map +1 -1
  67. package/dist/commonjs/models/components/orderrefundedevent.d.ts +5 -0
  68. package/dist/commonjs/models/components/orderrefundedevent.d.ts.map +1 -1
  69. package/dist/commonjs/models/components/orderrefundedevent.js +4 -0
  70. package/dist/commonjs/models/components/orderrefundedevent.js.map +1 -1
  71. package/dist/commonjs/models/components/subscriptioncycledevent.d.ts +5 -0
  72. package/dist/commonjs/models/components/subscriptioncycledevent.d.ts.map +1 -1
  73. package/dist/commonjs/models/components/subscriptioncycledevent.js +4 -0
  74. package/dist/commonjs/models/components/subscriptioncycledevent.js.map +1 -1
  75. package/dist/commonjs/models/components/subscriptionproductupdatedevent.d.ts +5 -0
  76. package/dist/commonjs/models/components/subscriptionproductupdatedevent.d.ts.map +1 -1
  77. package/dist/commonjs/models/components/subscriptionproductupdatedevent.js +4 -0
  78. package/dist/commonjs/models/components/subscriptionproductupdatedevent.js.map +1 -1
  79. package/dist/commonjs/models/components/subscriptionrevokedevent.d.ts +5 -0
  80. package/dist/commonjs/models/components/subscriptionrevokedevent.d.ts.map +1 -1
  81. package/dist/commonjs/models/components/subscriptionrevokedevent.js +4 -0
  82. package/dist/commonjs/models/components/subscriptionrevokedevent.js.map +1 -1
  83. package/dist/commonjs/models/components/userevent.d.ts +5 -0
  84. package/dist/commonjs/models/components/userevent.d.ts.map +1 -1
  85. package/dist/commonjs/models/components/userevent.js +4 -0
  86. package/dist/commonjs/models/components/userevent.js.map +1 -1
  87. package/dist/commonjs/models/operations/eventslist.d.ts +5 -0
  88. package/dist/commonjs/models/operations/eventslist.d.ts.map +1 -1
  89. package/dist/commonjs/models/operations/eventslist.js +4 -0
  90. package/dist/commonjs/models/operations/eventslist.js.map +1 -1
  91. package/dist/esm/funcs/eventsList.js +1 -0
  92. package/dist/esm/funcs/eventsList.js.map +1 -1
  93. package/dist/esm/lib/config.d.ts +3 -3
  94. package/dist/esm/lib/config.js +3 -3
  95. package/dist/esm/models/components/benefitcycledevent.d.ts +5 -0
  96. package/dist/esm/models/components/benefitcycledevent.d.ts.map +1 -1
  97. package/dist/esm/models/components/benefitcycledevent.js +4 -0
  98. package/dist/esm/models/components/benefitcycledevent.js.map +1 -1
  99. package/dist/esm/models/components/benefitgrantedevent.d.ts +5 -0
  100. package/dist/esm/models/components/benefitgrantedevent.d.ts.map +1 -1
  101. package/dist/esm/models/components/benefitgrantedevent.js +4 -0
  102. package/dist/esm/models/components/benefitgrantedevent.js.map +1 -1
  103. package/dist/esm/models/components/benefitrevokedevent.d.ts +5 -0
  104. package/dist/esm/models/components/benefitrevokedevent.d.ts.map +1 -1
  105. package/dist/esm/models/components/benefitrevokedevent.js +4 -0
  106. package/dist/esm/models/components/benefitrevokedevent.js.map +1 -1
  107. package/dist/esm/models/components/benefitupdatedevent.d.ts +5 -0
  108. package/dist/esm/models/components/benefitupdatedevent.d.ts.map +1 -1
  109. package/dist/esm/models/components/benefitupdatedevent.js +4 -0
  110. package/dist/esm/models/components/benefitupdatedevent.js.map +1 -1
  111. package/dist/esm/models/components/customercreate.d.ts +0 -3
  112. package/dist/esm/models/components/customercreate.d.ts.map +1 -1
  113. package/dist/esm/models/components/customercreate.js.map +1 -1
  114. package/dist/esm/models/components/customercreatedevent.d.ts +5 -0
  115. package/dist/esm/models/components/customercreatedevent.d.ts.map +1 -1
  116. package/dist/esm/models/components/customercreatedevent.js +4 -0
  117. package/dist/esm/models/components/customercreatedevent.js.map +1 -1
  118. package/dist/esm/models/components/customerdeletedevent.d.ts +5 -0
  119. package/dist/esm/models/components/customerdeletedevent.d.ts.map +1 -1
  120. package/dist/esm/models/components/customerdeletedevent.js +4 -0
  121. package/dist/esm/models/components/customerdeletedevent.js.map +1 -1
  122. package/dist/esm/models/components/customerupdate.d.ts +0 -3
  123. package/dist/esm/models/components/customerupdate.d.ts.map +1 -1
  124. package/dist/esm/models/components/customerupdate.js.map +1 -1
  125. package/dist/esm/models/components/customerupdatedevent.d.ts +5 -0
  126. package/dist/esm/models/components/customerupdatedevent.d.ts.map +1 -1
  127. package/dist/esm/models/components/customerupdatedevent.js +4 -0
  128. package/dist/esm/models/components/customerupdatedevent.js.map +1 -1
  129. package/dist/esm/models/components/customerupdateexternalid.d.ts +0 -3
  130. package/dist/esm/models/components/customerupdateexternalid.d.ts.map +1 -1
  131. package/dist/esm/models/components/customerupdateexternalid.js.map +1 -1
  132. package/dist/esm/models/components/eventcreatecustomer.d.ts +10 -0
  133. package/dist/esm/models/components/eventcreatecustomer.d.ts.map +1 -1
  134. package/dist/esm/models/components/eventcreatecustomer.js +8 -0
  135. package/dist/esm/models/components/eventcreatecustomer.js.map +1 -1
  136. package/dist/esm/models/components/eventcreateexternalcustomer.d.ts +10 -0
  137. package/dist/esm/models/components/eventcreateexternalcustomer.d.ts.map +1 -1
  138. package/dist/esm/models/components/eventcreateexternalcustomer.js +8 -0
  139. package/dist/esm/models/components/eventcreateexternalcustomer.js.map +1 -1
  140. package/dist/esm/models/components/eventsingestresponse.d.ts +5 -0
  141. package/dist/esm/models/components/eventsingestresponse.d.ts.map +1 -1
  142. package/dist/esm/models/components/eventsingestresponse.js +2 -0
  143. package/dist/esm/models/components/eventsingestresponse.js.map +1 -1
  144. package/dist/esm/models/components/metercreditevent.d.ts +5 -0
  145. package/dist/esm/models/components/metercreditevent.d.ts.map +1 -1
  146. package/dist/esm/models/components/metercreditevent.js +4 -0
  147. package/dist/esm/models/components/metercreditevent.js.map +1 -1
  148. package/dist/esm/models/components/meterresetevent.d.ts +5 -0
  149. package/dist/esm/models/components/meterresetevent.d.ts.map +1 -1
  150. package/dist/esm/models/components/meterresetevent.js +4 -0
  151. package/dist/esm/models/components/meterresetevent.js.map +1 -1
  152. package/dist/esm/models/components/orderpaidevent.d.ts +5 -0
  153. package/dist/esm/models/components/orderpaidevent.d.ts.map +1 -1
  154. package/dist/esm/models/components/orderpaidevent.js +4 -0
  155. package/dist/esm/models/components/orderpaidevent.js.map +1 -1
  156. package/dist/esm/models/components/orderrefundedevent.d.ts +5 -0
  157. package/dist/esm/models/components/orderrefundedevent.d.ts.map +1 -1
  158. package/dist/esm/models/components/orderrefundedevent.js +4 -0
  159. package/dist/esm/models/components/orderrefundedevent.js.map +1 -1
  160. package/dist/esm/models/components/subscriptioncycledevent.d.ts +5 -0
  161. package/dist/esm/models/components/subscriptioncycledevent.d.ts.map +1 -1
  162. package/dist/esm/models/components/subscriptioncycledevent.js +4 -0
  163. package/dist/esm/models/components/subscriptioncycledevent.js.map +1 -1
  164. package/dist/esm/models/components/subscriptionproductupdatedevent.d.ts +5 -0
  165. package/dist/esm/models/components/subscriptionproductupdatedevent.d.ts.map +1 -1
  166. package/dist/esm/models/components/subscriptionproductupdatedevent.js +4 -0
  167. package/dist/esm/models/components/subscriptionproductupdatedevent.js.map +1 -1
  168. package/dist/esm/models/components/subscriptionrevokedevent.d.ts +5 -0
  169. package/dist/esm/models/components/subscriptionrevokedevent.d.ts.map +1 -1
  170. package/dist/esm/models/components/subscriptionrevokedevent.js +4 -0
  171. package/dist/esm/models/components/subscriptionrevokedevent.js.map +1 -1
  172. package/dist/esm/models/components/userevent.d.ts +5 -0
  173. package/dist/esm/models/components/userevent.d.ts.map +1 -1
  174. package/dist/esm/models/components/userevent.js +4 -0
  175. package/dist/esm/models/components/userevent.js.map +1 -1
  176. package/dist/esm/models/operations/eventslist.d.ts +5 -0
  177. package/dist/esm/models/operations/eventslist.d.ts.map +1 -1
  178. package/dist/esm/models/operations/eventslist.js +4 -0
  179. package/dist/esm/models/operations/eventslist.js.map +1 -1
  180. package/examples/package-lock.json +1 -1
  181. package/jsr.json +1 -1
  182. package/package.json +1 -1
  183. package/src/funcs/eventsList.ts +1 -0
  184. package/src/lib/config.ts +3 -3
  185. package/src/models/components/benefitcycledevent.ts +9 -0
  186. package/src/models/components/benefitgrantedevent.ts +9 -0
  187. package/src/models/components/benefitrevokedevent.ts +9 -0
  188. package/src/models/components/benefitupdatedevent.ts +9 -0
  189. package/src/models/components/customercreate.ts +0 -3
  190. package/src/models/components/customercreatedevent.ts +9 -0
  191. package/src/models/components/customerdeletedevent.ts +9 -0
  192. package/src/models/components/customerupdate.ts +0 -3
  193. package/src/models/components/customerupdatedevent.ts +9 -0
  194. package/src/models/components/customerupdateexternalid.ts +0 -3
  195. package/src/models/components/eventcreatecustomer.ts +18 -0
  196. package/src/models/components/eventcreateexternalcustomer.ts +18 -0
  197. package/src/models/components/eventsingestresponse.ts +7 -0
  198. package/src/models/components/metercreditevent.ts +9 -0
  199. package/src/models/components/meterresetevent.ts +9 -0
  200. package/src/models/components/orderpaidevent.ts +9 -0
  201. package/src/models/components/orderrefundedevent.ts +9 -0
  202. package/src/models/components/subscriptioncycledevent.ts +9 -0
  203. package/src/models/components/subscriptionproductupdatedevent.ts +9 -0
  204. package/src/models/components/subscriptionrevokedevent.ts +9 -0
  205. package/src/models/components/userevent.ts +9 -0
  206. package/src/models/operations/eventslist.ts +9 -0
  207. package/.devcontainer/README.md +0 -35
  208. package/docs/sdks/benefitgrants/README.md +0 -88
  209. package/docs/sdks/benefits/README.md +0 -500
  210. package/docs/sdks/checkoutlinks/README.md +0 -407
  211. package/docs/sdks/checkouts/README.md +0 -600
  212. package/docs/sdks/clients/README.md +0 -331
  213. package/docs/sdks/customermeters/README.md +0 -166
  214. package/docs/sdks/customers/README.md +0 -1036
  215. package/docs/sdks/customerseats/README.md +0 -441
  216. package/docs/sdks/customersession/README.md +0 -79
  217. package/docs/sdks/customersessions/README.md +0 -84
  218. package/docs/sdks/customfields/README.md +0 -417
  219. package/docs/sdks/discounts/README.md +0 -409
  220. package/docs/sdks/downloadables/README.md +0 -83
  221. package/docs/sdks/events/README.md +0 -324
  222. package/docs/sdks/files/README.md +0 -460
  223. package/docs/sdks/licensekeys/README.md +0 -576
  224. package/docs/sdks/meters/README.md +0 -437
  225. package/docs/sdks/metrics/README.md +0 -165
  226. package/docs/sdks/oauth2/README.md +0 -371
  227. package/docs/sdks/orders/README.md +0 -489
  228. package/docs/sdks/organizations/README.md +0 -322
  229. package/docs/sdks/payments/README.md +0 -166
  230. package/docs/sdks/polarbenefitgrants/README.md +0 -250
  231. package/docs/sdks/polarcustomermeters/README.md +0 -164
  232. package/docs/sdks/polarcustomers/README.md +0 -482
  233. package/docs/sdks/polarlicensekeys/README.md +0 -406
  234. package/docs/sdks/polarorders/README.md +0 -574
  235. package/docs/sdks/polarorganizations/README.md +0 -79
  236. package/docs/sdks/polarsubscriptions/README.md +0 -326
  237. package/docs/sdks/polarwallets/README.md +0 -164
  238. package/docs/sdks/products/README.md +0 -441
  239. package/docs/sdks/refunds/README.md +0 -171
  240. package/docs/sdks/seats/README.md +0 -379
  241. package/docs/sdks/subscriptions/README.md +0 -493
  242. package/docs/sdks/wallets/README.md +0 -256
  243. package/docs/sdks/webhooks/README.md +0 -650
  244. package/examples/README.md +0 -31
@@ -1,600 +0,0 @@
1
- # Checkouts
2
- (*checkouts*)
3
-
4
- ## Overview
5
-
6
- ### Available Operations
7
-
8
- * [list](#list) - List Checkout Sessions
9
- * [create](#create) - Create Checkout Session
10
- * [get](#get) - Get Checkout Session
11
- * [update](#update) - Update Checkout Session
12
- * [clientGet](#clientget) - Get Checkout Session from Client
13
- * [clientUpdate](#clientupdate) - Update Checkout Session from Client
14
- * [clientConfirm](#clientconfirm) - Confirm Checkout Session from Client
15
-
16
- ## list
17
-
18
- List checkout sessions.
19
-
20
- **Scopes**: `checkouts:read` `checkouts:write`
21
-
22
- ### Example Usage
23
-
24
- <!-- UsageSnippet language="typescript" operationID="checkouts:list" method="get" path="/v1/checkouts/" -->
25
- ```typescript
26
- import { Polar } from "@polar-sh/sdk";
27
-
28
- const polar = new Polar({
29
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
30
- });
31
-
32
- async function run() {
33
- const result = await polar.checkouts.list({
34
- organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
35
- });
36
-
37
- for await (const page of result) {
38
- console.log(page);
39
- }
40
- }
41
-
42
- run();
43
- ```
44
-
45
- ### Standalone function
46
-
47
- The standalone function version of this method:
48
-
49
- ```typescript
50
- import { PolarCore } from "@polar-sh/sdk/core.js";
51
- import { checkoutsList } from "@polar-sh/sdk/funcs/checkoutsList.js";
52
-
53
- // Use `PolarCore` for best tree-shaking performance.
54
- // You can create one instance of it to use across an application.
55
- const polar = new PolarCore({
56
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
57
- });
58
-
59
- async function run() {
60
- const res = await checkoutsList(polar, {
61
- organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
62
- });
63
- if (res.ok) {
64
- const { value: result } = res;
65
- for await (const page of result) {
66
- console.log(page);
67
- }
68
- } else {
69
- console.log("checkoutsList failed:", res.error);
70
- }
71
- }
72
-
73
- run();
74
- ```
75
-
76
- ### Parameters
77
-
78
- | Parameter | Type | Required | Description |
79
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
80
- | `request` | [operations.CheckoutsListRequest](../../models/operations/checkoutslistrequest.md) | :heavy_check_mark: | The request object to use for the request. |
81
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
82
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
83
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
84
-
85
- ### Response
86
-
87
- **Promise\<[operations.CheckoutsListResponse](../../models/operations/checkoutslistresponse.md)\>**
88
-
89
- ### Errors
90
-
91
- | Error Type | Status Code | Content Type |
92
- | -------------------------- | -------------------------- | -------------------------- |
93
- | errors.HTTPValidationError | 422 | application/json |
94
- | errors.SDKError | 4XX, 5XX | \*/\* |
95
-
96
- ## create
97
-
98
- Create a checkout session.
99
-
100
- **Scopes**: `checkouts:write`
101
-
102
- ### Example Usage
103
-
104
- <!-- UsageSnippet language="typescript" operationID="checkouts:create" method="post" path="/v1/checkouts/" -->
105
- ```typescript
106
- import { Polar } from "@polar-sh/sdk";
107
-
108
- const polar = new Polar({
109
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
110
- });
111
-
112
- async function run() {
113
- const result = await polar.checkouts.create({
114
- customerBillingAddress: {
115
- country: "US",
116
- },
117
- products: [
118
- "<value 1>",
119
- "<value 2>",
120
- "<value 3>",
121
- ],
122
- });
123
-
124
- console.log(result);
125
- }
126
-
127
- run();
128
- ```
129
-
130
- ### Standalone function
131
-
132
- The standalone function version of this method:
133
-
134
- ```typescript
135
- import { PolarCore } from "@polar-sh/sdk/core.js";
136
- import { checkoutsCreate } from "@polar-sh/sdk/funcs/checkoutsCreate.js";
137
-
138
- // Use `PolarCore` for best tree-shaking performance.
139
- // You can create one instance of it to use across an application.
140
- const polar = new PolarCore({
141
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
142
- });
143
-
144
- async function run() {
145
- const res = await checkoutsCreate(polar, {
146
- customerBillingAddress: {
147
- country: "US",
148
- },
149
- products: [
150
- "<value 1>",
151
- "<value 2>",
152
- "<value 3>",
153
- ],
154
- });
155
- if (res.ok) {
156
- const { value: result } = res;
157
- console.log(result);
158
- } else {
159
- console.log("checkoutsCreate failed:", res.error);
160
- }
161
- }
162
-
163
- run();
164
- ```
165
-
166
- ### Parameters
167
-
168
- | Parameter | Type | Required | Description |
169
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
170
- | `request` | [components.CheckoutCreate](../../models/components/checkoutcreate.md) | :heavy_check_mark: | The request object to use for the request. |
171
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
172
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
173
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
174
-
175
- ### Response
176
-
177
- **Promise\<[components.Checkout](../../models/components/checkout.md)\>**
178
-
179
- ### Errors
180
-
181
- | Error Type | Status Code | Content Type |
182
- | -------------------------- | -------------------------- | -------------------------- |
183
- | errors.HTTPValidationError | 422 | application/json |
184
- | errors.SDKError | 4XX, 5XX | \*/\* |
185
-
186
- ## get
187
-
188
- Get a checkout session by ID.
189
-
190
- **Scopes**: `checkouts:read` `checkouts:write`
191
-
192
- ### Example Usage
193
-
194
- <!-- UsageSnippet language="typescript" operationID="checkouts:get" method="get" path="/v1/checkouts/{id}" -->
195
- ```typescript
196
- import { Polar } from "@polar-sh/sdk";
197
-
198
- const polar = new Polar({
199
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
200
- });
201
-
202
- async function run() {
203
- const result = await polar.checkouts.get({
204
- id: "<value>",
205
- });
206
-
207
- console.log(result);
208
- }
209
-
210
- run();
211
- ```
212
-
213
- ### Standalone function
214
-
215
- The standalone function version of this method:
216
-
217
- ```typescript
218
- import { PolarCore } from "@polar-sh/sdk/core.js";
219
- import { checkoutsGet } from "@polar-sh/sdk/funcs/checkoutsGet.js";
220
-
221
- // Use `PolarCore` for best tree-shaking performance.
222
- // You can create one instance of it to use across an application.
223
- const polar = new PolarCore({
224
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
225
- });
226
-
227
- async function run() {
228
- const res = await checkoutsGet(polar, {
229
- id: "<value>",
230
- });
231
- if (res.ok) {
232
- const { value: result } = res;
233
- console.log(result);
234
- } else {
235
- console.log("checkoutsGet failed:", res.error);
236
- }
237
- }
238
-
239
- run();
240
- ```
241
-
242
- ### Parameters
243
-
244
- | Parameter | Type | Required | Description |
245
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
246
- | `request` | [operations.CheckoutsGetRequest](../../models/operations/checkoutsgetrequest.md) | :heavy_check_mark: | The request object to use for the request. |
247
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
248
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
249
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
250
-
251
- ### Response
252
-
253
- **Promise\<[components.Checkout](../../models/components/checkout.md)\>**
254
-
255
- ### Errors
256
-
257
- | Error Type | Status Code | Content Type |
258
- | -------------------------- | -------------------------- | -------------------------- |
259
- | errors.ResourceNotFound | 404 | application/json |
260
- | errors.HTTPValidationError | 422 | application/json |
261
- | errors.SDKError | 4XX, 5XX | \*/\* |
262
-
263
- ## update
264
-
265
- Update a checkout session.
266
-
267
- **Scopes**: `checkouts:write`
268
-
269
- ### Example Usage
270
-
271
- <!-- UsageSnippet language="typescript" operationID="checkouts:update" method="patch" path="/v1/checkouts/{id}" -->
272
- ```typescript
273
- import { Polar } from "@polar-sh/sdk";
274
-
275
- const polar = new Polar({
276
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
277
- });
278
-
279
- async function run() {
280
- const result = await polar.checkouts.update({
281
- id: "<value>",
282
- checkoutUpdate: {
283
- customerBillingAddress: {
284
- country: "US",
285
- },
286
- },
287
- });
288
-
289
- console.log(result);
290
- }
291
-
292
- run();
293
- ```
294
-
295
- ### Standalone function
296
-
297
- The standalone function version of this method:
298
-
299
- ```typescript
300
- import { PolarCore } from "@polar-sh/sdk/core.js";
301
- import { checkoutsUpdate } from "@polar-sh/sdk/funcs/checkoutsUpdate.js";
302
-
303
- // Use `PolarCore` for best tree-shaking performance.
304
- // You can create one instance of it to use across an application.
305
- const polar = new PolarCore({
306
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
307
- });
308
-
309
- async function run() {
310
- const res = await checkoutsUpdate(polar, {
311
- id: "<value>",
312
- checkoutUpdate: {
313
- customerBillingAddress: {
314
- country: "US",
315
- },
316
- },
317
- });
318
- if (res.ok) {
319
- const { value: result } = res;
320
- console.log(result);
321
- } else {
322
- console.log("checkoutsUpdate failed:", res.error);
323
- }
324
- }
325
-
326
- run();
327
- ```
328
-
329
- ### Parameters
330
-
331
- | Parameter | Type | Required | Description |
332
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
333
- | `request` | [operations.CheckoutsUpdateRequest](../../models/operations/checkoutsupdaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
334
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
335
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
336
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
337
-
338
- ### Response
339
-
340
- **Promise\<[components.Checkout](../../models/components/checkout.md)\>**
341
-
342
- ### Errors
343
-
344
- | Error Type | Status Code | Content Type |
345
- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
346
- | errors.AlreadyActiveSubscriptionError | 403 | application/json |
347
- | errors.NotOpenCheckout | 403 | application/json |
348
- | errors.PaymentNotReady | 403 | application/json |
349
- | errors.ResourceNotFound | 404 | application/json |
350
- | errors.HTTPValidationError | 422 | application/json |
351
- | errors.SDKError | 4XX, 5XX | \*/\* |
352
-
353
- ## clientGet
354
-
355
- Get a checkout session by client secret.
356
-
357
- ### Example Usage
358
-
359
- <!-- UsageSnippet language="typescript" operationID="checkouts:client_get" method="get" path="/v1/checkouts/client/{client_secret}" -->
360
- ```typescript
361
- import { Polar } from "@polar-sh/sdk";
362
-
363
- const polar = new Polar();
364
-
365
- async function run() {
366
- const result = await polar.checkouts.clientGet({
367
- clientSecret: "<value>",
368
- });
369
-
370
- console.log(result);
371
- }
372
-
373
- run();
374
- ```
375
-
376
- ### Standalone function
377
-
378
- The standalone function version of this method:
379
-
380
- ```typescript
381
- import { PolarCore } from "@polar-sh/sdk/core.js";
382
- import { checkoutsClientGet } from "@polar-sh/sdk/funcs/checkoutsClientGet.js";
383
-
384
- // Use `PolarCore` for best tree-shaking performance.
385
- // You can create one instance of it to use across an application.
386
- const polar = new PolarCore();
387
-
388
- async function run() {
389
- const res = await checkoutsClientGet(polar, {
390
- clientSecret: "<value>",
391
- });
392
- if (res.ok) {
393
- const { value: result } = res;
394
- console.log(result);
395
- } else {
396
- console.log("checkoutsClientGet failed:", res.error);
397
- }
398
- }
399
-
400
- run();
401
- ```
402
-
403
- ### Parameters
404
-
405
- | Parameter | Type | Required | Description |
406
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
407
- | `request` | [operations.CheckoutsClientGetRequest](../../models/operations/checkoutsclientgetrequest.md) | :heavy_check_mark: | The request object to use for the request. |
408
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
409
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
410
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
411
-
412
- ### Response
413
-
414
- **Promise\<[components.CheckoutPublic](../../models/components/checkoutpublic.md)\>**
415
-
416
- ### Errors
417
-
418
- | Error Type | Status Code | Content Type |
419
- | --------------------------- | --------------------------- | --------------------------- |
420
- | errors.ResourceNotFound | 404 | application/json |
421
- | errors.ExpiredCheckoutError | 410 | application/json |
422
- | errors.HTTPValidationError | 422 | application/json |
423
- | errors.SDKError | 4XX, 5XX | \*/\* |
424
-
425
- ## clientUpdate
426
-
427
- Update a checkout session by client secret.
428
-
429
- ### Example Usage
430
-
431
- <!-- UsageSnippet language="typescript" operationID="checkouts:client_update" method="patch" path="/v1/checkouts/client/{client_secret}" -->
432
- ```typescript
433
- import { Polar } from "@polar-sh/sdk";
434
-
435
- const polar = new Polar();
436
-
437
- async function run() {
438
- const result = await polar.checkouts.clientUpdate({
439
- clientSecret: "<value>",
440
- checkoutUpdatePublic: {
441
- customerBillingAddress: {
442
- country: "US",
443
- },
444
- },
445
- });
446
-
447
- console.log(result);
448
- }
449
-
450
- run();
451
- ```
452
-
453
- ### Standalone function
454
-
455
- The standalone function version of this method:
456
-
457
- ```typescript
458
- import { PolarCore } from "@polar-sh/sdk/core.js";
459
- import { checkoutsClientUpdate } from "@polar-sh/sdk/funcs/checkoutsClientUpdate.js";
460
-
461
- // Use `PolarCore` for best tree-shaking performance.
462
- // You can create one instance of it to use across an application.
463
- const polar = new PolarCore();
464
-
465
- async function run() {
466
- const res = await checkoutsClientUpdate(polar, {
467
- clientSecret: "<value>",
468
- checkoutUpdatePublic: {
469
- customerBillingAddress: {
470
- country: "US",
471
- },
472
- },
473
- });
474
- if (res.ok) {
475
- const { value: result } = res;
476
- console.log(result);
477
- } else {
478
- console.log("checkoutsClientUpdate failed:", res.error);
479
- }
480
- }
481
-
482
- run();
483
- ```
484
-
485
- ### Parameters
486
-
487
- | Parameter | Type | Required | Description |
488
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
489
- | `request` | [operations.CheckoutsClientUpdateRequest](../../models/operations/checkoutsclientupdaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
490
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
491
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
492
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
493
-
494
- ### Response
495
-
496
- **Promise\<[components.CheckoutPublic](../../models/components/checkoutpublic.md)\>**
497
-
498
- ### Errors
499
-
500
- | Error Type | Status Code | Content Type |
501
- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
502
- | errors.AlreadyActiveSubscriptionError | 403 | application/json |
503
- | errors.NotOpenCheckout | 403 | application/json |
504
- | errors.PaymentNotReady | 403 | application/json |
505
- | errors.ResourceNotFound | 404 | application/json |
506
- | errors.ExpiredCheckoutError | 410 | application/json |
507
- | errors.HTTPValidationError | 422 | application/json |
508
- | errors.SDKError | 4XX, 5XX | \*/\* |
509
-
510
- ## clientConfirm
511
-
512
- Confirm a checkout session by client secret.
513
-
514
- Orders and subscriptions will be processed.
515
-
516
- ### Example Usage
517
-
518
- <!-- UsageSnippet language="typescript" operationID="checkouts:client_confirm" method="post" path="/v1/checkouts/client/{client_secret}/confirm" -->
519
- ```typescript
520
- import { Polar } from "@polar-sh/sdk";
521
-
522
- const polar = new Polar({
523
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
524
- });
525
-
526
- async function run() {
527
- const result = await polar.checkouts.clientConfirm({
528
- clientSecret: "<value>",
529
- checkoutConfirmStripe: {
530
- customerBillingAddress: {
531
- country: "US",
532
- },
533
- },
534
- });
535
-
536
- console.log(result);
537
- }
538
-
539
- run();
540
- ```
541
-
542
- ### Standalone function
543
-
544
- The standalone function version of this method:
545
-
546
- ```typescript
547
- import { PolarCore } from "@polar-sh/sdk/core.js";
548
- import { checkoutsClientConfirm } from "@polar-sh/sdk/funcs/checkoutsClientConfirm.js";
549
-
550
- // Use `PolarCore` for best tree-shaking performance.
551
- // You can create one instance of it to use across an application.
552
- const polar = new PolarCore({
553
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
554
- });
555
-
556
- async function run() {
557
- const res = await checkoutsClientConfirm(polar, {
558
- clientSecret: "<value>",
559
- checkoutConfirmStripe: {
560
- customerBillingAddress: {
561
- country: "US",
562
- },
563
- },
564
- });
565
- if (res.ok) {
566
- const { value: result } = res;
567
- console.log(result);
568
- } else {
569
- console.log("checkoutsClientConfirm failed:", res.error);
570
- }
571
- }
572
-
573
- run();
574
- ```
575
-
576
- ### Parameters
577
-
578
- | Parameter | Type | Required | Description |
579
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
580
- | `request` | [operations.CheckoutsClientConfirmRequest](../../models/operations/checkoutsclientconfirmrequest.md) | :heavy_check_mark: | The request object to use for the request. |
581
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
582
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
583
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
584
-
585
- ### Response
586
-
587
- **Promise\<[components.CheckoutPublicConfirmed](../../models/components/checkoutpublicconfirmed.md)\>**
588
-
589
- ### Errors
590
-
591
- | Error Type | Status Code | Content Type |
592
- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
593
- | errors.PaymentError | 400 | application/json |
594
- | errors.AlreadyActiveSubscriptionError | 403 | application/json |
595
- | errors.NotOpenCheckout | 403 | application/json |
596
- | errors.PaymentNotReady | 403 | application/json |
597
- | errors.ResourceNotFound | 404 | application/json |
598
- | errors.ExpiredCheckoutError | 410 | application/json |
599
- | errors.HTTPValidationError | 422 | application/json |
600
- | errors.SDKError | 4XX, 5XX | \*/\* |