Skip to main content
A reliable backup strategy is essential for any payment platform. This guide covers what to back up, how to automate backups, how to restore from a backup, and how to export data for external use.

What to back up

You need to protect four categories of data:
The .env file contains your ENCRYPTION_KEY. Without it, you cannot decrypt customer PII or gateway credentials stored in the database. Always include .env in your backups.

Database backup

Use mysqldump with the --single-transaction flag to produce a consistent snapshot without locking tables during the dump.
The --single-transaction flag uses InnoDB’s MVCC to create a consistent snapshot. This is safe for production databases because it does not block reads or writes.

File backup

Archive the application files, excluding dependencies that can be reinstalled and temporary files that are regenerated automatically.
Then copy the .env file separately with restricted permissions:

Automated backup script

Create a shell script that produces timestamped database and file backups, and rotates old backups to prevent disk exhaustion.
Make it executable and schedule it with cron:

Restore procedure

Follow these steps to restore an OwnPay installation from backup.

Pre-update backups

OwnPay’s built-in UpdateService automatically creates a database backup and file snapshot before applying any update. These backups are stored in storage/backups/pre-update-{version}/.
Automatic pre-update backups are a safety net, not a replacement for your own backup schedule. If the update process itself fails catastrophically (disk full, permissions error), the automatic backup may not have completed. Always maintain independent backups.

Data export

For compliance, accounting, or migration purposes, you can export data without a full database backup.
  • Transactions - Filter by date range, status, or gateway on the Transactions page, then click Export CSV. This includes amount, fee, net amount, currency, status, and gateway reference.
  • Reports - The Reports page generates summary data that can be exported as CSV for import into accounting software.
  • Customer data - Export individual customer records or bulk-export all customers for a brand. This includes all PII in decrypted form for GDPR data portability requests.

Last modified on August 25, 2026