Payment Due Webhook Integration Guide

This guide explains the exact webhook URL/path and integration steps for both Web backend and Android.

1) Webhook Paths

Local testing path (already available in Laravel)

https://chronextechnologies.com/demo/pos/api/webhooks/payment-due/test-receiver

Production path (receiver in client system)

https://your-domain.com/webhooks/payment-due/receive

Set this production URL inside each device row: device_payment_dues.client_webhook_url.

2) Payload You Must Send

{
  "device_id": "IMEI_NUMBER"
}

3) Required Headers

Content-Type: application/json
Accept: application/json
X-Webhook-Token: your-secret-token (optional but recommended)

4) Web Integration (PHP/Laravel/Node Backend)

Your web backend should expose a POST endpoint, receive payload, identify device using device_id, and update status.

Identify which device to notify using: device_id

Expected response to webhook sender

{
  "status": true,
  "message": "received"
}

5) Android Integration (Important)

Android app should not directly receive webhooks. Webhook must go to Android team's backend API first.

Recommended Android backend path

https://api.android-team.com/webhooks/payment-due/receive

6) Curl Test Commands

Local receiver test

curl -X POST "https://chronextechnologies.com/demo/pos/api/webhooks/payment-due/test-receiver" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "device_id":"LOCAL_IMEI_001"
  }'

Production/client backend test

curl -X POST "https://your-domain.com/webhooks/payment-due/receive" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Webhook-Token: your-secret-token" \
  -d '{
    "device_id":"356938035643809"
  }'

7) Laravel Sender Commands

# Process real due webhooks from DB
php artisan payments:process-due-webhooks --days=2

# Manual webhook send test
php artisan payments:test-webhook "https://chronextechnologies.com/demo/pos/api/webhooks/payment-due/test-receiver" \
  --device_id=LOCAL_IMEI_001

8) Logs and Debugging

# View latest webhook logs
tail -n 100 storage/logs/payment-webhook-$(date +%Y-%m-%d).log

9) Final Checklist