### Implement Extension Installation/Uninstallation/Upgrade Hooks Source: https://github.com/paymenter/docs/blob/v1/development/extensions/index.md Use the `installed` hook for initial setup, `uninstalled` for cleanup, and `upgraded` for version-specific updates. These hooks can manage migrations and other essential tasks. ```php 'Your Theme Name', 'author' => 'Your Name', 'url' => 'https://yourwebsite.com', 'config' => [ [ 'name' => 'primary_color', 'label' => 'Primary Color', 'type' => 'color', 'default' => '#3490dc', 'description' => 'The primary color used throughout the theme.', 'required' => true, ], [ 'name' => 'custom_css', 'label' => 'Custom CSS', 'type' => 'textarea', 'default' => '', 'description' => 'Add custom CSS to override default styles.', 'required' => false, ], ], ]; ``` -------------------------------- ### Copy Environment File Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Copies the example environment file to create the actual .env configuration file. ```bash cp .env.example .env ``` -------------------------------- ### Install NPM Dependencies Source: https://github.com/paymenter/docs/blob/v1/docs/installation/docker.md Use the asset-builder service to install Node.js dependencies for Paymenter. ```bash docker compose run --rm asset-builder npm install ``` -------------------------------- ### Install Certbot for Nginx Source: https://github.com/paymenter/docs/blob/v1/docs/installation/ssl.md Install the Certbot package with Nginx support using apt. ```bash sudo apt install -y python3-certbot-nginx ``` -------------------------------- ### Revert to Default Theme Source: https://github.com/paymenter/docs/blob/v1/docs/guides/FAQ.md Execute this command to revert to the default theme if changes have caused errors. This is often necessary if the installation guide was not followed correctly. ```bash php artisan app:settings:change theme ``` -------------------------------- ### Download Docker Compose File Source: https://github.com/paymenter/docs/blob/v1/docs/installation/docker.md Use this command to download the example docker-compose.yml file from the GitHub repository. ```bash curl -Lo docker-compose.yml https://raw.githubusercontent.com/Paymenter/Paymenter/master/docker-compose.example.yml ``` -------------------------------- ### Enable and Start Services Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Enable and start the Paymenter queue worker service and the Redis server to ensure background jobs are processed and Redis is available. ```bash sudo systemctl enable --now paymenter.service ``` ```bash sudo systemctl enable --now redis-server ``` -------------------------------- ### Install npm Dependencies Source: https://github.com/paymenter/docs/blob/v1/development/theme/assets.md Installs project dependencies using npm after navigating to the Paymenter directory. ```bash cd /var/www/paymenter npm install ``` -------------------------------- ### Initialize Paymenter Application Source: https://github.com/paymenter/docs/blob/v1/docs/installation/docker.md Execute this command to configure the URL for your Paymenter installation after the Docker containers are running. ```bash docker compose exec paymenter php artisan app:init ``` -------------------------------- ### Install Debian 13 Dependencies Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Installs dependencies for Debian 13. This includes setting up the PHP repository and installing essential packages like PHP, MariaDB, and Nginx. ```bash apt -y install curl ca-certificates gnupg2 sudo lsb-release echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list curl -fsSL https://packages.sury.org/php/apt.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg apt update apt install -y php8.3 php8.3-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip,intl,redis} mariadb-server nginx tar unzip git redis-server ``` -------------------------------- ### Define Advanced Extension Configuration Source: https://github.com/paymenter/docs/blob/v1/development/extensions/configuration.md This example demonstrates advanced configuration options including URL validation, server location selection with live updates, and a debug mode checkbox. ```php public function getConfig($values = []) { return [ [ 'name' => 'host', 'label' => 'Server URL', 'type' => 'text', 'default' => 'https://api.example.com', 'description' => 'The base URL for your API server', 'required' => true, 'validation' => 'url', ], [ 'name' => 'location', 'label' => 'Server Location', 'type' => 'select', 'description' => 'Choose your preferred server location', 'required' => true, 'options' => [ 'us-east' => 'US East', 'us-west' => 'US West', 'eu-central' => 'EU Central', ], 'live' => true, ], [ 'name' => 'debug_mode', 'label' => 'Enable Debug Mode', 'type' => 'checkbox', 'description' => 'Enable detailed logging for troubleshooting', 'default' => false, ] ]; } ``` -------------------------------- ### Nginx Configuration without SSL Source: https://github.com/paymenter/docs/blob/v1/docs/installation/webserver.md Use this Nginx configuration for a basic setup without SSL. Ensure 'example.com' is replaced with your domain. ```bash server { listen 80; listen [::]:80; server_name example.com; root /var/www/paymenter/public; add_header X-Frame-Options "SAMEORIGIN"; add_header X-Content-Type-Options "nosniff"; index index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ ^/index\.php(/|$) { fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; fastcgi_hide_header X-Powered-By; } } ``` -------------------------------- ### Install Debian 11/12 Dependencies Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Installs dependencies for Debian 11 and 12. This command block adds the necessary PHP repository and installs required packages. ```bash apt -y install curl ca-certificates gnupg2 sudo lsb-release echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list curl -fsSL https://packages.sury.org/php/apt.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg curl -sSL https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.11" apt update apt install -y php8.3 php8.3-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip,intl,redis} mariadb-server nginx tar unzip git redis-server ``` -------------------------------- ### Example Email Template for Proxmox Credentials Source: https://github.com/paymenter/docs/blob/v1/docs/extensions/proxmox.md This is an example of an email template used to send the IP address and root password to the customer. This is essential as the password is not displayed in the Paymenter panel. ```blade - IP Address: {{ $ip }} - Root password: {{ $password }} ``` -------------------------------- ### Start Docker Containers Source: https://github.com/paymenter/docs/blob/v1/docs/installation/docker.md Run this command in the same directory as your docker-compose.yml file to start the Paymenter containers in detached mode. ```bash docker compose up -d --force-recreate ``` -------------------------------- ### Install Ubuntu 24.04 Dependencies Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Installs dependencies specifically for Ubuntu 24.04. This includes PHP, MariaDB, Nginx, and Redis. ```bash apt -y install software-properties-common curl apt-transport-https ca-certificates gnupg LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php apt update apt -y install php8.3 php8.3-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip,intl,redis} mariadb-server nginx tar unzip git redis-server ``` -------------------------------- ### Download Latest Release Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Navigates to the installation directory and downloads the latest Paymenter release archive. ```bash cd /var/www/paymenter curl -Lo paymenter.tar.gz https://github.com/paymenter/paymenter/releases/latest/download/paymenter.tar.gz ``` -------------------------------- ### Accessing Theme Configuration in Code Source: https://github.com/paymenter/docs/blob/v1/development/theme/index.md Retrieve theme configuration values within your theme's code using the 'theme()' helper function. This example shows how to get the primary color, providing a fallback default value. ```php $primaryColor = theme('primary_color', '#3490dc'); ``` -------------------------------- ### Apache Configuration without SSL Source: https://github.com/paymenter/docs/blob/v1/docs/installation/webserver.md This Apache configuration is for a standard setup without SSL. Remember to replace 'example.com' with your actual domain. ```apache ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/paymenter/public AllowOverride All Require all granted ``` -------------------------------- ### Create a New Theme with Artisan Source: https://github.com/paymenter/docs/blob/v1/development/theme/index.md Use this command to automatically generate a new theme, copying default files and updating configuration. This is the recommended approach for starting a new theme. ```bash php artisan app:theme:create ``` -------------------------------- ### Backup Paymenter Installation Folder Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md Copy the entire Paymenter installation directory to a safe location. This serves as a fallback in case of rollback needs. ```bash cp -r /var/www/paymenter /var/www/paymenter-v0 ``` -------------------------------- ### Clone Paymenter Documentation Repository Source: https://github.com/paymenter/docs/blob/v1/CONTRIBUTING.md Clone your forked repository to your local machine to start making changes. ```bash git clone https://github.com/your-username/paymenter-documentation.git ``` -------------------------------- ### Install General Dependencies Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Installs general dependencies required for Paymenter on Debian-based systems. Ensure you have the necessary permissions to run these commands. ```bash apt -y install software-properties-common curl apt-transport-https ca-certificates gnupg LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php curl -sSL https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.11" apt update apt -y install php8.3 php8.3-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip,intl,redis} mariadb-server nginx tar unzip git redis-server ``` -------------------------------- ### Remove Old Installation Backup Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md Delete the backup folder of your old v0.x installation. This is the final cleanup step after confirming the migration was successful. ```bash rm -rf /var/www/paymenter-v0 ``` -------------------------------- ### Registering User Created Event Hook Source: https://github.com/paymenter/docs/blob/v1/development/event-list.md Example of how to register a listener for the User Created event. ```php public function boot() { // Register the event hooks Event::listen("App\Events\User\Created"::class, function (\App\Events\User\Created $event) { // Handle the event }); } ``` -------------------------------- ### Install Filament Upgrade Package Source: https://github.com/paymenter/docs/blob/v1/releases/v1.3-release.md Use this command to install the necessary package for upgrading your extension to Filament 4.0. This is a development dependency. ```bash composer require filament/upgrade:"~4.0" -W --dev ``` -------------------------------- ### Email Template Example Source: https://github.com/paymenter/docs/blob/v1/docs/extensions/convoy.md Example of a Blade template for sending server IP and password via email. It conditionally displays the IPv4 address if available and includes the root password. ```blade @isset($server['limits']['addresses']['ipv4'][0]['address']) - IP Address: {{ $server['limits']['addresses']['ipv4'][0]['address'] }} @endisset - Root password: {{ $password }} ``` -------------------------------- ### Reset and Seed Database Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md These commands reset the database, seed it with initial data, and run custom property seeding. This is part of the new v1.0 installation process. ```bash php artisan migrate:fresh --seed ``` ```bash php artisan db:seed --class=CustomPropertySeeder ``` ```bash php artisan app:init ``` -------------------------------- ### Extension Configuration Example Source: https://github.com/paymenter/docs/blob/v1/development/extensions/index.md Defines configuration fields for an extension, including input types, default values, validation rules, and options for select fields. This function should be implemented within your extension class. ```php public function getConfig($values = []) { return [ [ 'name' => 'host', 'label' => 'Pterodactyl URL', 'type' => 'text', 'default' => 'https://example.com/', 'description' => 'Pterodactyl URL', 'required' => true, 'validation' => 'url', ], [ 'name' => 'location', 'label' => 'Location', 'type' => 'select', 'default' => '1', 'description' => 'Location your node is in?', 'required' => true, 'options' => [ '1' => 'Location 1', '2' => 'Location 2', ], ] ]; } ``` -------------------------------- ### Seed Paymenter Database Source: https://github.com/paymenter/docs/blob/v1/docs/installation/docker.md Use this command to seed the database with initial properties for your Paymenter installation. ```bash docker compose exec paymenter php artisan db:seed --class=CustomPropertySeeder ``` -------------------------------- ### Create Paymenter Admin User Source: https://github.com/paymenter/docs/blob/v1/docs/installation/docker.md Run this command to create the initial administrator user for your Paymenter installation. You will be prompted for username, email, and password. ```bash docker compose exec paymenter php artisan app:user:create ``` -------------------------------- ### Plesk Email Template Example Source: https://github.com/paymenter/docs/blob/v1/docs/extensions/plesk.md Example of an email template used to send customer credentials. It utilizes Blade templating syntax to dynamically insert domain, username, and password. ```blade Your domain {{ $domain }} is ready. @isset($password) - Username: {{ $username }} - Password: {{ $password }} @endisset ``` -------------------------------- ### Service Actions - Basic Source: https://github.com/paymenter/docs/blob/v1/development/extensions/server.md Use `getActions` to add custom text, buttons, or views to the service show page. This example demonstrates adding a text field, a button, and a view action. ```php public function getActions(Service $service, $settings, $properties) { return [ [ 'text' => properties['username'], 'label' => 'Panel Username', 'type' => 'text', ] [ 'name' => 'control_panel', 'label' => 'Go to control panel', 'url' => 'https://panel.paymenter.org', 'type' => 'button', ], [ 'name' => 'console', 'label' => 'Go to console', 'type' => 'view', ], ]; } ``` -------------------------------- ### Registering Invoice Created Event Hook Source: https://github.com/paymenter/docs/blob/v1/development/event-list.md Example of registering a listener for the Invoice Created event. Append \App\Events\ to the event name. ```php Event::listen("App\Events\Invoice\Created"::class, function (\App\Events\Invoice\Created $event) { // Handle the event }); ``` -------------------------------- ### Initialize Application Source: https://github.com/paymenter/docs/blob/v1/docs/guides/cli.md Sets up the initial configuration and state for the Paymenter application. ```bash php artisan app:init ``` -------------------------------- ### Remove Older PHP Version Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md If you are running PHP 8.2, it needs to be removed before installing the newer version required by Paymenter v1.0. This command removes all packages starting with 'php8.2'. ```bash sudo apt remove php8.2* ``` -------------------------------- ### Run Database Migrations and Seeders Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Execute these commands to set up your database with the necessary tables and default data. This process may take some time and should not be interrupted. ```bash php artisan migrate --force --seed ``` ```bash php artisan db:seed --class=CustomPropertySeeder ``` -------------------------------- ### Nginx Configuration with SSL Source: https://github.com/paymenter/docs/blob/v1/docs/installation/webserver.md This Nginx configuration includes SSL support. Replace 'example.com' with your domain and ensure SSL certificates are correctly configured. ```bash server { listen 80; listen [::]:80; server_name example.com; return 301 https://$host$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.com; root /var/www/paymenter/public; add_header X-Frame-Options "SAMEORIGIN"; add_header X-Content-Type-Options "nosniff"; index index.php; charset utf-8; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ ^/index\.php(/|$) { fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; fastcgi_hide_header X-Powered-By; } } ``` -------------------------------- ### Implement Extension Boot Hook Source: https://github.com/paymenter/docs/blob/v1/development/extensions/index.md Use the `boot` hook to register routes, views, middleware, policies, permissions, and navigation items when the extension is enabled and booted. ```php 'View Announcements', 'admin.announcements.create' => 'Create Announcements', 'admin.announcements.update' => 'Update Announcements', 'admin.announcements.delete' => 'Delete Announcements', ]; }); // Registering navigation listeners Event::listen('navigation', function () { return [ [ 'name' => 'Example', 'url' => route('example.index'), 'icon' => 'ri-example-line', 'priority' => 10, ], [ 'name' => 'Sub Example', 'url' => 'https://example.com', 'icon' => 'ri-example-line', 'priority' => 20, ] ]; }); } } ``` -------------------------------- ### Enable Nginx Site and Restart Source: https://github.com/paymenter/docs/blob/v1/docs/installation/webserver.md Commands to enable the Nginx configuration, disable the default site if necessary, and restart the Nginx service. ```bash sudo ln -s /etc/nginx/sites-available/paymenter.conf /etc/nginx/sites-enabled/ ``` ```bash sudo rm /etc/nginx/sites-enabled/default ``` ```bash sudo systemctl restart nginx ``` -------------------------------- ### Enable Apache Site and Modules Source: https://github.com/paymenter/docs/blob/v1/docs/installation/webserver.md Commands to enable the Apache site configuration, enable the rewrite module, and restart the Apache service. ```bash sudo ln -s /etc/apache2/sites-available/paymenter.conf /etc/apache2/sites-enabled/paymenter.conf ``` ```bash sudo a2enmod rewrite ``` ```bash sudo systemctl restart apache2 ``` -------------------------------- ### Run v0.x Data Migration with Manual Connection Details Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md If you need to specify connection details manually, use this format for the migration command. It allows you to set the username, host, and port. ```bash php artisan app:migrate-0.x paymenter_temp username 127.0.0.1 3306 ``` -------------------------------- ### Remove Old Paymenter Installation Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md Delete the old Paymenter installation directory to prepare for the new version. This command permanently removes the directory and its contents. ```bash rm -rf /var/www/paymenter ``` -------------------------------- ### Create Database User and Database Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Connects to MySQL, creates a new user for Paymenter, and creates the Paymenter database. Remember to replace 'yourPassword' with a strong password. ```sql mysql -u root -p CREATE USER 'paymenter'@'127.0.0.1' IDENTIFIED BY 'yourPassword'; CREATE DATABASE paymenter; GRANT ALL PRIVILEGES ON paymenter.* TO 'paymenter'@'127.0.0.1' WITH GRANT OPTION; quit ``` -------------------------------- ### Create New Extension Source: https://github.com/paymenter/docs/blob/v1/development/extensions/index.md Run this command to create a new extension for Paymenter. Ensure you are in the project root directory. ```bash php artisan app:extension:create ``` -------------------------------- ### Server Creation Hook Source: https://github.com/paymenter/docs/blob/v1/development/extensions/server.md Implement `createServer` to handle the logic for provisioning a new server for a service. Pass `$settings` and `$properties` to the server creation process. ```php use App\Models\Service; /** * Create a server for the service. * * @param Service $service The service that is being created. * @param array $settings The settings that are provided on the product from `getProductConfig`. * @param array $properties Custom properties created by the admin and values coming from `getCheckoutConfig`. */ public function createServer(Service $service, $settings, $properties) { // Create the server } ``` -------------------------------- ### Run WHMCS Importer with Manual Credentials Source: https://github.com/paymenter/docs/blob/v1/docs/guides/whmcs-importer.md If needed, you can manually specify the database username, host, and port for the importer command. ```bash php artisan app:import-from-whmcs whmcs_temp username 127.0.0.1 3306 ``` -------------------------------- ### Backup Database with mysqldump Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md Use this command to create a SQL dump of your current Paymenter database. Ensure you replace 'root' with your MySQL username if it differs. ```bash mysqldump -u root -p paymenter > paymenter.sql ``` -------------------------------- ### Get User Information Source: https://github.com/paymenter/docs/blob/v1/development/OAuth.md Retrieve the authenticated user's information using the access token obtained. ```APIDOC ## GET /api/me ### Description Retrieves the profile information of the currently authenticated user. ### Method GET ### Endpoint `/api/me` ### Parameters #### Headers - **Authorization** (string) - Required - The access token obtained from the token endpoint, prefixed with `Bearer ` (e.g., `Bearer YOUR_ACCESS_TOKEN`). ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the user. - **name** (string) - The name of the user. - **email** (string) - The email address of the user. ### Response Example ```json { "id": 123, "name": "John Doe", "email": "john.doe@example.com" } ``` ``` -------------------------------- ### `createServer`, `suspendServer`, `unsuspendServer`, `terminateServer`, `upgradeServer` Source: https://github.com/paymenter/docs/blob/v1/development/extensions/server.md These hooks are used to manage the lifecycle of a server, including creation, suspension, unsuspension, termination, and upgrading. ```APIDOC ## `createServer`, `suspendServer`, `unsuspendServer`, `terminateServer`, `upgradeServer` ### Description These hooks are used to create, suspend, unsuspend, terminate and upgrade the server. ### Parameters #### Parameters - **`Service $service`** - Required - The service that is being created, suspended, unsuspended or terminated. - **`$settings`** (array) - Required - The settings that are provided on the product from `getProductConfig`. - **`$properties`** (array) - Required - Custom properties created by the admin and values coming from `getCheckoutConfig`. It's recommended to `array_merge($settings, $properties)` before using them. ### Example `createServer` Method Signature ```php public function createServer(Service $service, array $settings, array $properties) ``` ``` -------------------------------- ### Run Filament 4.0 Upgrade Command Source: https://github.com/paymenter/docs/blob/v1/releases/v1.3-release.md Execute this command to initiate the upgrade process for your extension to Filament 4.0. Replace `` with the actual path to your extension's directory. ```bash vendor/bin/filament-v4 ``` ```bash vendor/bin/filament-v4 extensions/Others/Announcements ``` -------------------------------- ### Import Backup to Temporary Database Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md Import the previously created SQL backup file into the temporary database. Ensure you are using the correct database name ('paymenter_temp'). ```bash mysql -u root -p paymenter_temp < paymenter.sql ``` -------------------------------- ### Create SSL Certificate with Apache Source: https://github.com/paymenter/docs/blob/v1/docs/installation/ssl.md Stop Apache and use Certbot to obtain an SSL certificate for your domain with Apache. ```bash sudo systemctl stop apache2 certbot certonly --apache -d example.com ``` -------------------------------- ### Apache Configuration with SSL Source: https://github.com/paymenter/docs/blob/v1/docs/installation/webserver.md Apache configuration for SSL-enabled sites. It redirects HTTP traffic to HTTPS and sets up SSL certificates. Replace 'example.com' with your domain. ```apache ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/paymenter/public AllowOverride All Require all granted SSLEngine on SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem ``` -------------------------------- ### Discord OAuth Redirect URL Configuration Source: https://github.com/paymenter/docs/blob/v1/docs/guides/OAuth.md Use this format for the redirect URL in the Discord Developer Portal. Replace `` with your Paymenter installation's URL. ```text https:///oauth/discord/callback ``` -------------------------------- ### Run v0.x Data Migration Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md Execute the migration command to transfer data from the temporary database to the new v1.0 database. This command automatically reads connection details from your .env file. ```bash php artisan app:migrate-0.x paymenter_temp ``` -------------------------------- ### Retrieve User Information with Access Token Source: https://github.com/paymenter/docs/blob/v1/development/OAuth.md Use the obtained access token in the Authorization header to make a GET request to this endpoint and retrieve the authenticated user's information. ```http /api/me ``` -------------------------------- ### Create SSL Certificate with Standalone Source: https://github.com/paymenter/docs/blob/v1/docs/installation/ssl.md Use Certbot's standalone mode to obtain an SSL certificate for your domain. ```bash certbot certonly --standalone -d example.com ``` -------------------------------- ### Override Extension Views Source: https://github.com/paymenter/docs/blob/v1/development/theme/index.md To customize views provided by extensions, create a 'vendor' directory within your theme's 'views' folder, following the specified format. This example shows how to override the Stripe payment modal view. ```bash themes/your-theme/views/vendor/gateways/stripe/pay.blade.php ``` -------------------------------- ### Set Correct File Permissions Source: https://github.com/paymenter/docs/blob/v1/docs/installation/updating.md Ensure correct file permissions for storage and bootstrap cache directories after manual update. ```bash chmod -R 755 storage/* bootstrap/cache/ ``` -------------------------------- ### Change App URL Setting Source: https://github.com/paymenter/docs/blob/v1/docs/guides/FAQ.md Run this command to fix CSS assets not loading due to an incorrect app URL in the database. ```bash php artisan app:settings:change app_url ``` -------------------------------- ### Build Default Theme Assets Source: https://github.com/paymenter/docs/blob/v1/development/theme/assets.md Builds the theme assets for the default theme using npm. ```bash npm run build ``` -------------------------------- ### Stage and Commit Documentation Changes Source: https://github.com/paymenter/docs/blob/v1/CONTRIBUTING.md Stage all modified files and commit them with a descriptive message. ```bash git add . git commit -m 'Add new feature to documentation' ``` -------------------------------- ### Build Assets Source: https://github.com/paymenter/docs/blob/v1/docs/installation/docker.md Use the asset-builder service to build Paymenter's assets, such as themes and extensions. ```bash docker compose run --rm asset-builder npm run build ``` -------------------------------- ### Product Configuration Hook Source: https://github.com/paymenter/docs/blob/v1/development/extensions/server.md Implement `getProductConfig` to define configuration fields shown to the admin when setting up a product. Use the `$values` parameter to conditionally display fields. ```php public function getProductConfig($values = []) { return [ [ 'name' => 'ram', 'label' => 'Ram', 'type' => 'number', 'required' => true, 'default' => 1024, 'description' => 'The amount of ram in MB', ], ]; } ``` -------------------------------- ### Clear Configuration and View Cache Source: https://github.com/paymenter/docs/blob/v1/docs/installation/updating.md Optimize the application by clearing configuration and view caches. ```bash php artisan optimize:clear ``` -------------------------------- ### Process Payment with Gateway Source: https://github.com/paymenter/docs/blob/v1/development/extensions/gateway.md Implement the `pay` hook to handle the actual payment processing. This hook should return either a redirect URL or a view for the user to complete the payment. ```php public function pay(Invoice $invoice, $total) { // Process the payment and return either a url OR a view return view('my-gateway::pay', ['invoice' => $invoice, 'total' => $total]); } ``` -------------------------------- ### Generate Application Key and Storage Link Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Generates the application encryption key and creates a symbolic link for the storage directory. ```bash php artisan key:generate --force php artisan storage:link ``` -------------------------------- ### Import WHMCS Backup to Temporary Database Source: https://github.com/paymenter/docs/blob/v1/docs/guides/whmcs-importer.md Import the previously created WHMCS SQL dump into the temporary database. ```bash mysql -u root -p whmcs_temp < whmcs.sql ``` -------------------------------- ### Backup Paymenter Database Source: https://github.com/paymenter/docs/blob/v1/docs/guides/migrate.md Use this command on the old server to create a SQL dump of your Paymenter database. Replace placeholders with your actual database credentials. ```bash mariadb-dump -u your_db_user -p your_db_name > paymenter_backup.sql ``` -------------------------------- ### Create Temporary Database Source: https://github.com/paymenter/docs/blob/v1/docs/guides/whmcs-importer.md These SQL commands create a new database named 'whmcs_temp' and grant necessary privileges to the 'paymenter' user for importing data. ```sql CREATE DATABASE whmcs_temp; GRANT ALL PRIVILEGES ON whmcs_temp.* TO 'paymenter'@'127.0.0.1' WITH GRANT OPTION; ``` -------------------------------- ### Create Temporary Database Source: https://github.com/paymenter/docs/blob/v1/docs/guides/v0-migration.md Connect to the MySQL server and create a new database named 'paymenter_temp' to import your old data into. ```sql CREATE DATABASE paymenter_temp; GRANT ALL PRIVILEGES ON paymenter_temp.* TO 'paymenter'@'127.0.0.1' WITH GRANT OPTION; ``` -------------------------------- ### Create New User Source: https://github.com/paymenter/docs/blob/v1/docs/guides/cli.md Creates a new user account within the Paymenter application. ```bash php artisan app:user:create ``` -------------------------------- ### Put Application in Maintenance Mode Source: https://github.com/paymenter/docs/blob/v1/docs/installation/updating.md Before performing manual updates, enable maintenance mode using this command. ```bash php artisan down ``` -------------------------------- ### Post Application Logs Source: https://github.com/paymenter/docs/blob/v1/docs/guides/cli.md Posts application logs, useful for debugging. This command is marked with a 'Debug' tip. ```bash php artisan app:logs ``` -------------------------------- ### Configure Database Credentials in .env Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Updates the .env file with the database name, username, and password created earlier. Ensure 'yourPassword' matches the one set during database creation. ```dotenv DB_DATABASE=paymenter DB_USERNAME=paymenter DB_PASSWORD=yourPassword ``` -------------------------------- ### Create Paymenter Queue Worker Service File Source: https://github.com/paymenter/docs/blob/v1/docs/installation/install.md Create and configure the systemd service file for the Paymenter Queue Worker. Ensure the User and Group match your system's web server user. ```bash [Unit] Description=Paymenter Queue Worker [Service] # On some systems the user and group might be different. # Some systems use `apache` or `nginx` as the user and group. User=www-data Group=www-data Restart=always ExecStart=/usr/bin/php /var/www/paymenter/artisan queue:work StartLimitInterval=180 StartLimitBurst=30 RestartSec=5s [Install] WantedBy=multi-user.target ``` -------------------------------- ### Define Extension Configuration Fields Source: https://github.com/paymenter/docs/blob/v1/development/extensions/configuration.md Use the `getConfig` method to return an array of configuration fields for your extension. Each field is defined by an associative array with properties like name, label, type, and description. ```php public function getConfig($values = []) { return [ [ 'name' => 'api_key', 'label' => 'API Key', 'type' => 'password', 'description' => 'Your service API key', 'required' => true, ], [ 'name' => 'environment', 'label' => 'Environment', 'type' => 'select', 'options' => [ 'sandbox' => 'Sandbox', 'production' => 'Production', ], 'default' => 'sandbox', ] ]; } ``` -------------------------------- ### Migrate Database with Seed Source: https://github.com/paymenter/docs/blob/v1/docs/installation/updating.md Force database migration and seeding after updating Paymenter. ```bash php artisan migrate --force --seed ``` -------------------------------- ### Switch to Default Theme in Docker Source: https://github.com/paymenter/docs/blob/v1/docs/installation/updating.md After updating Docker Paymenter, switch to the default theme to ensure compatibility. ```bash docker compose exec paymenter php artisan app:settings:change theme default ``` -------------------------------- ### Set Webserver Permissions Source: https://github.com/paymenter/docs/blob/v1/docs/installation/updating.md Assign ownership of Paymenter files to the webserver user. ```bash chown -R www-data:www-data /var/www/paymenter/* ``` -------------------------------- ### Service Actions - Dynamic URLs and Views Source: https://github.com/paymenter/docs/blob/v1/development/extensions/server.md Enhance `getActions` by using a `function` to dynamically generate URLs or render custom views. This allows for time-sensitive links or complex view logic. ```php public function getActions(Service $service, $settings, $properties) { return [ [ 'name' => 'control_panel', 'label' => 'Go to control panel', 'function' => 'getControlPanelUrl', 'type' => 'button', ], [ 'name' => 'console', 'label' => 'Go to console', 'type' => 'view', 'function' => 'getView', // If this function is not provided, we will use the function `getView` to render the view. ], ]; } ``` ```php public function getControlPanelUrl(Service $service) { return 'https://panel.paymenter.org/' . $service->id; } ``` ```php public function getView(Service $service, $settings, $properties, $view) { return view('extension::' . $view, ['service' => $service]); } ``` -------------------------------- ### Change Application Setting Source: https://github.com/paymenter/docs/blob/v1/docs/guides/cli.md Modifies a specific application setting. Provide the setting name and optionally its new value. ```bash php artisan app:settings:change [value] ``` -------------------------------- ### Check Gateway Usability Source: https://github.com/paymenter/docs/blob/v1/development/extensions/gateway.md Implement the `canUseGateway` hook to determine if a specific gateway should be used for a transaction. This is useful for enforcing currency or total amount restrictions. ```php public function canUseGateway($total, $currency, $type, $items = []) { if ($currency == 'EUR') return false; if ($total > 1000) return false; return true; } ``` -------------------------------- ### Build Custom Theme Assets Source: https://github.com/paymenter/docs/blob/v1/development/theme/assets.md Builds theme assets for a specific theme by providing the theme name as an argument to the npm build script. ```bash npm run build ``` -------------------------------- ### Create SSL Certificate with Nginx Source: https://github.com/paymenter/docs/blob/v1/docs/installation/ssl.md Stop Nginx and use Certbot to obtain an SSL certificate for your domain with Nginx. ```bash sudo systemctl stop nginx certbot certonly --nginx -d example.com ``` -------------------------------- ### Run WHMCS Importer Command Source: https://github.com/paymenter/docs/blob/v1/docs/guides/whmcs-importer.md Execute the Paymenter import command to migrate data from the temporary WHMCS database. This command will prompt for the database user's password. ```bash php artisan app:import-from-whmcs whmcs_temp ``` -------------------------------- ### Checkout Configuration Hook Source: https://github.com/paymenter/docs/blob/v1/development/extensions/server.md Use `getCheckoutConfig` to define fields presented to the user during the checkout process. The `$product`, `$values`, and `$settings` parameters provide context for dynamic field rendering. ```php use App\Models\Product; public function getCheckoutConfig(Product $product, $values = [], $settings = []) { return [ [ 'name' => 'location', 'label' => 'Location', 'type' => 'select', 'required' => true, 'options' => [ '1' => 'Location 1', '2' => 'Location 2', ], ] ]; } ``` -------------------------------- ### Upgrade Website Source: https://github.com/paymenter/docs/blob/v1/docs/guides/cli.md Upgrades the Paymenter website to the latest available version. ```bash php artisan app:upgrade ``` -------------------------------- ### Implement Extension Enabled/Disabled Hooks Source: https://github.com/paymenter/docs/blob/v1/development/extensions/index.md Implement the `enabled` hook to run code when an extension is activated and the `disabled` hook for when it is deactivated. These are useful for seeding data or performing other setup/cleanup. ```php whmcs.sql ``` -------------------------------- ### Create a New Branch for Changes Source: https://github.com/paymenter/docs/blob/v1/CONTRIBUTING.md Create a new branch for your feature or bug fix before making changes. ```bash git checkout -b feature/your-feature ```