What it is
The storefront is the billing module, in the panel's modules/billing folder. It is a small PHP site with its own pages: plans and prices, cart, sign up and sign in, checkout, invoices, My Servers, support tickets and a status page. You serve that folder as its own website, on its own domain, next to the panel.
It is not a separate program. It reads and writes the panel's database and calls the panel's own code, so an order made on the storefront becomes a panel account and a game server with no copying or syncing.
The module is required. The panel does not let you switch it off, and updates keep it in place. One result is that the storefront's status page can always show the Control Panel as online: if you can see the page, the panel that serves it is running.
How it fits together
| Part | Where it runs | What it does |
|---|---|---|
| Storefront | shop.example.com | Public pages: plans, sign up, cart, checkout, invoices, support, status. |
| Panel | panel.example.com | Administration, game server control, tickets and settings. Customers sign in here after they buy. |
| Database | The panel's MySQL or MariaDB database | One database for both. The storefront reads the panel's database settings, so you do not enter them twice. |
| Agents | Your game hosts | The storefront asks the panel to create the game server. The panel tells the agent to install it. |
| Payment provider | PayPal, Stripe or manual | Takes the money and tells the storefront when it is paid. |
The two sites can share one modules/billing code tree. Both the panel and the storefront read the same files from the same panel install, so one panel update updates both.
Before you start
- A working panel. Install the panel first (see Download) and sign in as the admin. Add at least one remote agent and a game, so an order has somewhere to go.
- A web server. Apache 2.4 with
mod_rewriteand PHP, or nginx with PHP-FPM. The examples below were tested with Apache 2.4 and nginx 1.24 on PHP 8.3. - Two host names. One for the storefront and one for the panel, for example
shop.example.comandpanel.example.com. The storefront can use the bare domain, for exampleexample.com. - HTTPS. Customers sign in and pay on this site. Use a certificate, for example from Let's Encrypt.
- Mail. Order and password reset emails go out through the panel's mail settings and PHP
mail(). Set the mail options in Panel Settings and send yourself a test. - A payment account with PayPal or Stripe, unless you take payment by hand.
Step 1: Point the domain at the server
At your DNS provider, add an A record for the storefront name that points to the public IPv4 address of the web server. Add an AAAA record as well if the server has a public IPv6 address.
| Type | Name | Value |
|---|---|---|
| A | shop | The web server's public IPv4 address |
| A | www.shop (optional) | The same address, or a CNAME to shop |
| A | panel | The same address, if the panel is on the same server |
If you use the bare domain for the storefront, the name is @. Wait until the name resolves before you ask for a certificate; dig +short shop.example.com should print your address.
Step 2: Create the virtual host
The document root is the panel's modules/billing folder. Use your own install path in place of /var/www/html/GSE/Panel. The web server user must be able to read the whole panel tree, because the storefront loads panel code.
Apache
Enable the modules, add the file and enable it. AllowOverride All matters: the folder's .htaccess blocks the configuration, SQL and library folders, so without it those would be readable.
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-available/shop.example.com.conf
sudo a2ensite shop.example.com
sudo apachectl configtest && sudo systemctl reload apache2
The file:
<VirtualHost *:80>
ServerName shop.example.com
ServerAlias www.shop.example.com
DocumentRoot /var/www/html/GSE/Panel/modules/billing
<Directory /var/www/html/GSE/Panel/modules/billing>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/shop.example.com-error.log
CustomLog ${APACHE_LOG_DIR}/shop.example.com-access.log combined
</VirtualHost>
nginx
nginx does not read .htaccess, so the same protections are written into the server block. Do not leave them out. Change the PHP-FPM socket to match your PHP version.
server {
listen 80;
listen [::]:80;
server_name shop.example.com www.shop.example.com;
root /var/www/html/GSE/Panel/modules/billing;
index index.php;
autoindex off;
access_log /var/log/nginx/shop.example.com-access.log;
error_log /var/log/nginx/shop.example.com-error.log;
# Let Let's Encrypt reach its challenge files. This must come before the dot-file rule.
location ^~ /.well-known/acme-challenge/ {
allow all;
}
# nginx ignores .htaccess, so the same protections are written out here.
location ~ ^/(_archived|classes|includes|sql|tools|data|logs|config)(/|$) {
return 403;
}
location ~ ^/site_config(\.local|\.example)?\.php$ {
return 403;
}
location ~ /\. {
return 403;
}
location ~* \.(bak|backup|sql|md|json|log|txt|ya?ml|lock)$ {
return 403;
}
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
}
Save it in /etc/nginx/sites-available/, link it into sites-enabled, then run sudo nginx -t && sudo systemctl reload nginx.
HTTPS
With the host serving on port 80, ask for a certificate. certbot adds the port 443 block and the redirect for you.
sudo certbot --apache -d shop.example.com -d www.shop.example.com
# or, for nginx:
sudo certbot --nginx -d shop.example.com -d www.shop.example.com
Open the site. You should see the storefront home page. Then check that /site_config.php and /includes/ answer 403 Forbidden. If either one shows anything else, stop and fix the virtual host before you go on.
Step 3: Configure the storefront
Put your settings in modules/billing/site_config.local.php. It is not in git, so updates never overwrite it. site_config.php holds the defaults, and site_config.example.php lists the keys.
<?php
// modules/billing/site_config.local.php (not in git; overrides site_config.php)
return [
// The storefront has its own host, so it sits at the domain root.
'base_path' => '',
// Where the panel lives on disk. Needed only if billing is copied outside the panel tree.
'panel_path' => '',
// Where the Control Panel link and shared pictures point.
'panel_base' => 'https://panel.example.com',
// Key file for the stored PayPal secret. Keep it outside the web root.
'paypal_key_file' => '/etc/gse/paypal.key',
// Which wording to use (see "Your own wording" below). Empty means the neutral default.
'content_profile' => '',
'brand' => [
'name' => 'Your Store Name',
'company' => 'Your Company',
'tagline' => 'Game server hosting with human support.',
'email' => 'support@example.com',
'discord_url' => 'https://discord.gg/yourinvite',
],
];
| Key | What it does |
|---|---|
base_path | URL path the storefront is served from. Leave it empty on its own host. Use /panel/modules/billing only when you serve it from inside the panel's own site. |
panel_path | Panel folder on disk, when the storefront code is outside the panel tree. |
panel_base | Panel address. Used for the Control Panel link, and for shared pictures and themes. |
paypal_key_file | File that holds the key used to encrypt the PayPal secret in the database. Create it outside the web root and let only the web server user read it. |
content_profile | Name of a file in modules/billing/content/ that holds your own storefront wording. Empty uses the neutral default text. |
brand | Name, company, tagline, support email and Discord link shown on the site. The name can also come from Panel Settings. Empty values fall back to the defaults. |
To change the logo, replace the PNG files in images/brand/ and keep the file names. The panel logo and name come from Panel Settings.
The storefront can be installed as an app. Visitors can add it to their phone or computer home screen, and it opens full screen with your icon. It needs HTTPS. The icons are gse-icon-192.png and gse-icon-mark.png (512 px) in images/brand/. Pages and forms are never stored on the device, so prices and orders are always current; only images, styles and scripts are kept, and an offline page appears when the connection drops.
Your own wording
Every text on the storefront comes from a content profile, not from the code. A new install uses content/default.php, which describes the product and says nothing about who runs it. To tell your own story, copy that file to modules/billing/content/yourname.php, keep only the texts you want to change, and set 'content_profile' => 'yourname' in site_config.local.php.
- Lists (the game tiles, the trust points, the address lines) replace the default list. Other groups of texts merge, so you only write what differs.
{name},{company}and{email}are filled in from the brand settings.- The address, phone number and the Careers page are part of the content, so they are empty in the default and you add your own.
- A single text can also be changed with a
'content'group insite_config.local.php, without a profile file. - The Terms and Privacy pages are legal text written for the operator of the main site. Replace them with your own before you take orders.
Step 4: Set up the catalogue and payment
Everything below is in the panel under Administration, in the Billing pages. Nothing is edited in files.
- Locations and plans. Choose which agents can take orders, and what each game plan costs, per slot and per period.
- Coupons (optional).
- A gateway. Choose how customers pay (see below).
- A test order. Place one yourself in sandbox mode before you open the shop.
PayPal
- In the billing admin, open the PayPal section and choose
sandboxorlive. - Enter the client ID and secret from the PayPal developer dashboard, then press Test connection. The secret is stored encrypted with the key in
paypal_key_file. - In PayPal, register a webhook that points at
https://shop.example.com/paypal/webhook.php. Subscribe it toCHECKOUT.ORDER.APPROVED,PAYMENT.CAPTURE.COMPLETED,PAYMENT.CAPTURE.DENIED,PAYMENT.CAPTURE.REFUNDEDandPAYMENT.SALE.COMPLETED. - Copy the webhook ID PayPal gives you into the billing admin. The storefront checks every webhook against it.
Refunds are made through PayPal and the storefront updates the invoice when the refund event arrives.
Stripe and manual payment
Stripe and a manual (offline) gateway are available beside PayPal. The gateway classes live in modules/billing/classes and one is chosen from the billing settings. With manual payment an admin marks the invoice paid after the money arrives.
Keep payment keys out of git. Enter them only in the billing admin or in site_config.local.php.
How an order becomes a game server
- The customer picks a game, slots, location and period, and adds it to the cart.
- Checkout creates an invoice first. Nothing is provisioned yet.
- The customer pays. PayPal returns the customer to the site, and the webhook confirms the payment in the background, so a customer who closes the tab still gets their server.
- The invoice is marked paid. The lifecycle service creates the game home on the chosen agent and activates it.
- The customer opens My Servers or the panel to start and manage the server.
Free orders skip the payment step. Servers an admin creates in the panel are not billed.
Services besides game servers
Under Administration, Billing, Services you can sell work as well as servers: server setup, custom development, or anything you name. Each service has a short description, a fixed price or a quote, the steps it is paid in, and the questions the customer answers. The storefront lists them on the Services page.
- The customer picks a service and answers its questions. A fixed price creates the invoice for the first step at once; a quote opens only the ticket.
- Every order opens a support ticket named after the service, so the work is tracked and answered in the usual Support tickets.
- For a quote, you enter the price on the Requests table. The customer then finds the invoice in the cart.
- A job can be paid in steps, for example 50% to start and 50% on delivery. When the work reaches the next step, press Bill next step.
- Paying a service invoice never creates a game server. It moves the request on and writes a note in the ticket.
The Support page has a Request type menu. It starts on Support Request; choosing a paid service takes the customer to that service's order form. The starter services come with example prices: set your own before you go live.
Accounts
- Registration on the storefront creates a normal panel account with the user role. It is the same account for both sites, with the same username and password.
- Each site keeps its own sign-in session, because a login cookie belongs to one host name. A customer signs in once on the storefront and once on the panel.
- Password reset sends an email link. If the mail does not arrive, check the panel's mail settings first.
- Admin accounts are managed in the panel. Do not give customers the admin role.
- Customer data (name, email, orders, invoices) stays in your database. Say so in your privacy page; the storefront has its own privacy and terms pages that you can edit.
The status page
The support page has a small status monitor. It shows the Control Panel, each remote agent and the game servers.
- The Control Panel line is always Online. The page is served by the panel code, so if the page loads, the panel is up.
- Agent and game server lines come from a saved snapshot. It is refreshed when someone visits and the snapshot is more than a minute old, so it stays current without extra setup.
- To refresh it even when nobody visits, add a cron job:
* * * * * www-data php /var/www/html/GSE/Panel/modules/billing/tools/refresh_status_snapshot.php.
Scheduled jobs
Run the billing cron once a morning. It sends renewal invoices and expiry notices, suspends services at expiry and removes them after the grace period. It only touches services that have an expiry date.
0 6 * * * www-data php /var/www/html/GSE/Panel/cron/cron-shop.php
Updating
Update the panel as usual. The storefront is part of it, so nothing separate is needed. Your site_config.local.php, the key file and the billing settings in the database are kept. After an update, open the storefront and run one test order.
Troubleshooting
| Symptom | Check |
|---|---|
| Blank page or 500 error | The web server user cannot read the panel tree, or PHP is missing a module. Read the site's error log. |
/includes/ or /site_config.php opens | Apache: AllowOverride All and mod_rewrite are on, and you updated the panel to a version with the current .htaccess. nginx: the deny rules are in the server block. |
| Pages or images have broken links | base_path is wrong for how you serve the site, or panel_base is missing. |
| Paid, but no server | Check the webhook delivery log in PayPal, then the invoice in the billing admin. The webhook URL must be HTTPS and reachable from the internet. |
| Sign-in works on one site only | Expected. Each host has its own session. Sign in on both. |
| An agent shows offline on the status page | The agent is down or the panel cannot reach it. Open its page under Remote Agents. |
Security notes
- Serve the storefront only over HTTPS and redirect port 80.
- Keep the PayPal key file,
site_config.local.phpand the database password out of git and out of the web root's reach. - Never serve the repository root. The document root is
modules/billing, and nothing above it. - Keep the panel and the operating system updated.