G2A Pay requires an IPN Notification URL during setup to receive notifications in WHMCS that allow the system to mark invoices as paid automatically. The precise URL to use is your WHMCS root directory followed by /modules/gateways/callback/g2apay.php. For example, if your WHMCS billing portal is located at https://billing.aspnix.com, then the full IPN URL becomes https://billing.aspnix.com/modules/gateways/callback/g2apay.php.
This server-to-server callback is a standard feature in payment gateway integrations. Without it, you would need to manually verify and update each transaction, which does not scale for a hosting business. The handler script validates the incoming data from G2A Pay before updating your database.
#What IPN Means and Why It Matters
Instant Payment Notification (IPN) is an automated message sent from the payment processor to your web server. G2A Pay uses IPN to inform WHMCS of events such as a completed purchase, failed transaction, or refund. The notification is delivered via an HTTP request to the URL you provide, typically containing transaction details in POST variables.
This mechanism is more reliable than relying solely on the user being redirected back to a success page after payment. Network issues, browser crashes, or user error cannot prevent the notification from arriving. In WHMCS, the g2apay.php callback file listens for these notifications, authenticates them using shared secrets or keys configured in the gateway settings, and then applies the payment to the relevant invoice. The process runs in the background, updates invoice status, records the transaction ID, and can trigger further automation rules such as service activation or email confirmations.
#Constructing the Correct G2A Pay Callback URL
The URL to the G2A Pay callback handler is WHMCS_ROOT/modules/gateways/callback/g2apay.php. Make sure to replace WHMCS_ROOT with your WHMCS installation URL. For example, ours is https://billing.aspnix.com/modules/gateways/callback/g2apay.php. This path assumes a standard WHMCS directory structure where the modules folder resides in the web root.
https://billing.aspnix.com/modules/gateways/callback/g2apay.php
#Steps to Configure the IPN URL
- Determine your exact WHMCS base URL by navigating to your client area or admin dashboard and noting the domain and any subdirectories.
- Append the fixed path /modules/gateways/callback/g2apay.php to that base URL.
- Log in to your G2A Pay account and locate the IPN or webhook configuration area for your integration. Paste the complete URL into the IPN Notification URL field and save the settings.
#Common Configuration Pitfalls
- Leaving the placeholder WHMCS_ROOT in the URL instead of substituting your real domain and path.
- Specifying an incorrect path that does not point to the g2apay.php handler or using a URL that requires authentication.
- Mismatched protocol (http vs https) which can trigger security warnings or delivery failures on the G2A Pay side.
- Firewall or .htaccess rules that inadvertently block POST requests from G2A Pay servers.
Test your setup by processing a sample transaction through G2A Pay and confirming that the associated WHMCS invoice updates its status, records the transaction, and activates any linked services without manual intervention. Check the WHMCS gateway transaction logs for any errors if notifications do not arrive or process correctly.
Correct IPN configuration streamlines your billing operations and improves customer experience by ensuring timely account activations following payment. Always validate the URL after any changes to your site structure, domain, or SSL settings.
Comments
No comments yet