Update IP and port in WHMCS
When you create a game server with the billing API WHMCS does not get updated with the game server's IP and port. You can configure a recurring in TCAdmin to update the WHMCS database every day:
- Go to Settings > Recurring Tasks.
- Create a new recurring task and configure it to execute daily.
- In the Actions tab add a new action of type "Sync Service IP with Billing".
- Enter the information required to connect to your WHMCS database. If you use custom billing software you can specify a custom SQL update command.
- When the task runs the product's domain field in WHMCS should have the game server's IP and port.
Update WHMCS when the game server is created
You can use this script if you want to update WHMCS right after the game server is created.
Add the following IronPython script for the game's After Created event. Update the following variables with the correct information: mysql_server, mysql_user, mysql_password, mysql_database
import clr; import System; clr.AddReference("TCAdmin.DatabaseProviders.MySql"); clr.AddReference("TCAdmin.SDK"); from TCAdmin.DatabaseProviders.MySql import MySqlManager; from System import String; mysql_server="WHMCSIP"; mysql_user="WHMCSUSER"; mysql_password="WHMCSPASSWORD"; mysql_database="WHMCSDATABASE"; with MySqlManager() as mysql: mysql.Connect(String.Format("Data Source={0};User Id={1};Password={2};Database={3};Pooling=False;", mysql_server, mysql_user, mysql_password, mysql_database)); mysql.ExecuteNonQuery(String.Format("UPDATE tblhosting SET domain='{0}' WHERE id='{1}'", ThisService.ConnectionInfo, ThisService.BillingId));