(customerPortal->subscriptions)
- cancel - Cancel Subscription
- get - Get Subscription
- list - List Subscriptions
- update - Update Subscription
Cancel a subscription of the authenticated customer or user.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$response = $sdk->customerPortal->subscriptions->cancel(
id: '<value>'
);
if ($response->customerSubscription !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
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 | */* |
Get a subscription for the authenticated customer or user.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$response = $sdk->customerPortal->subscriptions->get(
id: '<value>'
);
if ($response->customerSubscription !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
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 | */* |
List subscriptions of the authenticated customer or user.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$request = new Operations\CustomerPortalSubscriptionsListRequest();
$responses = $sdk->customerPortal->subscriptions->list(
request: $request
);
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. |
?Operations\CustomerPortalSubscriptionsListResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Update a subscription of the authenticated customer or user.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$customerSubscriptionUpdate = new Components\CustomerSubscriptionUpdate(
productPriceId: '<value>',
);
$response = $sdk->customerPortal->subscriptions->update(
id: '<value>',
customerSubscriptionUpdate: $customerSubscriptionUpdate
);
if ($response->customerSubscription !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The subscription ID. |
customerSubscriptionUpdate |
Components\CustomerSubscriptionUpdate | ✔️ | N/A |
?Operations\CustomerPortalSubscriptionsUpdateResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ResourceNotFound | 404 | application/json |
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |