Problem: When customers paid for an invoice in a different currency than their account's base currency, WHMCS incorrectly interpreted the payment amount, resulting in overpayment credits.
Example:
- Invoice: £5.00 (GBP)
- Customer selects USD at checkout: $6.68
- PayNow correctly charges: $6.68
- Bug: WHMCS thought customer paid £6.68, created £1.68 overpayment credit
- Fix: Now uses invoice's original amount as authoritative value when currencies don't match
Changes:
- Modified
paynowgg_callback_handleOrderCompleted()to detect currency mismatches - When payment currency differs from invoice currency, uses the invoice's billing amount (in its own currency) to prevent overpayment
- Logs currency mismatches to gateway log for audit trail
Impact: Fixes overpayment issues when customers change currencies during PayNow checkout
Feature: PayNow subscriptions now automatically create renewal invoices in WHMCS when PayNow sends subscription renewal events.
How it works:
- Customer purchases hosting/addon with subscription enabled
- PayNow stores subscription details and tracks renewal dates
- When renewal is due, PayNow sends
ON_SUBSCRIPTION_RENEWEDwebhook - WHMCS automatically creates a renewal invoice with the amount PayNow charged
- Invoice is marked "Sent" and can be auto-billed per your WHMCS settings
Setup Requirements:
- Enable "Allow Subscriptions" in WHMCS PayNow.gg gateway settings ✓ (now defaults to ON)
- Configure PayNow webhook to send:
ON_SUBSCRIPTION_RENEWEDevents - Ensure PayNow webhook endpoint is:
https://YOUR-DOMAIN/modules/gateways/callback/paynowgg.php
Invoice Generation:
- Renewal invoices are created automatically with:
- Renewal amount from PayNow
- Description: "Renewal: [domain/addon name]"
- Due date: 7 days from creation
- Status: "Sent" (ready for auto-billing)
Currency Handling:
- Renewal amounts use PayNow's currency
- If different from store currency, the system logs it and uses the renewal amount as-is
- WHMCS handles multi-currency conversions internally
Enable Auto-Billing (Optional but recommended):
- Set up auto-billing in WHMCS for subscriptions to auto-charge customer payment methods
- WHMCS → Configuration → Settings → Invoices → Auto-bill enabled invoices
- Create JSON webhook endpoint pointing to:
https://YOUR-DOMAIN/modules/gateways/callback/paynowgg.php - Subscribe to these webhook events:
-
ON_ORDER_COMPLETED(required for one-time payments) -
ON_SUBSCRIPTION_ACTIVATED(tracks subscriptions) -
ON_SUBSCRIPTION_RENEWED(handles renewal invoices) ← NEW -
ON_REFUND(optional, for audit trail) -
ON_CHARGEBACK(optional, for audit trail)
-
- Go to Setup → Payment Gateways → PayNow.gg
- Ensure "Allow Subscriptions" is enabled (defaults to ON)
- Configure auto-billing if desired:
- Setup → Settings → Invoices
- Check "Enable Auto-Billing" option
- Set acceptable payment methods
- Create a hosting product with "Billing Cycle" set to "Monthly" (or any recurring cycle)
- Create an invoice with this product
- Pay through PayNow using subscription checkout
- In PayNow Dashboard, manually trigger a test
ON_SUBSCRIPTION_RENEWEDevent OR wait for next renewal date - Check WHMCS - renewal invoice should be created automatically
callback/paynowgg.php: Currency handling & subscription renewal logicpaynowgg.php: Documentation update for subscription feature
paynowgg_callback_handleOrderCompleted(): Added currency mismatch detectionpaynowgg_callback_handleSubscriptionEvent(): Added renewal event routingpaynowgg_callback_handleSubscriptionRenewal(): NEW - Creates renewal invoices
All currency mismatches and subscription renewals are logged to WHMCS gateway log for auditing:
- View: Setup → Logs → Module Log → PayNow.gg
- Check webhook configuration in PayNow dashboard
- Verify webhook is sending
ON_SUBSCRIPTION_RENEWEDevents - Check WHMCS gateway log: Setup → Logs → Module Log → PayNow.gg
- Ensure subscription was properly linked (look for "subscription_id" in hosting record)
- Clear WHMCS cache: Go to Utilities → System Cleanup
- Refresh payment gateway settings
- Check gateway log for "currency mismatch" entries
- If issue persists, contact PayNow support to verify exchange rates used
- Check PayNow dashboard - verify renewal charge amount
- Check WHMCS gateway log for any currency conversion notices
- If WHMCS currency differs from PayNow currency, system logs the difference
If you need to revert to version 1.0.4:
- Replace
callback/paynowgg.phpandpaynowgg.phpwith backup copies - Disable subscription events in PayNow webhook configuration
- Restart WHMCS cache
When reporting issues, please include:
- WHMCS version
- PHP version
- PayNow.gg module version (shown in gateway settings)
- Relevant entries from: Setup → Logs → Module Log → PayNow.gg
- Invoice details (ID, amount, currency)
- PayNow order/subscription ID (from receipt or PayNow dashboard)