Payment gateways are the lifeblood of modern SaaS and e‑commerce apps. But when you’re dealing with Razorpay or Paytm webhooks, things can get messy fast:
- Duplicate events
- Signature mismatches
- Silent failures that never reach your logs
In production, these issues can cost real money. That’s where Laravel Telescope’s advanced watchers come in. Telescope isn’t just a debugging tool for local development anymore — with the right configuration, it becomes a real‑time observability layer for your payment flows.
🚀 Why Telescope for Webhooks?
Laravel Telescope provides a suite of watchers that track requests, jobs, exceptions, queries, and more. For webhook monitoring, the key benefits are:
- Request Watcher: Captures incoming webhook payloads.
- Log Watcher: Stores custom logs for signature validation and event handling.
- Exception Watcher: Flags failed webhook processing instantly.
- Custom Watchers: Extend Telescope to track domain‑specific events like Razorpay payment captures or Paytm refunds.
Instead of digging through server logs, you get a beautiful dashboard with searchable, filterable entries.
🛠️ Step 1: Install & Configure Telescope
composer require laravel/telescope
php artisan telescope:install
php artisan migrate
In config/telescope.php, ensure you enable watchers relevant to webhooks:
'watchers' => [
Watchers\RequestWatcher::class => true,
Watchers\LogWatcher::class => true,
Watchers\ExceptionWatcher::class => true,
Watchers\QueryWatcher::class => true,
],
📊 Step 2: Capture Razorpay/Paytm Webhook Requests
Webhook endpoints typically look like this:
Route::post('/webhooks/razorpay', [WebhookController::class, 'handleRazorpay']);
Route::post('/webhooks/paytm', [WebhookController::class, 'handlePaytm']);
Inside your controller, log the raw payload:
public function handleRazorpay(Request $request)
{
\Log::info('Razorpay Webhook Received', $request->all());
// Telescope will capture this log
// Add signature validation here
}
Telescope’s Request Watcher will show the full request body, headers, and response.
🎨 Step 3: Validate Signatures & Log Outcomes
Both Razorpay and Paytm send signatures to verify authenticity. Example for Razorpay:
use Razorpay\Api\Errors\SignatureVerificationError;
public function handleRazorpay(Request $request)
{
$payload = $request->getContent();
$signature = $request->header('X-Razorpay-Signature');
try {
$expectedSignature = hash_hmac('sha256', $payload, config('services.razorpay.secret'));
if ($signature !== $expectedSignature) {
throw new SignatureVerificationError('Invalid signature');
}
\Log::info('Razorpay Webhook Validated', ['event' => $request->input('event')]);
} catch (SignatureVerificationError $e) {
\Log::error('Razorpay Signature Failed', ['error' => $e->getMessage()]);
}
}
Telescope’s Log Watcher will display both success and failure cases.
📈 Step 4: Monitor Exceptions in Production
If webhook handling fails (e.g., database deadlock, job dispatch error), Telescope’s Exception Watcher captures the stack trace. This gives you immediate visibility into production issues without tailing logs.
🔧 Step 5: Create a Custom Watcher for Payments
You can extend Telescope with a custom watcher to track domain‑specific events:
namespace App\Telescope;
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Watchers\Watcher;
class PaymentWatcher extends Watcher
{
public function register($app)
{
Telescope::recordCustom('payments', function () {
return IncomingEntry::make([
'gateway' => 'Razorpay',
'status' => 'captured',
'amount' => 5000,
]);
});
}
}
This creates a Payments tab in Telescope where you can see webhook outcomes at a glance.
🌐 Real‑World Workflow
- Razorpay sends a
payment.capturedwebhook. - Telescope’s Request Watcher logs the payload.
- Signature validation passes → Log Watcher records success.
- Job dispatch fails → Exception Watcher flags the error.
- Custom Payment Watcher shows the event in a dedicated tab.
You now have end‑to‑end visibility of your payment pipeline.
🔮 Looking Ahead
By 2025, observability is no longer optional. With gateways like Razorpay and Paytm powering critical revenue streams, silent webhook failures can cost thousands. Laravel Telescope’s advanced watchers give you:
- Transparency: See every request and response.
- Accountability: Track signature validation and event handling.
- Resilience: Catch exceptions before they snowball.
Telescope isn’t just for debugging anymore — it’s your production monitoring ally.
🧭 Final Thoughts
If you’re running Laravel apps with Razorpay or Paytm integrations, don’t rely on blind logging. Configure Telescope’s advanced watchers and gain real‑time visibility into your webhook flows.
Your server — and your revenue — will thank you.
