Inbox Processor / Handler

It is like the Queue Worker, you need to create the handler classes and register for the particular topic.

Simply bind your own Handler class using addProcessor method from our helper. You can add multiple processors, Inbox Process will loop through all of them and execute.

use ShipSaasInboxProcess\InboxProcessSetup;

// AppServiceProvider@boot
InboxProcessSetup::addProcessor(
    'stripe', 
    StripeInvoiceWebhookHandler::class
);
InboxProcessSetup::addProcessor(
    'stripe', 
    StripePaymentWebhookHandler::class
);

The Inbox Process will either use the handle method or __invoke.

Your processor class will be resolved using the super cool dependency injection powered by Laravel.

class StripeInvoiceWebhookHandler 
{
    public function __construct(
        private StripeClient $stripeClient
    ) {}

    public function handle(array $payload): void
    {
        if ($payload['type'] !== 'invoice') {
            return;
        }
        
        // handle this request
    }
}

Last updated