Skip to content

Webhook

Bakhtarian edited this page May 14, 2026 · 2 revisions

Webhook

A webhook registers an HTTPS endpoint that Whop calls when subscribed events occur — letting your application react to payments, memberships, and other changes in real time.

SDK access

$client->webhooks // Matchable\Whop\Resource\WebhookResource

Endpoints

create(array $data): WebhookResponse

HTTP POST webhooks
Does Registers a new webhook endpoint.
Parameters $data — webhook attributes (e.g. url, the list of events to subscribe to).
Returns Matchable\Whop\Dto\Webhook\WebhookResponse — a typed DTO, not a plain array.

Note: Unlike most resources in this SDK, WebhookResource::create does not return a raw array. It returns a typed WebhookResponse DTO with the properties id (string), url (?string), and events (list<string>). If the API response is missing the required id field, a MissingArgumentsException is thrown.

Example

$webhook = $client->webhooks->create([
    'url' => 'https://example.com/whop/webhook',
    'events' => ['payment.succeeded', 'membership.went_valid'],
]);

echo $webhook->id;
echo $webhook->url;
foreach ($webhook->events as $event) {
    echo $event;
}

Reference

Official Whop documentation: https://docs.whop.com

Clone this wiki locally