{"id":18400419,"url":"https://github.com/polarsource/polar-js","last_synced_at":"2026-04-01T18:35:52.410Z","repository":{"id":255439375,"uuid":"851004524","full_name":"polarsource/polar-js","owner":"polarsource","description":"Polar SDK for Node.js and browsers","archived":false,"fork":false,"pushed_at":"2026-03-28T00:45:21.000Z","size":14819,"stargazers_count":184,"open_issues_count":3,"forks_count":27,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-03-28T07:40:21.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polarsource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-02T08:47:53.000Z","updated_at":"2026-03-26T08:29:11.000Z","dependencies_parsed_at":"2026-02-24T13:01:59.484Z","dependency_job_id":null,"html_url":"https://github.com/polarsource/polar-js","commit_stats":{"total_commits":52,"total_committers":2,"mean_commits":26.0,"dds":0.3076923076923077,"last_synced_commit":"ab3d634c1538501ea0edb7d0e7d294906a947992"},"previous_names":["polarsource/polar-js"],"tags_count":137,"template":false,"template_full_name":null,"purl":"pkg:github/polarsource/polar-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Fpolar-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Fpolar-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Fpolar-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Fpolar-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polarsource","download_url":"https://codeload.github.com/polarsource/polar-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Fpolar-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T02:33:03.778Z","updated_at":"2026-04-01T18:35:52.386Z","avatar_url":"https://github.com/polarsource.png","language":"TypeScript","funding_links":["https://polar.sh","https://polar.sh/docs/api-reference","https://api.polar.sh","https://sandbox-api.polar.sh"],"categories":["TypeScript"],"sub_categories":[],"readme":"# @polar-sh/sdk\n\nDeveloper-friendly \u0026 type-safe Typescript SDK specifically catered to leverage [Polar](https://polar.sh) API.\n\n\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://www.speakeasy.com/?utm_source=@polar-sh/sdk\u0026utm_campaign=typescript\"\u003e\u003cimg src=\"https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge\u0026logoColor=FBE331\u0026logo=speakeasy\u0026labelColor=545454\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" style=\"width: 100px; height: 28px;\" /\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\u003e [!WARNING]\n\u003e Starting version `\u003ev0.6.0`, we changed our SDK generator. It's not backward compatible with previous versions.\n\n\u003c!-- Start Summary [summary] --\u003e\n## Summary\n\nPolar API: Polar HTTP and Webhooks API\n\nRead the docs at https://polar.sh/docs/api-reference\n\u003c!-- End Summary [summary] --\u003e\n\n\u003c!-- Start Table of Contents [toc] --\u003e\n## Table of Contents\n\u003c!-- $toc-max-depth=2 --\u003e\n* [@polar-sh/sdk](#polar-shsdk)\n  * [SDK Installation](#sdk-installation)\n  * [Requirements](#requirements)\n  * [SDK Example Usage](#sdk-example-usage)\n  * [Available Resources and Operations](#available-resources-and-operations)\n  * [Standalone functions](#standalone-functions)\n  * [Pagination](#pagination)\n  * [Retries](#retries)\n  * [Error Handling](#error-handling)\n  * [Server Selection](#server-selection)\n  * [Custom HTTP Client](#custom-http-client)\n  * [Authentication](#authentication)\n  * [Debugging](#debugging)\n* [Development](#development)\n  * [Maturity](#maturity)\n  * [Contributions](#contributions)\n\n\u003c!-- End Table of Contents [toc] --\u003e\n\n\u003c!-- Start SDK Installation [installation] --\u003e\n## SDK Installation\n\nThe SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.\n\n### NPM\n\n```bash\nnpm add @polar-sh/sdk\n```\n\n### PNPM\n\n```bash\npnpm add @polar-sh/sdk\n```\n\n### Bun\n\n```bash\nbun add @polar-sh/sdk\n```\n\n### Yarn\n\n```bash\nyarn add @polar-sh/sdk\n```\n\n\u003e [!NOTE]\n\u003e This package is published with CommonJS and ES Modules (ESM) support.\n\u003c!-- End SDK Installation [installation] --\u003e\n\n\u003c!-- Start Requirements [requirements] --\u003e\n## Requirements\n\nFor supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).\n\u003c!-- End Requirements [requirements] --\u003e\n\n\u003c!-- Start SDK Example Usage [usage] --\u003e\n## SDK Example Usage\n\n### Example\n\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n  accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await polar.organizations.list({});\n\n  for await (const page of result) {\n    console.log(page);\n  }\n}\n\nrun();\n\n```\n\u003c!-- End SDK Example Usage [usage] --\u003e\n\n### Webhook support\n\nThe SDK has built-in support to validate webhook events. Here is an example with Express.js:\n\n```ts\nimport express, { Request, Response } from \"express\";\nimport { validateEvent, WebhookVerificationError } from \"@polar-sh/sdk/webhooks\";\n\nconst app = express();\n\napp.post(\"/webhook\", express.raw({ type: \"application/json\" }), (req: Request, res: Response) =\u003e {\n  try {\n    const event = validateEvent(req.body, req.headers, process.env[\"POLAR_WEBHOOK_SECRET\"] ?? \"\");\n\n    // Process the event\n\n    res.status(202).send('')\n  } catch (error) {\n    if (error instanceof WebhookVerificationError) {\n      res.status(403).send('')\n    }\n    throw error\n  }\n});\n```\n\n\u003c!-- Start Available Resources and Operations [operations] --\u003e\n## Available Resources and Operations\n\n\u003cdetails open\u003e\n\u003csummary\u003eAvailable methods\u003c/summary\u003e\n\n### [BenefitGrants](docs/sdks/benefitgrants/README.md)\n\n* [list](docs/sdks/benefitgrants/README.md#list) - List Benefit Grants\n\n### [Benefits](docs/sdks/benefits/README.md)\n\n* [list](docs/sdks/benefits/README.md#list) - List Benefits\n* [create](docs/sdks/benefits/README.md#create) - Create Benefit\n* [get](docs/sdks/benefits/README.md#get) - Get Benefit\n* [delete](docs/sdks/benefits/README.md#delete) - Delete Benefit\n* [update](docs/sdks/benefits/README.md#update) - Update Benefit\n* [grants](docs/sdks/benefits/README.md#grants) - List Benefit Grants\n\n### [CheckoutLinks](docs/sdks/checkoutlinks/README.md)\n\n* [list](docs/sdks/checkoutlinks/README.md#list) - List Checkout Links\n* [create](docs/sdks/checkoutlinks/README.md#create) - Create Checkout Link\n* [get](docs/sdks/checkoutlinks/README.md#get) - Get Checkout Link\n* [delete](docs/sdks/checkoutlinks/README.md#delete) - Delete Checkout Link\n* [update](docs/sdks/checkoutlinks/README.md#update) - Update Checkout Link\n\n### [Checkouts](docs/sdks/checkouts/README.md)\n\n* [list](docs/sdks/checkouts/README.md#list) - List Checkout Sessions\n* [create](docs/sdks/checkouts/README.md#create) - Create Checkout Session\n* [get](docs/sdks/checkouts/README.md#get) - Get Checkout Session\n* [update](docs/sdks/checkouts/README.md#update) - Update Checkout Session\n* [clientGet](docs/sdks/checkouts/README.md#clientget) - Get Checkout Session from Client\n* [clientUpdate](docs/sdks/checkouts/README.md#clientupdate) - Update Checkout Session from Client\n* [clientConfirm](docs/sdks/checkouts/README.md#clientconfirm) - Confirm Checkout Session from Client\n\n### [CustomFields](docs/sdks/customfields/README.md)\n\n* [list](docs/sdks/customfields/README.md#list) - List Custom Fields\n* [create](docs/sdks/customfields/README.md#create) - Create Custom Field\n* [get](docs/sdks/customfields/README.md#get) - Get Custom Field\n* [delete](docs/sdks/customfields/README.md#delete) - Delete Custom Field\n* [update](docs/sdks/customfields/README.md#update) - Update Custom Field\n\n### [CustomerMeters](docs/sdks/customermeters/README.md)\n\n* [list](docs/sdks/customermeters/README.md#list) - List Customer Meters\n* [get](docs/sdks/customermeters/README.md#get) - Get Customer Meter\n\n### [CustomerPortal.BenefitGrants](docs/sdks/polarbenefitgrants/README.md)\n\n* [list](docs/sdks/polarbenefitgrants/README.md#list) - List Benefit Grants\n* [get](docs/sdks/polarbenefitgrants/README.md#get) - Get Benefit Grant\n* [update](docs/sdks/polarbenefitgrants/README.md#update) - Update Benefit Grant\n\n### [CustomerPortal.CustomerMeters](docs/sdks/polarcustomermeters/README.md)\n\n* [list](docs/sdks/polarcustomermeters/README.md#list) - List Meters\n* [get](docs/sdks/polarcustomermeters/README.md#get) - Get Customer Meter\n\n### [CustomerPortal.CustomerSession](docs/sdks/customersession/README.md)\n\n* [introspect](docs/sdks/customersession/README.md#introspect) - Introspect Customer Session\n* [getAuthenticatedUser](docs/sdks/customersession/README.md#getauthenticateduser) - Get Authenticated Portal User\n\n### [CustomerPortal.Customers](docs/sdks/polarcustomers/README.md)\n\n* [get](docs/sdks/polarcustomers/README.md#get) - Get Customer\n* [update](docs/sdks/polarcustomers/README.md#update) - Update Customer\n* [listPaymentMethods](docs/sdks/polarcustomers/README.md#listpaymentmethods) - List Customer Payment Methods\n* [addPaymentMethod](docs/sdks/polarcustomers/README.md#addpaymentmethod) - Add Customer Payment Method\n* [confirmPaymentMethod](docs/sdks/polarcustomers/README.md#confirmpaymentmethod) - Confirm Customer Payment Method\n* [deletePaymentMethod](docs/sdks/polarcustomers/README.md#deletepaymentmethod) - Delete Customer Payment Method\n\n### [CustomerPortal.Downloadables](docs/sdks/downloadables/README.md)\n\n* [list](docs/sdks/downloadables/README.md#list) - List Downloadables\n\n### [CustomerPortal.LicenseKeys](docs/sdks/polarlicensekeys/README.md)\n\n* [list](docs/sdks/polarlicensekeys/README.md#list) - List License Keys\n* [get](docs/sdks/polarlicensekeys/README.md#get) - Get License Key\n* [validate](docs/sdks/polarlicensekeys/README.md#validate) - Validate License Key\n* [activate](docs/sdks/polarlicensekeys/README.md#activate) - Activate License Key\n* [deactivate](docs/sdks/polarlicensekeys/README.md#deactivate) - Deactivate License Key\n\n### [CustomerPortal.Members](docs/sdks/polarmembers/README.md)\n\n* [listMembers](docs/sdks/polarmembers/README.md#listmembers) - List Members\n* [addMember](docs/sdks/polarmembers/README.md#addmember) - Add Member\n* [removeMember](docs/sdks/polarmembers/README.md#removemember) - Remove Member\n* [updateMember](docs/sdks/polarmembers/README.md#updatemember) - Update Member\n\n### [CustomerPortal.Orders](docs/sdks/polarorders/README.md)\n\n* [list](docs/sdks/polarorders/README.md#list) - List Orders\n* [get](docs/sdks/polarorders/README.md#get) - Get Order\n* [update](docs/sdks/polarorders/README.md#update) - Update Order\n* [invoice](docs/sdks/polarorders/README.md#invoice) - Get Order Invoice\n* [generateInvoice](docs/sdks/polarorders/README.md#generateinvoice) - Generate Order Invoice\n* [getPaymentStatus](docs/sdks/polarorders/README.md#getpaymentstatus) - Get Order Payment Status\n* [confirmRetryPayment](docs/sdks/polarorders/README.md#confirmretrypayment) - Confirm Retry Payment\n\n### [CustomerPortal.Organizations](docs/sdks/polarorganizations/README.md)\n\n* [get](docs/sdks/polarorganizations/README.md#get) - Get Organization\n\n### [CustomerPortal.Seats](docs/sdks/seats/README.md)\n\n* [listSeats](docs/sdks/seats/README.md#listseats) - List Seats\n* [assignSeat](docs/sdks/seats/README.md#assignseat) - Assign Seat\n* [revokeSeat](docs/sdks/seats/README.md#revokeseat) - Revoke Seat\n* [resendInvitation](docs/sdks/seats/README.md#resendinvitation) - Resend Invitation\n* [listClaimedSubscriptions](docs/sdks/seats/README.md#listclaimedsubscriptions) - List Claimed Subscriptions\n\n### [CustomerPortal.Subscriptions](docs/sdks/polarsubscriptions/README.md)\n\n* [list](docs/sdks/polarsubscriptions/README.md#list) - List Subscriptions\n* [get](docs/sdks/polarsubscriptions/README.md#get) - Get Subscription\n* [cancel](docs/sdks/polarsubscriptions/README.md#cancel) - Cancel Subscription\n* [update](docs/sdks/polarsubscriptions/README.md#update) - Update Subscription\n\n### [CustomerPortal.Wallets](docs/sdks/wallets/README.md)\n\n* [list](docs/sdks/wallets/README.md#list) - List Wallets\n* [get](docs/sdks/wallets/README.md#get) - Get Wallet\n\n### [CustomerSeats](docs/sdks/customerseats/README.md)\n\n* [listSeats](docs/sdks/customerseats/README.md#listseats) - List Seats\n* [assignSeat](docs/sdks/customerseats/README.md#assignseat) - Assign Seat\n* [revokeSeat](docs/sdks/customerseats/README.md#revokeseat) - Revoke Seat\n* [resendInvitation](docs/sdks/customerseats/README.md#resendinvitation) - Resend Invitation\n* [getClaimInfo](docs/sdks/customerseats/README.md#getclaiminfo) - Get Claim Info\n* [claimSeat](docs/sdks/customerseats/README.md#claimseat) - Claim Seat\n\n### [CustomerSessions](docs/sdks/customersessions/README.md)\n\n* [create](docs/sdks/customersessions/README.md#create) - Create Customer Session\n\n### [Customers](docs/sdks/customers/README.md)\n\n* [list](docs/sdks/customers/README.md#list) - List Customers\n* [create](docs/sdks/customers/README.md#create) - Create Customer\n* [export](docs/sdks/customers/README.md#export) - Export Customers\n* [get](docs/sdks/customers/README.md#get) - Get Customer\n* [delete](docs/sdks/customers/README.md#delete) - Delete Customer\n* [update](docs/sdks/customers/README.md#update) - Update Customer\n* [getExternal](docs/sdks/customers/README.md#getexternal) - Get Customer by External ID\n* [deleteExternal](docs/sdks/customers/README.md#deleteexternal) - Delete Customer by External ID\n* [updateExternal](docs/sdks/customers/README.md#updateexternal) - Update Customer by External ID\n* [getState](docs/sdks/customers/README.md#getstate) - Get Customer State\n* [getStateExternal](docs/sdks/customers/README.md#getstateexternal) - Get Customer State by External ID\n\n### [Discounts](docs/sdks/discounts/README.md)\n\n* [list](docs/sdks/discounts/README.md#list) - List Discounts\n* [create](docs/sdks/discounts/README.md#create) - Create Discount\n* [get](docs/sdks/discounts/README.md#get) - Get Discount\n* [delete](docs/sdks/discounts/README.md#delete) - Delete Discount\n* [update](docs/sdks/discounts/README.md#update) - Update Discount\n\n### [Disputes](docs/sdks/disputes/README.md)\n\n* [list](docs/sdks/disputes/README.md#list) - List Disputes\n* [get](docs/sdks/disputes/README.md#get) - Get Dispute\n\n### [EventTypes](docs/sdks/eventtypes/README.md)\n\n* [list](docs/sdks/eventtypes/README.md#list) - List Event Types\n* [update](docs/sdks/eventtypes/README.md#update) - Update Event Type\n\n### [Events](docs/sdks/events/README.md)\n\n* [list](docs/sdks/events/README.md#list) - List Events\n* [listNames](docs/sdks/events/README.md#listnames) - List Event Names\n* [get](docs/sdks/events/README.md#get) - Get Event\n* [ingest](docs/sdks/events/README.md#ingest) - Ingest Events\n\n### [Files](docs/sdks/files/README.md)\n\n* [list](docs/sdks/files/README.md#list) - List Files\n* [create](docs/sdks/files/README.md#create) - Create File\n* [uploaded](docs/sdks/files/README.md#uploaded) - Complete File Upload\n* [delete](docs/sdks/files/README.md#delete) - Delete File\n* [update](docs/sdks/files/README.md#update) - Update File\n\n### [LicenseKeys](docs/sdks/licensekeys/README.md)\n\n* [list](docs/sdks/licensekeys/README.md#list) - List License Keys\n* [get](docs/sdks/licensekeys/README.md#get) - Get License Key\n* [update](docs/sdks/licensekeys/README.md#update) - Update License Key\n* [getActivation](docs/sdks/licensekeys/README.md#getactivation) - Get Activation\n* [validate](docs/sdks/licensekeys/README.md#validate) - Validate License Key\n* [activate](docs/sdks/licensekeys/README.md#activate) - Activate License Key\n* [deactivate](docs/sdks/licensekeys/README.md#deactivate) - Deactivate License Key\n\n### [Members](docs/sdks/members/README.md)\n\n* [listMembers](docs/sdks/members/README.md#listmembers) - List Members\n* [createMember](docs/sdks/members/README.md#createmember) - Create Member\n* [getMember](docs/sdks/members/README.md#getmember) - Get Member\n* [deleteMember](docs/sdks/members/README.md#deletemember) - Delete Member\n* [updateMember](docs/sdks/members/README.md#updatemember) - Update Member\n\n### [Meters](docs/sdks/meters/README.md)\n\n* [list](docs/sdks/meters/README.md#list) - List Meters\n* [create](docs/sdks/meters/README.md#create) - Create Meter\n* [get](docs/sdks/meters/README.md#get) - Get Meter\n* [update](docs/sdks/meters/README.md#update) - Update Meter\n* [quantities](docs/sdks/meters/README.md#quantities) - Get Meter Quantities\n\n### [Metrics](docs/sdks/metrics/README.md)\n\n* [get](docs/sdks/metrics/README.md#get) - Get Metrics\n* [limits](docs/sdks/metrics/README.md#limits) - Get Metrics Limits\n\n### [Oauth2](docs/sdks/oauth2/README.md)\n\n* [authorize](docs/sdks/oauth2/README.md#authorize) - Authorize\n* [token](docs/sdks/oauth2/README.md#token) - Request Token\n* [revoke](docs/sdks/oauth2/README.md#revoke) - Revoke Token\n* [introspect](docs/sdks/oauth2/README.md#introspect) - Introspect Token\n* [userinfo](docs/sdks/oauth2/README.md#userinfo) - Get User Info\n\n#### [Oauth2.Clients](docs/sdks/clients/README.md)\n\n* [create](docs/sdks/clients/README.md#create) - Create Client\n* [get](docs/sdks/clients/README.md#get) - Get Client\n* [update](docs/sdks/clients/README.md#update) - Update Client\n* [delete](docs/sdks/clients/README.md#delete) - Delete Client\n\n### [Orders](docs/sdks/orders/README.md)\n\n* [list](docs/sdks/orders/README.md#list) - List Orders\n* [export](docs/sdks/orders/README.md#export) - Export Orders\n* [get](docs/sdks/orders/README.md#get) - Get Order\n* [update](docs/sdks/orders/README.md#update) - Update Order\n* [invoice](docs/sdks/orders/README.md#invoice) - Get Order Invoice\n* [generateInvoice](docs/sdks/orders/README.md#generateinvoice) - Generate Order Invoice\n\n### [OrganizationAccessTokens](docs/sdks/organizationaccesstokens/README.md)\n\n* [list](docs/sdks/organizationaccesstokens/README.md#list) - List\n* [create](docs/sdks/organizationaccesstokens/README.md#create) - Create\n* [delete](docs/sdks/organizationaccesstokens/README.md#delete) - Delete\n* [update](docs/sdks/organizationaccesstokens/README.md#update) - Update\n\n### [Organizations](docs/sdks/organizations/README.md)\n\n* [list](docs/sdks/organizations/README.md#list) - List Organizations\n* [create](docs/sdks/organizations/README.md#create) - Create Organization\n* [get](docs/sdks/organizations/README.md#get) - Get Organization\n* [update](docs/sdks/organizations/README.md#update) - Update Organization\n\n### [Payments](docs/sdks/payments/README.md)\n\n* [list](docs/sdks/payments/README.md#list) - List Payments\n* [get](docs/sdks/payments/README.md#get) - Get Payment\n\n### [Products](docs/sdks/products/README.md)\n\n* [list](docs/sdks/products/README.md#list) - List Products\n* [create](docs/sdks/products/README.md#create) - Create Product\n* [get](docs/sdks/products/README.md#get) - Get Product\n* [update](docs/sdks/products/README.md#update) - Update Product\n* [updateBenefits](docs/sdks/products/README.md#updatebenefits) - Update Product Benefits\n\n### [Refunds](docs/sdks/refunds/README.md)\n\n* [list](docs/sdks/refunds/README.md#list) - List Refunds\n* [create](docs/sdks/refunds/README.md#create) - Create Refund\n\n### [Subscriptions](docs/sdks/subscriptions/README.md)\n\n* [list](docs/sdks/subscriptions/README.md#list) - List Subscriptions\n* [create](docs/sdks/subscriptions/README.md#create) - Create Subscription\n* [export](docs/sdks/subscriptions/README.md#export) - Export Subscriptions\n* [get](docs/sdks/subscriptions/README.md#get) - Get Subscription\n* [revoke](docs/sdks/subscriptions/README.md#revoke) - Revoke Subscription\n* [update](docs/sdks/subscriptions/README.md#update) - Update Subscription\n\n### [Webhooks](docs/sdks/webhooks/README.md)\n\n* [listWebhookEndpoints](docs/sdks/webhooks/README.md#listwebhookendpoints) - List Webhook Endpoints\n* [createWebhookEndpoint](docs/sdks/webhooks/README.md#createwebhookendpoint) - Create Webhook Endpoint\n* [getWebhookEndpoint](docs/sdks/webhooks/README.md#getwebhookendpoint) - Get Webhook Endpoint\n* [deleteWebhookEndpoint](docs/sdks/webhooks/README.md#deletewebhookendpoint) - Delete Webhook Endpoint\n* [updateWebhookEndpoint](docs/sdks/webhooks/README.md#updatewebhookendpoint) - Update Webhook Endpoint\n* [resetWebhookEndpointSecret](docs/sdks/webhooks/README.md#resetwebhookendpointsecret) - Reset Webhook Endpoint Secret\n* [listWebhookDeliveries](docs/sdks/webhooks/README.md#listwebhookdeliveries) - List Webhook Deliveries\n* [redeliverWebhookEvent](docs/sdks/webhooks/README.md#redeliverwebhookevent) - Redeliver Webhook Event\n\n\u003c/details\u003e\n\u003c!-- End Available Resources and Operations [operations] --\u003e\n\n\u003c!-- Start Standalone functions [standalone-funcs] --\u003e\n## Standalone functions\n\nAll the methods listed above are available as standalone functions. These\nfunctions are ideal for use in applications running in the browser, serverless\nruntimes or other environments where application bundle size is a primary\nconcern. When using a bundler to build your application, all unused\nfunctionality will be either excluded from the final bundle or tree-shaken away.\n\nTo read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAvailable standalone functions\u003c/summary\u003e\n\n- [`benefitGrantsList`](docs/sdks/benefitgrants/README.md#list) - List Benefit Grants\n- [`benefitsCreate`](docs/sdks/benefits/README.md#create) - Create Benefit\n- [`benefitsDelete`](docs/sdks/benefits/README.md#delete) - Delete Benefit\n- [`benefitsGet`](docs/sdks/benefits/README.md#get) - Get Benefit\n- [`benefitsGrants`](docs/sdks/benefits/README.md#grants) - List Benefit Grants\n- [`benefitsList`](docs/sdks/benefits/README.md#list) - List Benefits\n- [`benefitsUpdate`](docs/sdks/benefits/README.md#update) - Update Benefit\n- [`checkoutLinksCreate`](docs/sdks/checkoutlinks/README.md#create) - Create Checkout Link\n- [`checkoutLinksDelete`](docs/sdks/checkoutlinks/README.md#delete) - Delete Checkout Link\n- [`checkoutLinksGet`](docs/sdks/checkoutlinks/README.md#get) - Get Checkout Link\n- [`checkoutLinksList`](docs/sdks/checkoutlinks/README.md#list) - List Checkout Links\n- [`checkoutLinksUpdate`](docs/sdks/checkoutlinks/README.md#update) - Update Checkout Link\n- [`checkoutsClientConfirm`](docs/sdks/checkouts/README.md#clientconfirm) - Confirm Checkout Session from Client\n- [`checkoutsClientGet`](docs/sdks/checkouts/README.md#clientget) - Get Checkout Session from Client\n- [`checkoutsClientUpdate`](docs/sdks/checkouts/README.md#clientupdate) - Update Checkout Session from Client\n- [`checkoutsCreate`](docs/sdks/checkouts/README.md#create) - Create Checkout Session\n- [`checkoutsGet`](docs/sdks/checkouts/README.md#get) - Get Checkout Session\n- [`checkoutsList`](docs/sdks/checkouts/README.md#list) - List Checkout Sessions\n- [`checkoutsUpdate`](docs/sdks/checkouts/README.md#update) - Update Checkout Session\n- [`customerMetersGet`](docs/sdks/customermeters/README.md#get) - Get Customer Meter\n- [`customerMetersList`](docs/sdks/customermeters/README.md#list) - List Customer Meters\n- [`customerPortalBenefitGrantsGet`](docs/sdks/polarbenefitgrants/README.md#get) - Get Benefit Grant\n- [`customerPortalBenefitGrantsList`](docs/sdks/polarbenefitgrants/README.md#list) - List Benefit Grants\n- [`customerPortalBenefitGrantsUpdate`](docs/sdks/polarbenefitgrants/README.md#update) - Update Benefit Grant\n- [`customerPortalCustomerMetersGet`](docs/sdks/polarcustomermeters/README.md#get) - Get Customer Meter\n- [`customerPortalCustomerMetersList`](docs/sdks/polarcustomermeters/README.md#list) - List Meters\n- [`customerPortalCustomersAddPaymentMethod`](docs/sdks/polarcustomers/README.md#addpaymentmethod) - Add Customer Payment Method\n- [`customerPortalCustomersConfirmPaymentMethod`](docs/sdks/polarcustomers/README.md#confirmpaymentmethod) - Confirm Customer Payment Method\n- [`customerPortalCustomersDeletePaymentMethod`](docs/sdks/polarcustomers/README.md#deletepaymentmethod) - Delete Customer Payment Method\n- [`customerPortalCustomerSessionGetAuthenticatedUser`](docs/sdks/customersession/README.md#getauthenticateduser) - Get Authenticated Portal User\n- [`customerPortalCustomerSessionIntrospect`](docs/sdks/customersession/README.md#introspect) - Introspect Customer Session\n- [`customerPortalCustomersGet`](docs/sdks/polarcustomers/README.md#get) - Get Customer\n- [`customerPortalCustomersListPaymentMethods`](docs/sdks/polarcustomers/README.md#listpaymentmethods) - List Customer Payment Methods\n- [`customerPortalCustomersUpdate`](docs/sdks/polarcustomers/README.md#update) - Update Customer\n- [`customerPortalDownloadablesList`](docs/sdks/downloadables/README.md#list) - List Downloadables\n- [`customerPortalLicenseKeysActivate`](docs/sdks/polarlicensekeys/README.md#activate) - Activate License Key\n- [`customerPortalLicenseKeysDeactivate`](docs/sdks/polarlicensekeys/README.md#deactivate) - Deactivate License Key\n- [`customerPortalLicenseKeysGet`](docs/sdks/polarlicensekeys/README.md#get) - Get License Key\n- [`customerPortalLicenseKeysList`](docs/sdks/polarlicensekeys/README.md#list) - List License Keys\n- [`customerPortalLicenseKeysValidate`](docs/sdks/polarlicensekeys/README.md#validate) - Validate License Key\n- [`customerPortalMembersAddMember`](docs/sdks/polarmembers/README.md#addmember) - Add Member\n- [`customerPortalMembersListMembers`](docs/sdks/polarmembers/README.md#listmembers) - List Members\n- [`customerPortalMembersRemoveMember`](docs/sdks/polarmembers/README.md#removemember) - Remove Member\n- [`customerPortalMembersUpdateMember`](docs/sdks/polarmembers/README.md#updatemember) - Update Member\n- [`customerPortalOrdersConfirmRetryPayment`](docs/sdks/polarorders/README.md#confirmretrypayment) - Confirm Retry Payment\n- [`customerPortalOrdersGenerateInvoice`](docs/sdks/polarorders/README.md#generateinvoice) - Generate Order Invoice\n- [`customerPortalOrdersGet`](docs/sdks/polarorders/README.md#get) - Get Order\n- [`customerPortalOrdersGetPaymentStatus`](docs/sdks/polarorders/README.md#getpaymentstatus) - Get Order Payment Status\n- [`customerPortalOrdersInvoice`](docs/sdks/polarorders/README.md#invoice) - Get Order Invoice\n- [`customerPortalOrdersList`](docs/sdks/polarorders/README.md#list) - List Orders\n- [`customerPortalOrdersUpdate`](docs/sdks/polarorders/README.md#update) - Update Order\n- [`customerPortalOrganizationsGet`](docs/sdks/polarorganizations/README.md#get) - Get Organization\n- [`customerPortalSeatsAssignSeat`](docs/sdks/seats/README.md#assignseat) - Assign Seat\n- [`customerPortalSeatsListClaimedSubscriptions`](docs/sdks/seats/README.md#listclaimedsubscriptions) - List Claimed Subscriptions\n- [`customerPortalSeatsListSeats`](docs/sdks/seats/README.md#listseats) - List Seats\n- [`customerPortalSeatsResendInvitation`](docs/sdks/seats/README.md#resendinvitation) - Resend Invitation\n- [`customerPortalSeatsRevokeSeat`](docs/sdks/seats/README.md#revokeseat) - Revoke Seat\n- [`customerPortalSubscriptionsCancel`](docs/sdks/polarsubscriptions/README.md#cancel) - Cancel Subscription\n- [`customerPortalSubscriptionsGet`](docs/sdks/polarsubscriptions/README.md#get) - Get Subscription\n- [`customerPortalSubscriptionsList`](docs/sdks/polarsubscriptions/README.md#list) - List Subscriptions\n- [`customerPortalSubscriptionsUpdate`](docs/sdks/polarsubscriptions/README.md#update) - Update Subscription\n- [`customerPortalWalletsGet`](docs/sdks/wallets/README.md#get) - Get Wallet\n- [`customerPortalWalletsList`](docs/sdks/wallets/README.md#list) - List Wallets\n- [`customersCreate`](docs/sdks/customers/README.md#create) - Create Customer\n- [`customersDelete`](docs/sdks/customers/README.md#delete) - Delete Customer\n- [`customersDeleteExternal`](docs/sdks/customers/README.md#deleteexternal) - Delete Customer by External ID\n- [`customerSeatsAssignSeat`](docs/sdks/customerseats/README.md#assignseat) - Assign Seat\n- [`customerSeatsClaimSeat`](docs/sdks/customerseats/README.md#claimseat) - Claim Seat\n- [`customerSeatsGetClaimInfo`](docs/sdks/customerseats/README.md#getclaiminfo) - Get Claim Info\n- [`customerSeatsListSeats`](docs/sdks/customerseats/README.md#listseats) - List Seats\n- [`customerSeatsResendInvitation`](docs/sdks/customerseats/README.md#resendinvitation) - Resend Invitation\n- [`customerSeatsRevokeSeat`](docs/sdks/customerseats/README.md#revokeseat) - Revoke Seat\n- [`customerSessionsCreate`](docs/sdks/customersessions/README.md#create) - Create Customer Session\n- [`customersExport`](docs/sdks/customers/README.md#export) - Export Customers\n- [`customersGet`](docs/sdks/customers/README.md#get) - Get Customer\n- [`customersGetExternal`](docs/sdks/customers/README.md#getexternal) - Get Customer by External ID\n- [`customersGetState`](docs/sdks/customers/README.md#getstate) - Get Customer State\n- [`customersGetStateExternal`](docs/sdks/customers/README.md#getstateexternal) - Get Customer State by External ID\n- [`customersList`](docs/sdks/customers/README.md#list) - List Customers\n- [`customersUpdate`](docs/sdks/customers/README.md#update) - Update Customer\n- [`customersUpdateExternal`](docs/sdks/customers/README.md#updateexternal) - Update Customer by External ID\n- [`customFieldsCreate`](docs/sdks/customfields/README.md#create) - Create Custom Field\n- [`customFieldsDelete`](docs/sdks/customfields/README.md#delete) - Delete Custom Field\n- [`customFieldsGet`](docs/sdks/customfields/README.md#get) - Get Custom Field\n- [`customFieldsList`](docs/sdks/customfields/README.md#list) - List Custom Fields\n- [`customFieldsUpdate`](docs/sdks/customfields/README.md#update) - Update Custom Field\n- [`discountsCreate`](docs/sdks/discounts/README.md#create) - Create Discount\n- [`discountsDelete`](docs/sdks/discounts/README.md#delete) - Delete Discount\n- [`discountsGet`](docs/sdks/discounts/README.md#get) - Get Discount\n- [`discountsList`](docs/sdks/discounts/README.md#list) - List Discounts\n- [`discountsUpdate`](docs/sdks/discounts/README.md#update) - Update Discount\n- [`disputesGet`](docs/sdks/disputes/README.md#get) - Get Dispute\n- [`disputesList`](docs/sdks/disputes/README.md#list) - List Disputes\n- [`eventsGet`](docs/sdks/events/README.md#get) - Get Event\n- [`eventsIngest`](docs/sdks/events/README.md#ingest) - Ingest Events\n- [`eventsList`](docs/sdks/events/README.md#list) - List Events\n- [`eventsListNames`](docs/sdks/events/README.md#listnames) - List Event Names\n- [`eventTypesList`](docs/sdks/eventtypes/README.md#list) - List Event Types\n- [`eventTypesUpdate`](docs/sdks/eventtypes/README.md#update) - Update Event Type\n- [`filesCreate`](docs/sdks/files/README.md#create) - Create File\n- [`filesDelete`](docs/sdks/files/README.md#delete) - Delete File\n- [`filesList`](docs/sdks/files/README.md#list) - List Files\n- [`filesUpdate`](docs/sdks/files/README.md#update) - Update File\n- [`filesUploaded`](docs/sdks/files/README.md#uploaded) - Complete File Upload\n- [`licenseKeysActivate`](docs/sdks/licensekeys/README.md#activate) - Activate License Key\n- [`licenseKeysDeactivate`](docs/sdks/licensekeys/README.md#deactivate) - Deactivate License Key\n- [`licenseKeysGet`](docs/sdks/licensekeys/README.md#get) - Get License Key\n- [`licenseKeysGetActivation`](docs/sdks/licensekeys/README.md#getactivation) - Get Activation\n- [`licenseKeysList`](docs/sdks/licensekeys/README.md#list) - List License Keys\n- [`licenseKeysUpdate`](docs/sdks/licensekeys/README.md#update) - Update License Key\n- [`licenseKeysValidate`](docs/sdks/licensekeys/README.md#validate) - Validate License Key\n- [`membersCreateMember`](docs/sdks/members/README.md#createmember) - Create Member\n- [`membersDeleteMember`](docs/sdks/members/README.md#deletemember) - Delete Member\n- [`membersGetMember`](docs/sdks/members/README.md#getmember) - Get Member\n- [`membersListMembers`](docs/sdks/members/README.md#listmembers) - List Members\n- [`membersUpdateMember`](docs/sdks/members/README.md#updatemember) - Update Member\n- [`metersCreate`](docs/sdks/meters/README.md#create) - Create Meter\n- [`metersGet`](docs/sdks/meters/README.md#get) - Get Meter\n- [`metersList`](docs/sdks/meters/README.md#list) - List Meters\n- [`metersQuantities`](docs/sdks/meters/README.md#quantities) - Get Meter Quantities\n- [`metersUpdate`](docs/sdks/meters/README.md#update) - Update Meter\n- [`metricsGet`](docs/sdks/metrics/README.md#get) - Get Metrics\n- [`metricsLimits`](docs/sdks/metrics/README.md#limits) - Get Metrics Limits\n- [`oauth2Authorize`](docs/sdks/oauth2/README.md#authorize) - Authorize\n- [`oauth2ClientsCreate`](docs/sdks/clients/README.md#create) - Create Client\n- [`oauth2ClientsDelete`](docs/sdks/clients/README.md#delete) - Delete Client\n- [`oauth2ClientsGet`](docs/sdks/clients/README.md#get) - Get Client\n- [`oauth2ClientsUpdate`](docs/sdks/clients/README.md#update) - Update Client\n- [`oauth2Introspect`](docs/sdks/oauth2/README.md#introspect) - Introspect Token\n- [`oauth2Revoke`](docs/sdks/oauth2/README.md#revoke) - Revoke Token\n- [`oauth2Token`](docs/sdks/oauth2/README.md#token) - Request Token\n- [`oauth2Userinfo`](docs/sdks/oauth2/README.md#userinfo) - Get User Info\n- [`ordersExport`](docs/sdks/orders/README.md#export) - Export Orders\n- [`ordersGenerateInvoice`](docs/sdks/orders/README.md#generateinvoice) - Generate Order Invoice\n- [`ordersGet`](docs/sdks/orders/README.md#get) - Get Order\n- [`ordersInvoice`](docs/sdks/orders/README.md#invoice) - Get Order Invoice\n- [`ordersList`](docs/sdks/orders/README.md#list) - List Orders\n- [`ordersUpdate`](docs/sdks/orders/README.md#update) - Update Order\n- [`organizationAccessTokensCreate`](docs/sdks/organizationaccesstokens/README.md#create) - Create\n- [`organizationAccessTokensDelete`](docs/sdks/organizationaccesstokens/README.md#delete) - Delete\n- [`organizationAccessTokensList`](docs/sdks/organizationaccesstokens/README.md#list) - List\n- [`organizationAccessTokensUpdate`](docs/sdks/organizationaccesstokens/README.md#update) - Update\n- [`organizationsCreate`](docs/sdks/organizations/README.md#create) - Create Organization\n- [`organizationsGet`](docs/sdks/organizations/README.md#get) - Get Organization\n- [`organizationsList`](docs/sdks/organizations/README.md#list) - List Organizations\n- [`organizationsUpdate`](docs/sdks/organizations/README.md#update) - Update Organization\n- [`paymentsGet`](docs/sdks/payments/README.md#get) - Get Payment\n- [`paymentsList`](docs/sdks/payments/README.md#list) - List Payments\n- [`productsCreate`](docs/sdks/products/README.md#create) - Create Product\n- [`productsGet`](docs/sdks/products/README.md#get) - Get Product\n- [`productsList`](docs/sdks/products/README.md#list) - List Products\n- [`productsUpdate`](docs/sdks/products/README.md#update) - Update Product\n- [`productsUpdateBenefits`](docs/sdks/products/README.md#updatebenefits) - Update Product Benefits\n- [`refundsCreate`](docs/sdks/refunds/README.md#create) - Create Refund\n- [`refundsList`](docs/sdks/refunds/README.md#list) - List Refunds\n- [`subscriptionsCreate`](docs/sdks/subscriptions/README.md#create) - Create Subscription\n- [`subscriptionsExport`](docs/sdks/subscriptions/README.md#export) - Export Subscriptions\n- [`subscriptionsGet`](docs/sdks/subscriptions/README.md#get) - Get Subscription\n- [`subscriptionsList`](docs/sdks/subscriptions/README.md#list) - List Subscriptions\n- [`subscriptionsRevoke`](docs/sdks/subscriptions/README.md#revoke) - Revoke Subscription\n- [`subscriptionsUpdate`](docs/sdks/subscriptions/README.md#update) - Update Subscription\n- [`webhooksCreateWebhookEndpoint`](docs/sdks/webhooks/README.md#createwebhookendpoint) - Create Webhook Endpoint\n- [`webhooksDeleteWebhookEndpoint`](docs/sdks/webhooks/README.md#deletewebhookendpoint) - Delete Webhook Endpoint\n- [`webhooksGetWebhookEndpoint`](docs/sdks/webhooks/README.md#getwebhookendpoint) - Get Webhook Endpoint\n- [`webhooksListWebhookDeliveries`](docs/sdks/webhooks/README.md#listwebhookdeliveries) - List Webhook Deliveries\n- [`webhooksListWebhookEndpoints`](docs/sdks/webhooks/README.md#listwebhookendpoints) - List Webhook Endpoints\n- [`webhooksRedeliverWebhookEvent`](docs/sdks/webhooks/README.md#redeliverwebhookevent) - Redeliver Webhook Event\n- [`webhooksResetWebhookEndpointSecret`](docs/sdks/webhooks/README.md#resetwebhookendpointsecret) - Reset Webhook Endpoint Secret\n- [`webhooksUpdateWebhookEndpoint`](docs/sdks/webhooks/README.md#updatewebhookendpoint) - Update Webhook Endpoint\n\n\u003c/details\u003e\n\u003c!-- End Standalone functions [standalone-funcs] --\u003e\n\n\u003c!-- Start Pagination [pagination] --\u003e\n## Pagination\n\nSome of the endpoints in this SDK support pagination. To use pagination, you\nmake your SDK calls as usual, but the returned response object will also be an\nasync iterable that can be consumed using the [`for await...of`][for-await-of]\nsyntax.\n\n[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of\n\nHere's an example of one such pagination call:\n\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n  accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await polar.organizations.list({});\n\n  for await (const page of result) {\n    console.log(page);\n  }\n}\n\nrun();\n\n```\n\u003c!-- End Pagination [pagination] --\u003e\n\n\u003c!-- Start Retries [retries] --\u003e\n## Retries\n\nSome of the endpoints in this SDK support retries.  If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API.  However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.\n\nTo change the default retry strategy for a single API call, simply provide a retryConfig object to the call:\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n  accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await polar.organizations.list({}, {\n    retries: {\n      strategy: \"backoff\",\n      backoff: {\n        initialInterval: 1,\n        maxInterval: 50,\n        exponent: 1.1,\n        maxElapsedTime: 100,\n      },\n      retryConnectionErrors: false,\n    },\n  });\n\n  for await (const page of result) {\n    console.log(page);\n  }\n}\n\nrun();\n\n```\n\nIf you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n  retryConfig: {\n    strategy: \"backoff\",\n    backoff: {\n      initialInterval: 1,\n      maxInterval: 50,\n      exponent: 1.1,\n      maxElapsedTime: 100,\n    },\n    retryConnectionErrors: false,\n  },\n  accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await polar.organizations.list({});\n\n  for await (const page of result) {\n    console.log(page);\n  }\n}\n\nrun();\n\n```\n\u003c!-- End Retries [retries] --\u003e\n\n\u003c!-- Start Error Handling [errors] --\u003e\n## Error Handling\n\n[`PolarError`](./src/models/errors/polarerror.ts) is the base class for all HTTP error responses. It has the following properties:\n\n| Property            | Type       | Description                                                                             |\n| ------------------- | ---------- | --------------------------------------------------------------------------------------- |\n| `error.message`     | `string`   | Error message                                                                           |\n| `error.statusCode`  | `number`   | HTTP response status code eg `404`                                                      |\n| `error.headers`     | `Headers`  | HTTP response headers                                                                   |\n| `error.body`        | `string`   | HTTP body. Can be empty string if no body is returned.                                  |\n| `error.rawResponse` | `Response` | Raw HTTP response                                                                       |\n| `error.data$`       |            | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |\n\n### Example\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\nimport { HTTPValidationError } from \"@polar-sh/sdk/models/errors/httpvalidationerror.js\";\nimport { PolarError } from \"@polar-sh/sdk/models/errors/polarerror.js.js\";\n\nconst polar = new Polar({\n  accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n  try {\n    const result = await polar.organizations.list({});\n\n    for await (const page of result) {\n      console.log(page);\n    }\n  } catch (error) {\n    // The base class for HTTP error responses\n    if (error instanceof PolarError) {\n      console.log(error.message);\n      console.log(error.statusCode);\n      console.log(error.body);\n      console.log(error.headers);\n\n      // Depending on the method different errors may be thrown\n      if (error instanceof HTTPValidationError) {\n        console.log(error.data$.detail); // ValidationError[]\n      }\n    }\n  }\n}\n\nrun();\n\n```\n\n### Error Classes\n**Primary errors:**\n* [`PolarError`](./src/models/errors/polarerror.ts): The base class for HTTP error responses.\n  * [`HTTPValidationError`](./src/models/errors/httpvalidationerror.ts): Validation Error. Status code `422`. *\n\n\u003cdetails\u003e\u003csummary\u003eLess common errors (25)\u003c/summary\u003e\n\n\u003cbr /\u003e\n\n**Network errors:**\n* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.\n* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.\n* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.\n* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.\n* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.\n\n\n**Inherit from [`PolarError`](./src/models/errors/polarerror.ts)**:\n* [`ResourceNotFound`](./src/models/errors/resourcenotfound.ts): Status code `404`. Applicable to 82 of 169 methods.*\n* [`NotPermitted`](./src/models/errors/notpermitted.ts): Status code `403`. Applicable to 10 of 169 methods.*\n* [`Unauthorized`](./src/models/errors/unauthorized.ts): Not authorized to manage license key. Status code `401`. Applicable to 5 of 169 methods.*\n* [`AlreadyCanceledSubscription`](./src/models/errors/alreadycanceledsubscription.ts): Status code `403`. Applicable to 4 of 169 methods.*\n* [`AlreadyActiveSubscriptionError`](./src/models/errors/alreadyactivesubscriptionerror.ts): The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments. Status code `403`. Applicable to 3 of 169 methods.*\n* [`NotOpenCheckout`](./src/models/errors/notopencheckout.ts): The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments. Status code `403`. Applicable to 3 of 169 methods.*\n* [`PaymentNotReady`](./src/models/errors/paymentnotready.ts): The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments. Status code `403`. Applicable to 3 of 169 methods.*\n* [`TrialAlreadyRedeemed`](./src/models/errors/trialalreadyredeemed.ts): The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments. Status code `403`. Applicable to 3 of 169 methods.*\n* [`ExpiredCheckoutError`](./src/models/errors/expiredcheckouterror.ts): The checkout session is expired. Status code `410`. Applicable to 3 of 169 methods.*\n* [`PaymentFailed`](./src/models/errors/paymentfailed.ts): Payment required to apply the subscription update. Status code `402`. Applicable to 2 of 169 methods.*\n* [`SubscriptionLocked`](./src/models/errors/subscriptionlocked.ts): Subscription is pending an update. Status code `409`. Applicable to 2 of 169 methods.*\n* [`MissingInvoiceBillingDetails`](./src/models/errors/missinginvoicebillingdetails.ts): Order is not paid or is missing billing name or address. Status code `422`. Applicable to 2 of 169 methods.*\n* [`NotPaidOrder`](./src/models/errors/notpaidorder.ts): Order is not paid or is missing billing name or address. Status code `422`. Applicable to 2 of 169 methods.*\n* [`PaymentError`](./src/models/errors/paymenterror.ts): The payment failed. Status code `400`. Applicable to 1 of 169 methods.*\n* [`CustomerNotReady`](./src/models/errors/customernotready.ts): Customer is not ready to confirm a payment method. Status code `400`. Applicable to 1 of 169 methods.*\n* [`PaymentMethodInUseByActiveSubscription`](./src/models/errors/paymentmethodinusebyactivesubscription.ts): Payment method is used by active subscription(s). Status code `400`. Applicable to 1 of 169 methods.*\n* [`RefundedAlready`](./src/models/errors/refundedalready.ts): Order is already fully refunded. Status code `403`. Applicable to 1 of 169 methods.*\n* [`PaymentAlreadyInProgress`](./src/models/errors/paymentalreadyinprogress.ts): Payment already in progress. Status code `409`. Applicable to 1 of 169 methods.*\n* [`OrderNotEligibleForRetry`](./src/models/errors/ordernoteligibleforretry.ts): Order not eligible for retry or payment confirmation failed. Status code `422`. Applicable to 1 of 169 methods.*\n* [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.\n\n\u003c/details\u003e\n\n\\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.\n\u003c!-- End Error Handling [errors] --\u003e\n\n\u003c!-- Start Server Selection [server] --\u003e\n## Server Selection\n\n### Select Server by Name\n\nYou can override the default server globally by passing a server name to the `server: keyof typeof ServerList` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:\n\n| Name         | Server                         | Description            |\n| ------------ | ------------------------------ | ---------------------- |\n| `production` | `https://api.polar.sh`         | Production environment |\n| `sandbox`    | `https://sandbox-api.polar.sh` | Sandbox environment    |\n\n#### Example\n\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n  server: \"production\",\n  accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await polar.organizations.list({});\n\n  for await (const page of result) {\n    console.log(page);\n  }\n}\n\nrun();\n\n```\n\n### Override Server URL Per-Client\n\nThe default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n  serverURL: \"https://api.polar.sh\",\n  accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await polar.organizations.list({});\n\n  for await (const page of result) {\n    console.log(page);\n  }\n}\n\nrun();\n\n```\n\u003c!-- End Server Selection [server] --\u003e\n\n\u003c!-- Start Custom HTTP Client [http-client] --\u003e\n## Custom HTTP Client\n\nThe TypeScript SDK makes API calls using an `HTTPClient` that wraps the native\n[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This\nclient is a thin wrapper around `fetch` and provides the ability to attach hooks\naround the request lifecycle that can be used to modify the request or handle\nerrors and response.\n\nThe `HTTPClient` constructor takes an optional `fetcher` argument that can be\nused to integrate a third-party HTTP client or when writing tests to mock out\nthe HTTP client and feed in fixtures.\n\nThe following example shows how to:\n- route requests through a proxy server using [undici](https://www.npmjs.com/package/undici)'s ProxyAgent\n- use the `\"beforeRequest\"` hook to add a custom header and a timeout to requests\n- use the `\"requestError\"` hook to log errors\n\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\nimport { ProxyAgent } from \"undici\";\nimport { HTTPClient } from \"@polar-sh/sdk/lib/http\";\n\nconst dispatcher = new ProxyAgent(\"http://proxy.example.com:8080\");\n\nconst httpClient = new HTTPClient({\n  // 'fetcher' takes a function that has the same signature as native 'fetch'.\n  fetcher: (input, init) =\u003e\n    // 'dispatcher' is specific to undici and not part of the standard Fetch API.\n    fetch(input, { ...init, dispatcher } as RequestInit),\n});\n\nhttpClient.addHook(\"beforeRequest\", (request) =\u003e {\n  const nextRequest = new Request(request, {\n    signal: request.signal || AbortSignal.timeout(5000)\n  });\n\n  nextRequest.headers.set(\"x-custom-header\", \"custom value\");\n\n  return nextRequest;\n});\n\nhttpClient.addHook(\"requestError\", (error, request) =\u003e {\n  console.group(\"Request Error\");\n  console.log(\"Reason:\", `${error}`);\n  console.log(\"Endpoint:\", `${request.method} ${request.url}`);\n  console.groupEnd();\n});\n\nconst sdk = new Polar({ httpClient: httpClient });\n```\n\u003c!-- End Custom HTTP Client [http-client] --\u003e\n\n\u003c!-- Start Authentication [security] --\u003e\n## Authentication\n\n### Per-Client Security Schemes\n\nThis SDK supports the following security scheme globally:\n\n| Name          | Type | Scheme      | Environment Variable |\n| ------------- | ---- | ----------- | -------------------- |\n| `accessToken` | http | HTTP Bearer | `POLAR_ACCESS_TOKEN` |\n\nTo authenticate with the API the `accessToken` parameter must be set when initializing the SDK client instance. For example:\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n  accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await polar.organizations.list({});\n\n  for await (const page of result) {\n    console.log(page);\n  }\n}\n\nrun();\n\n```\n\n### Per-Operation Security Schemes\n\nSome operations in this SDK require the security scheme to be specified at the request level. For example:\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n  const result = await polar.customerPortal.benefitGrants.list({}, {});\n\n  for await (const page of result) {\n    console.log(page);\n  }\n}\n\nrun();\n\n```\n\u003c!-- End Authentication [security] --\u003e\n\n\u003c!-- Start Debugging [debug] --\u003e\n## Debugging\n\nYou can setup your SDK to emit debug logs for SDK requests and responses.\n\nYou can pass a logger that matches `console`'s interface as an SDK option.\n\n\u003e [!WARNING]\n\u003e Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.\n\n```typescript\nimport { Polar } from \"@polar-sh/sdk\";\n\nconst sdk = new Polar({ debugLogger: console });\n```\n\nYou can also enable a default debug logger by setting an environment variable `POLAR_DEBUG` to true.\n\u003c!-- End Debugging [debug] --\u003e\n\n\u003c!-- Placeholder for Future Speakeasy SDK Sections --\u003e\n\n# Development\n\n## Maturity\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage\nto a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally\nlooking for the latest version.\n\n## Contributions\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. \nWe look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release. \n\n### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@polar-sh/sdk\u0026utm_campaign=typescript)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolarsource%2Fpolar-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolarsource%2Fpolar-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolarsource%2Fpolar-js/lists"}