›
›
›
  1. docs
  2. ›
  3. byrcsc/laravel-payrex
1.x
Browse documentationOpenClose

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Client and resources
  • Data objects and enums
  • Errors and retries
  • Pagination

Accepting payments

  • Payment intents
  • Checkout sessions
  • Setup intents
  • Payments and refunds

Customers and billing

  • Customers
  • Eloquent customers
  • Billing statements
  • Payouts

Webhooks

  • Receiving webhooks
  • Events and listeners
  • Managing endpoints

Advanced usage

  • Testing
  • Security and operations
  • Troubleshooting

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Client and resources
  • Data objects and enums
  • Errors and retries
  • Pagination

Accepting payments

  • Payment intents
  • Checkout sessions
  • Setup intents
  • Payments and refunds

Customers and billing

  • Customers
  • Eloquent customers
  • Billing statements
  • Payouts

Webhooks

  • Receiving webhooks
  • Events and listeners
  • Managing endpoints

Advanced usage

  • Testing
  • Security and operations
  • Troubleshooting

byrcsc/laravel-payrex · 1.x

Managing endpoints.

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.

Create an endpoint

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.

Retrieve, list, and paginate

$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.

Update an endpoint

$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.

Enable, disable, or delete

$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.

Artisan commands

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 --all

Update 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_... --disable

Delete with an interactive confirmation or skip it explicitly:

php artisan payrex:webhook-delete wh_...
php artisan payrex:webhook-delete wh_... --force

Test listener wiring

Dispatch 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.

What to read next

  • Receiving webhooks to configure the route used by an endpoint.
  • Events and listeners to process verified deliveries.
  • Security and operations to protect the endpoint and its signing secret.
PreviousEvents and listenersNextTesting

Laravel PayRex is an unofficial community SDK and is not affiliated with PayRex.

View source

On this page

  1. Create an endpoint
  2. Retrieve, list, and paginate
  3. Update an endpoint
  4. Enable, disable, or delete
  5. Artisan commands
  6. Test listener wiring
  7. What to read next