This guide explains how to configure WhatsApp notifications for sending QR codes and Lightning links after successful payments using the chandachewe/whatsapp package.
After a successful Lenco payment, the system will automatically:
- Send a WhatsApp message with transaction details
- Include the Lightning link (LNURL)
- Send the QR code image
- WhatsApp Business API account
- Business Phone Number ID
- Access Token from Meta for Developers
Add these to your .env file:
WHATSAPP_VERSION=v19.0
WHATSAPP_BUSINESS_PHONE_NUMBER_ID=your_business_phone_number_id
WHATSAPP_TOKEN=your_whatsapp_access_token
WHATSAPP_BASE_URI=https://graph.facebook.comNote: WHATSAPP_BASE_URI is optional and defaults to https://graph.facebook.com if not specified.
- Go to Meta for Developers
- Create a WhatsApp Business App
- Get your Business Phone Number ID from the app dashboard
- Generate an Access Token with
whatsapp_business_messagingpermission - Copy the values to your
.envfile
- User completes payment via Lenco
- System creates LNURL withdrawal QR code
- WhatsApp message is automatically sent to user's phone number with:
- Payment confirmation
- Transaction details (SATS, ZMW)
- Lightning link (LNURL)
- QR code image
The system automatically formats Zambian phone numbers for WhatsApp Business API:
0971176778→260971176778+260971176778→260971176778260971176778→260971176778(unchanged)
Note: WhatsApp Business API uses phone numbers without the + prefix.
To test the WhatsApp integration:
- Complete a test payment
- Check Laravel logs for WhatsApp sending status
- Verify the message is received on the test phone number
- Messages not sending: Check your WhatsApp API credentials in
.env - QR code not showing: Ensure the QR code URL is publicly accessible
- Phone number errors: Verify phone number format in logs
- BASE_URI errors: Ensure
WHATSAPP_BASE_URIis set (defaults tohttps://graph.facebook.com)
- WhatsApp sending failures won't block the payment process
- All WhatsApp attempts are logged for debugging
- The QR code URL must be publicly accessible for the image to send