feat: add PayPal sandbox/live credentials, webhook endpoint, and admin diagnostics
- config.inc.php: new sandbox/live credential structure with paypal_mode, separate sandbox/live client_id, client_secret, webhook_id, and webhook_path - config.example.php: updated to match new structure - config_loader.php: adds defaults and backward compat mapping from old $paypal_sandbox/$paypal_client_id variables; adds gsp_paypal_* helper functions - PayPalGateway.php: fromConfig() uses gsp_paypal_* helpers with fallback - cart.php: uses gsp_paypal_get_client_id()/gsp_paypal_is_sandbox() helpers - webhook.php: updated to use gsp_paypal_* helpers for credentials/API base - paypal/webhook.php: new full-featured webhook receiver with signature verification, idempotency log, event processing, provisioning trigger - admin_config.php: expanded to separate sandbox/live fields, computed webhook URL, diagnostics panel showing credential status and recent webhook events - module.php: bumped to v3.3/db_version 3, adds billing_paypal_webhook_events table Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/f974e469-8562-41df-ba37-bc340f5a154c Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
0f4c4b3634
commit
41a812fdd6
9 changed files with 1351 additions and 109 deletions
|
|
@ -3,7 +3,7 @@
|
|||
# Website Database Configuration
|
||||
# This file contains the database connection
|
||||
# settings for the _website standalone site.
|
||||
#
|
||||
#
|
||||
# These settings should match the panel's
|
||||
# database configuration in includes/config.inc.php
|
||||
###############################################
|
||||
|
|
@ -14,14 +14,15 @@ $db_pass="Pkloyn7yvpht!";
|
|||
$db_name="panel";
|
||||
$table_prefix="gsp_";
|
||||
$db_type="mysql";
|
||||
|
||||
// Optional: base URL used by admin pages to build absolute image previews.
|
||||
// Leave empty to prefer relative paths (local folder).
|
||||
// To enable production base URL, uncomment and set it to your site, e.g.:
|
||||
// $SITE_BASE_URL = 'https://gameservers.world/';
|
||||
// $SITE_BASE_URL = 'https://gameservers.world';
|
||||
$SITE_BASE_URL = '';
|
||||
|
||||
// Normalize: ensure either empty or ends without trailing slash (we use join_base to handle joining)
|
||||
$SITE_BASE_URL = trim((string)$SITE_BASE_URL);
|
||||
// Normalize: ensure either empty or ends without trailing slash
|
||||
$SITE_BASE_URL = rtrim(trim((string)$SITE_BASE_URL), '/');
|
||||
|
||||
// Site-wide background image (relative to site root). Change to your preferred background.
|
||||
$SITE_BACKGROUND = 'images/dark.jpg';
|
||||
|
|
@ -31,11 +32,28 @@ $SITE_BACKGROUND = trim((string)$SITE_BACKGROUND);
|
|||
// Data directory for persisted payment webhook JSON files (relative to repo root)
|
||||
$SITE_DATA_DIR = realpath(__DIR__ . '/..') . DIRECTORY_SEPARATOR . 'data';
|
||||
|
||||
// PayPal configuration — set credentials here, never in API files
|
||||
$paypal_sandbox = true; // Set to false for live payments
|
||||
$paypal_client_id = ''; // Your PayPal Client ID
|
||||
$paypal_client_secret = ''; // Your PayPal Client Secret
|
||||
$paypal_webhook_id = ''; // Your PayPal Webhook ID (for webhook signature verification)
|
||||
// ---------------------------------------------------------------------------
|
||||
// PayPal configuration
|
||||
// Set credentials here — never in API files or public pages.
|
||||
//
|
||||
// Mode: 'sandbox' for testing, 'live' for real payments.
|
||||
// ---------------------------------------------------------------------------
|
||||
$paypal_mode = 'sandbox'; // 'sandbox' or 'live'
|
||||
|
||||
// Sandbox credentials (use for testing — safe to share with the dev team)
|
||||
$paypal_sandbox_client_id = 'AfvY_C2zA_hTHxHq7TIhtOeub4xBdySYrt_Hjj3d_WYQwjWI9NfOAVOTeResx2rgZ_nP5tOoxQSAHw8c';
|
||||
$paypal_sandbox_client_secret = 'EJ216np9cAj9n7KSddez3fLVxGe-zi4oKKKl1YGqPp88XIikr4Qzbxh0XW2as-V6LgdX-upjtQAg9dC0';
|
||||
$paypal_sandbox_webhook_id = ''; // Set after registering the webhook in PayPal sandbox dashboard
|
||||
|
||||
// Live credentials (leave blank until ready for production)
|
||||
$paypal_live_client_id = '';
|
||||
$paypal_live_client_secret = '';
|
||||
$paypal_live_webhook_id = '';
|
||||
|
||||
// Webhook path (relative to billing site root, must start with /)
|
||||
// Full public URL = $SITE_BASE_URL + $paypal_webhook_path
|
||||
// e.g. https://gameservers.world/paypal/webhook.php
|
||||
$paypal_webhook_path = '/paypal/webhook.php';
|
||||
|
||||
// Admin config backup retention: how many backups to keep (1–10). Default 5.
|
||||
$SITE_CONFIG_BACKUP_RETENTION = 5;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue