›
byrcsc/laravel-payrex · 1.x
Create and manage PayRex webhook endpoints through PHP or Artisan.
The webhook resource manages the remote endpoints to which PayRex delivers events. Receiving deliveries is a separate concern covered in receiving webhooks.
use ByRcsc\LaravelPayrex\Facades\Payrex;
$endpoint = Payrex::webhooks()->create(
url: route('payrex.webhook'),
events: [
'payment_intent.succeeded',
'refund.updated',
],
description: 'Production Laravel application',
);
$endpoint->secretKey;Copy the returned signing secret to PAYREX_WEBHOOK_SECRET immediately.
PayRex will not show it in full again.
$endpoint = Payrex::webhooks()->retrieve('wh_...');
$page = Payrex::webhooks()->list(limit: 25);
foreach (Payrex::webhooks()->autoPaging() as $endpoint) {
// ...
}
$endpoints = Payrex::webhooks()->paginate(perPage: 20);The WebhookEndpoint object includes id, url, status, description,
secretKey, events, livemode, timestamps, and raw. Use isEnabled() for
a status check.
$endpoint = Payrex::webhooks()->update(
id: 'wh_...',
url: 'https://example.com/payrex/webhook',
events: [
'payment_intent.succeeded',
'refund.created',
'refund.updated',
],
description: 'Primary endpoint',
);Only non-null values are sent.
$endpoint = Payrex::webhooks()->disable('wh_...');
$endpoint = Payrex::webhooks()->enable('wh_...');
$deleted = Payrex::webhooks()->delete('wh_...');Disable an endpoint to pause deliveries without removing its configuration. Delete it when PayRex should stop delivering permanently.
Register an endpoint. Omit --event to subscribe to every type mapped in
config/payrex.php:
php artisan payrex:webhook-create "https://example.com/payrex/webhook"Repeat --event to choose types:
php artisan payrex:webhook-create "https://example.com/payrex/webhook" \
--event="payment_intent.succeeded" \
--event="refund.updated" \
--description="Production"List the first page or every page:
php artisan payrex:webhook-list --limit=25
php artisan payrex:webhook-list --allUpdate an endpoint:
php artisan payrex:webhook-update wh_... \
--url="https://example.com/payrex/webhook" \
--event="payment_intent.succeeded" \
--description="Primary endpoint"Enable or disable:
php artisan payrex:webhook-toggle wh_... --enable
php artisan payrex:webhook-toggle wh_... --disableDelete with an interactive confirmation or skip it explicitly:
php artisan payrex:webhook-delete wh_...
php artisan payrex:webhook-delete wh_... --forceDispatch a synthetic event without contacting PayRex:
php artisan payrex:webhook-test
php artisan payrex:webhook-test "payment_intent.succeeded"The command dispatches PayrexWebhookReceived and the configured typed event.
Its payload is deliberately minimal and unsigned. It proves that Laravel
listener wiring works; it does not prove signature verification or
compatibility with every real PayRex field.