---
url: /payglocal-whmcs/backup-and-restore.md
description: >-
  How to back up PayGlocal for WHMCS — there is no built-in backup system, so
  use standard WHMCS database backups plus a copy of your RSA .pem keys.
---

# Backup and restore

PayGlocal has **no built-in backup system**. Protect your deployment using standard WHMCS
procedures: back up your database, module files, and RSA `.pem` keys before maintenance.

## Back up before every update

Because a [manual update](/payglocal-whmcs/updating) overwrites files directly, always take a backup
first. Capture:

* **WHMCS database backup:** Stores gateway configuration (License Key, Merchant ID, key
  paths, KIDs, mode), stored recurring mandates (`mod_payglocalrecurring_mandates`), and
  transaction records via your standard backup routine.
* **The gateway files you're about to overwrite:**
  * `modules/gateways/payglocal.php`
  * `modules/gateways/payglocalrecurring.php`
  * `modules/gateways/payglocal/` (the whole directory)
  * `modules/gateways/callback/payglocal.php`
  * `modules/gateways/callback/payglocalrecurring.php`
  * `includes/hooks/payglocalrecurring_cron.php`
* **A copy of your RSA `.pem` keys** — the merchant private key and the PayGlocal public key, with a
  note of their paths and KIDs.

::: warning Don't casually regenerate your RSA keys
Your merchant private key and its KID are tied to your PayGlocal account. Regenerating keys in the
GCC dashboard invalidates the old pair — only do it deliberately, and update the gateway settings to
match. A backup copy means you never lose a working key.
:::

## Where backups are stored

* **Database location:** Follows your WHMCS or hosting backup schedule. Keep an off-server copy.
* **Key storage:** Keep `.pem` backups outside the web root with `chmod 640` permissions.

## Rolling back

To return to a previous working state after a bad update or server change:

1. **Restore module files:** Re-upload previous release files to `modules/`, overwriting current files.
2. **Restore `.pem` keys:** Place key files back into their configured server paths if modified.
3. **Restore database:** Roll back the WHMCS database backup if gateway settings were altered.
4. **Validate:** In **Setup → Payment Gateways → PayGlocal**, verify settings, click **Save Changes**, and run a sandbox test payment.

## Related pages

* [Updating](/payglocal-whmcs/updating) — back up first, then overwrite files
* [Configuration](/payglocal-whmcs/configuration) — the settings held in the database
* [PayGlocal key setup](/payglocal-whmcs/guides/payglocal-keys) — where the `.pem` keys come from
* [Troubleshooting](/payglocal-whmcs/troubleshooting)
