- listWebhookEndpoints - List Webhook Endpoints
- createWebhookEndpoint - Create Webhook Endpoint
- getWebhookEndpoint - Get Webhook Endpoint
- deleteWebhookEndpoint - Delete Webhook Endpoint
- updateWebhookEndpoint - Update Webhook Endpoint
- resetWebhookEndpointSecret - Reset Webhook Endpoint Secret
- listWebhookDeliveries - List Webhook Deliveries
- redeliverWebhookEvent - Redeliver Webhook Event
List webhook endpoints.
Scopes: webhooks:read webhooks:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$responses = $sdk->webhooks->listWebhookEndpoints(
organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',
page: 1,
limit: 10
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
organizationId |
string|array|null | ➖ | Filter by organization ID. |
page |
?int | ➖ | Page number, defaults to 1. |
limit |
?int | ➖ | Size of a page, defaults to 10. Maximum is 100. |
?Operations\WebhooksListWebhookEndpointsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Create a webhook endpoint.
Scopes: webhooks:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Components\WebhookEndpointCreate(
url: 'https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0',
format: Components\WebhookFormat::Slack,
events: [
Components\WebhookEventType::SubscriptionUncanceled,
],
organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',
);
$response = $sdk->webhooks->createWebhookEndpoint(
request: $request
);
if ($response->webhookEndpoint !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Components\WebhookEndpointCreate | ✔️ | The request object to use for the request. |
?Operations\WebhooksCreateWebhookEndpointResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Get a webhook endpoint by ID.
Scopes: webhooks:read webhooks:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->webhooks->getWebhookEndpoint(
id: '<value>'
);
if ($response->webhookEndpoint !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | ✔️ | The webhook endpoint ID. |
?Operations\WebhooksGetWebhookEndpointResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ResourceNotFound | 404 | application/json |
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Delete a webhook endpoint.
Scopes: webhooks:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->webhooks->deleteWebhookEndpoint(
id: '<value>'
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | ✔️ | The webhook endpoint ID. |
?Operations\WebhooksDeleteWebhookEndpointResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ResourceNotFound | 404 | application/json |
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Update a webhook endpoint.
Scopes: webhooks:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$webhookEndpointUpdate = new Components\WebhookEndpointUpdate(
url: 'https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0',
);
$response = $sdk->webhooks->updateWebhookEndpoint(
id: '<value>',
webhookEndpointUpdate: $webhookEndpointUpdate
);
if ($response->webhookEndpoint !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | ✔️ | The webhook endpoint ID. |
webhookEndpointUpdate |
Components\WebhookEndpointUpdate | ✔️ | N/A |
?Operations\WebhooksUpdateWebhookEndpointResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ResourceNotFound | 404 | application/json |
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Regenerate a webhook endpoint secret.
Scopes: webhooks:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->webhooks->resetWebhookEndpointSecret(
id: '<value>'
);
if ($response->webhookEndpoint !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | ✔️ | The webhook endpoint ID. |
?Operations\WebhooksResetWebhookEndpointSecretResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ResourceNotFound | 404 | application/json |
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
List webhook deliveries.
Deliveries are all the attempts to deliver a webhook event to an endpoint.
Scopes: webhooks:read webhooks:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\WebhooksListWebhookDeliveriesRequest();
$responses = $sdk->webhooks->listWebhookDeliveries(
request: $request
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\WebhooksListWebhookDeliveriesRequest | ✔️ | The request object to use for the request. |
?Operations\WebhooksListWebhookDeliveriesResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Schedule the re-delivery of a webhook event.
Scopes: webhooks:write
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->webhooks->redeliverWebhookEvent(
id: '<value>'
);
if ($response->any !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | ✔️ | The webhook event ID. |
?Operations\WebhooksRedeliverWebhookEventResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ResourceNotFound | 404 | application/json |
| Errors\HTTPValidationError | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |