Download the PHP package polar-sh/sdk without Composer
On this page you can find all versions of the php package polar-sh/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sdk
polar-sh/sdk
Developer-friendly & type-safe Php SDK specifically catered to leverage polar-sh/sdk API.
[!IMPORTANT] This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.
Summary
Polar API: Polar HTTP and Webhooks API
Read the docs at https://docs.polar.sh/api-reference
Table of Contents
- polar-sh/sdk
- SDK Installation
- SDK Example Usage
- Authentication
- Available Resources and Operations
- Pagination
- Error Handling
- Server Selection
- Development
- Maturity
- Contributions
SDK Installation
The SDK relies on Composer to manage its dependencies.
To install the SDK and add it as a dependency to an existing composer.json
file:
SDK Example Usage
Example
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
accessToken |
http | HTTP Bearer |
To authenticate with the API the accessToken
parameter must be set when initializing the SDK. For example:
Per-Operation Security Schemes
Some operations in this SDK require the security scheme to be specified at the request level. For example:
Available Resources and Operations
Available methods
### [benefits](docs/sdks/benefits/README.md) * [list](docs/sdks/benefits/README.md#list) - List Benefits * [create](docs/sdks/benefits/README.md#create) - Create Benefit * [get](docs/sdks/benefits/README.md#get) - Get Benefit * [update](docs/sdks/benefits/README.md#update) - Update Benefit * [delete](docs/sdks/benefits/README.md#delete) - Delete Benefit * [grants](docs/sdks/benefits/README.md#grants) - List Benefit Grants ### [checkoutLinks](docs/sdks/checkoutlinks/README.md) * [list](docs/sdks/checkoutlinks/README.md#list) - List Checkout Links * [create](docs/sdks/checkoutlinks/README.md#create) - Create Checkout Link * [get](docs/sdks/checkoutlinks/README.md#get) - Get Checkout Link * [update](docs/sdks/checkoutlinks/README.md#update) - Update Checkout Link * [delete](docs/sdks/checkoutlinks/README.md#delete) - Delete Checkout Link ### [checkouts](docs/sdks/checkouts/README.md) * [list](docs/sdks/checkouts/README.md#list) - List Checkout Sessions * [create](docs/sdks/checkouts/README.md#create) - Create Checkout Session * [get](docs/sdks/checkouts/README.md#get) - Get Checkout Session * [update](docs/sdks/checkouts/README.md#update) - Update Checkout Session * [clientGet](docs/sdks/checkouts/README.md#clientget) - Get Checkout Session from Client * [clientUpdate](docs/sdks/checkouts/README.md#clientupdate) - Update Checkout Session from Client * [clientConfirm](docs/sdks/checkouts/README.md#clientconfirm) - Confirm Checkout Session from Client ### [customerMeters](docs/sdks/customermeters/README.md) * [list](docs/sdks/customermeters/README.md#list) - List Customer Meters * [get](docs/sdks/customermeters/README.md#get) - Get Customer Meter ### [customerPortal](docs/sdks/customerportal/README.md) #### [customerPortal->benefitGrants](docs/sdks/benefitgrants/README.md) * [list](docs/sdks/benefitgrants/README.md#list) - List Benefit Grants * [get](docs/sdks/benefitgrants/README.md#get) - Get Benefit Grant * [update](docs/sdks/benefitgrants/README.md#update) - Update Benefit Grant #### [customerPortal->customerMeters](docs/sdks/polarcustomermeters/README.md) * [list](docs/sdks/polarcustomermeters/README.md#list) - List Meters * [get](docs/sdks/polarcustomermeters/README.md#get) - Get Customer Meter #### [customerPortal->customers](docs/sdks/polarcustomers/README.md) * [get](docs/sdks/polarcustomers/README.md#get) - Get Customer * [update](docs/sdks/polarcustomers/README.md#update) - Update Customer * [listPaymentMethods](docs/sdks/polarcustomers/README.md#listpaymentmethods) - List Customer Payment Methods * [addPaymentMethod](docs/sdks/polarcustomers/README.md#addpaymentmethod) - Add Customer Payment Method * [deletePaymentMethod](docs/sdks/polarcustomers/README.md#deletepaymentmethod) - Delete Customer Payment Method #### [customerPortal->downloadables](docs/sdks/downloadables/README.md) * [list](docs/sdks/downloadables/README.md#list) - List Downloadables #### [customerPortal->licenseKeys](docs/sdks/polarlicensekeys/README.md) * [list](docs/sdks/polarlicensekeys/README.md#list) - List License Keys * [get](docs/sdks/polarlicensekeys/README.md#get) - Get License Key * [validate](docs/sdks/polarlicensekeys/README.md#validate) - Validate License Key * [activate](docs/sdks/polarlicensekeys/README.md#activate) - Activate License Key * [deactivate](docs/sdks/polarlicensekeys/README.md#deactivate) - Deactivate License Key #### [customerPortal->orders](docs/sdks/polarorders/README.md) * [list](docs/sdks/polarorders/README.md#list) - List Orders * [get](docs/sdks/polarorders/README.md#get) - Get Order * [update](docs/sdks/polarorders/README.md#update) - Update Order * [generateInvoice](docs/sdks/polarorders/README.md#generateinvoice) - Generate Order Invoice * [invoice](docs/sdks/polarorders/README.md#invoice) - Get Order Invoice * [getPaymentStatus](docs/sdks/polarorders/README.md#getpaymentstatus) - Get Order Payment Status * [confirmRetryPayment](docs/sdks/polarorders/README.md#confirmretrypayment) - Confirm Retry Payment #### [customerPortal->organizations](docs/sdks/polarorganizations/README.md) * [get](docs/sdks/polarorganizations/README.md#get) - Get Organization #### [customerPortal->subscriptions](docs/sdks/polarsubscriptions/README.md) * [list](docs/sdks/polarsubscriptions/README.md#list) - List Subscriptions * [get](docs/sdks/polarsubscriptions/README.md#get) - Get Subscription * [update](docs/sdks/polarsubscriptions/README.md#update) - Update Subscription * [cancel](docs/sdks/polarsubscriptions/README.md#cancel) - Cancel Subscription ### [customers](docs/sdks/customers/README.md) * [list](docs/sdks/customers/README.md#list) - List Customers * [create](docs/sdks/customers/README.md#create) - Create Customer * [get](docs/sdks/customers/README.md#get) - Get Customer * [update](docs/sdks/customers/README.md#update) - Update Customer * [delete](docs/sdks/customers/README.md#delete) - Delete Customer * [getExternal](docs/sdks/customers/README.md#getexternal) - Get Customer by External ID * [updateExternal](docs/sdks/customers/README.md#updateexternal) - Update Customer by External ID * [deleteExternal](docs/sdks/customers/README.md#deleteexternal) - Delete Customer by External ID * [getState](docs/sdks/customers/README.md#getstate) - Get Customer State * [getStateExternal](docs/sdks/customers/README.md#getstateexternal) - Get Customer State by External ID ### [customerSessions](docs/sdks/customersessions/README.md) * [create](docs/sdks/customersessions/README.md#create) - Create Customer Session ### [customFields](docs/sdks/customfields/README.md) * [list](docs/sdks/customfields/README.md#list) - List Custom Fields * [create](docs/sdks/customfields/README.md#create) - Create Custom Field * [get](docs/sdks/customfields/README.md#get) - Get Custom Field * [update](docs/sdks/customfields/README.md#update) - Update Custom Field * [delete](docs/sdks/customfields/README.md#delete) - Delete Custom Field ### [discounts](docs/sdks/discounts/README.md) * [list](docs/sdks/discounts/README.md#list) - List Discounts * [create](docs/sdks/discounts/README.md#create) - Create Discount * [get](docs/sdks/discounts/README.md#get) - Get Discount * [update](docs/sdks/discounts/README.md#update) - Update Discount * [delete](docs/sdks/discounts/README.md#delete) - Delete Discount ### [events](docs/sdks/events/README.md) * [list](docs/sdks/events/README.md#list) - List Events * [listNames](docs/sdks/events/README.md#listnames) - List Event Names * [get](docs/sdks/events/README.md#get) - Get Event * [ingest](docs/sdks/events/README.md#ingest) - Ingest Events ### [files](docs/sdks/files/README.md) * [list](docs/sdks/files/README.md#list) - List Files * [create](docs/sdks/files/README.md#create) - Create File * [uploaded](docs/sdks/files/README.md#uploaded) - Complete File Upload * [update](docs/sdks/files/README.md#update) - Update File * [delete](docs/sdks/files/README.md#delete) - Delete File ### [licenseKeys](docs/sdks/licensekeys/README.md) * [list](docs/sdks/licensekeys/README.md#list) - List License Keys * [get](docs/sdks/licensekeys/README.md#get) - Get License Key * [update](docs/sdks/licensekeys/README.md#update) - Update License Key * [getActivation](docs/sdks/licensekeys/README.md#getactivation) - Get Activation * [validate](docs/sdks/licensekeys/README.md#validate) - Validate License Key * [activate](docs/sdks/licensekeys/README.md#activate) - Activate License Key * [deactivate](docs/sdks/licensekeys/README.md#deactivate) - Deactivate License Key ### [meters](docs/sdks/meters/README.md) * [list](docs/sdks/meters/README.md#list) - List Meters * [create](docs/sdks/meters/README.md#create) - Create Meter * [get](docs/sdks/meters/README.md#get) - Get Meter * [update](docs/sdks/meters/README.md#update) - Update Meter * [quantities](docs/sdks/meters/README.md#quantities) - Get Meter Quantities ### [metrics](docs/sdks/metrics/README.md) * [get](docs/sdks/metrics/README.md#get) - Get Metrics * [limits](docs/sdks/metrics/README.md#limits) - Get Metrics Limits ### [oauth2](docs/sdks/oauth2/README.md) * [authorize](docs/sdks/oauth2/README.md#authorize) - Authorize * [token](docs/sdks/oauth2/README.md#token) - Request Token * [revoke](docs/sdks/oauth2/README.md#revoke) - Revoke Token * [introspect](docs/sdks/oauth2/README.md#introspect) - Introspect Token * [userinfo](docs/sdks/oauth2/README.md#userinfo) - Get User Info ### [orders](docs/sdks/orders/README.md) * [list](docs/sdks/orders/README.md#list) - List Orders * [get](docs/sdks/orders/README.md#get) - Get Order * [update](docs/sdks/orders/README.md#update) - Update Order * [generateInvoice](docs/sdks/orders/README.md#generateinvoice) - Generate Order Invoice * [invoice](docs/sdks/orders/README.md#invoice) - Get Order Invoice ### [organizations](docs/sdks/organizations/README.md) * [list](docs/sdks/organizations/README.md#list) - List Organizations * [create](docs/sdks/organizations/README.md#create) - Create Organization * [get](docs/sdks/organizations/README.md#get) - Get Organization * [update](docs/sdks/organizations/README.md#update) - Update Organization ### [payments](docs/sdks/payments/README.md) * [list](docs/sdks/payments/README.md#list) - List Payments * [get](docs/sdks/payments/README.md#get) - Get Payment ### [products](docs/sdks/products/README.md) * [list](docs/sdks/products/README.md#list) - List Products * [create](docs/sdks/products/README.md#create) - Create Product * [get](docs/sdks/products/README.md#get) - Get Product * [update](docs/sdks/products/README.md#update) - Update Product * [updateBenefits](docs/sdks/products/README.md#updatebenefits) - Update Product Benefits ### [refunds](docs/sdks/refunds/README.md) * [list](docs/sdks/refunds/README.md#list) - List Refunds * [create](docs/sdks/refunds/README.md#create) - Create Refund ### [subscriptions](docs/sdks/subscriptions/README.md) * [list](docs/sdks/subscriptions/README.md#list) - List Subscriptions * [export](docs/sdks/subscriptions/README.md#export) - Export Subscriptions * [get](docs/sdks/subscriptions/README.md#get) - Get Subscription * [update](docs/sdks/subscriptions/README.md#update) - Update Subscription * [revoke](docs/sdks/subscriptions/README.md#revoke) - Revoke Subscription ### [webhooks](docs/sdks/webhooks/README.md) * [listWebhookEndpoints](docs/sdks/webhooks/README.md#listwebhookendpoints) - List Webhook Endpoints * [createWebhookEndpoint](docs/sdks/webhooks/README.md#createwebhookendpoint) - Create Webhook Endpoint * [getWebhookEndpoint](docs/sdks/webhooks/README.md#getwebhookendpoint) - Get Webhook Endpoint * [updateWebhookEndpoint](docs/sdks/webhooks/README.md#updatewebhookendpoint) - Update Webhook Endpoint * [deleteWebhookEndpoint](docs/sdks/webhooks/README.md#deletewebhookendpoint) - Delete Webhook Endpoint * [resetWebhookEndpointSecret](docs/sdks/webhooks/README.md#resetwebhookendpointsecret) - Reset Webhook Endpoint Secret * [listWebhookDeliveries](docs/sdks/webhooks/README.md#listwebhookdeliveries) - List Webhook Deliveries * [redeliverWebhookEvent](docs/sdks/webhooks/README.md#redeliverwebhookevent) - Redeliver Webhook EventPagination
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned object will be a Generator
instead of an individual response.
Working with generators is as simple as iterating over the responses in a foreach
loop, and you can see an example below:
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default an API error will raise a Errors\APIException
exception, which has the following properties:
Property | Type | Description |
---|---|---|
$message |
string | The error message |
$statusCode |
int | The HTTP status code |
$rawResponse |
?\Psr\Http\Message\ResponseInterface | The raw HTTP response |
$body |
string | The response content |
When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the list
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Example
Server Selection
Select Server by Name
You can override the default server globally using the setServer(string $serverName)
builder method 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:
Name | Server | Description |
---|---|---|
production |
https://api.polar.sh |
Production environment |
sandbox |
https://sandbox-api.polar.sh |
Sandbox environment |
Example
Override Server URL Per-Client
The default server can also be overridden globally using the setServerUrl(string $serverUrl)
builder method when initializing the SDK client instance. For example:
Development
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While 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. We 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.
SDK Created by Speakeasy
All versions of sdk with dependencies
galbar/jsonpath Version >=3.0
guzzlehttp/guzzle Version ^7.0
speakeasy/serializer Version ^4.0.3
brick/date-time Version >=0.7.0
phpdocumentor/type-resolver Version >=1.8
brick/math Version >=0.12.1