- list - List Subscriptions
- get - Get Subscription
- cancel - Cancel Subscription
- update - Update Subscription
List subscriptions of the authenticated customer.
Scopes: customer_portal:read customer_portal:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$request = new Operations\CustomerPortalSubscriptionsListRequest();
$requestSecurity = new Operations\CustomerPortalSubscriptionsListSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$responses = $sdk->customerPortal->subscriptions->list(
request: $request,
security: $requestSecurity
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\CustomerPortalSubscriptionsListRequest | ✔️ | The request object to use for the request. |
security |
Operations\CustomerPortalSubscriptionsListSecurity | ✔️ | The security requirements to use for the request. |
?Operations\CustomerPortalSubscriptionsListResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Get a subscription for the authenticated customer.
Scopes: customer_portal:read customer_portal:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalSubscriptionsGetSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->subscriptions->get(
security: $requestSecurity,
id: '<value>'
);
if ($response->customerSubscription !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
security |
Operations\CustomerPortalSubscriptionsGetSecurity | ✔️ | The security requirements to use for the request. |
id |
string | ✔️ | The subscription ID. |
?Operations\CustomerPortalSubscriptionsGetResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ResourceNotFound | 404 | application/json |
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Cancel a subscription of the authenticated customer.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalSubscriptionsCancelSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->subscriptions->cancel(
security: $requestSecurity,
id: '<value>'
);
if ($response->customerSubscription !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
security |
Operations\CustomerPortalSubscriptionsCancelSecurity | ✔️ | The security requirements to use for the request. |
id |
string | ✔️ | The subscription ID. |
?Operations\CustomerPortalSubscriptionsCancelResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\AlreadyCanceledSubscription | 403 | application/json |
| Errors\ResourceNotFound | 404 | application/json |
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Update a subscription of the authenticated customer.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalSubscriptionsUpdateSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->subscriptions->update(
security: $requestSecurity,
id: '<value>',
customerSubscriptionUpdate: new Components\CustomerSubscriptionCancel()
);
if ($response->customerSubscription !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
security |
Operations\CustomerPortalSubscriptionsUpdateSecurity | ✔️ | The security requirements to use for the request. |
id |
string | ✔️ | The subscription ID. |
customerSubscriptionUpdate |
Components\CustomerSubscriptionUpdateProduct|Components\CustomerSubscriptionUpdateSeats|Components\CustomerSubscriptionCancel | ✔️ | N/A |
?Operations\CustomerPortalSubscriptionsUpdateResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\PaymentFailed | 402 | application/json |
| Errors\AlreadyCanceledSubscription | 403 | application/json |
| Errors\ResourceNotFound | 404 | application/json |
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |