Files
HotLunches/paypal_checkout_config.php
T
2026-10-19 15:22:52 -07:00

51 lines
1.8 KiB
PHP

<?php
/**
* PayPal Checkout Configuration
*
* INSTRUCTIONS:
* 1. Replace the CLIENT_ID and CLIENT_SECRET with your PayPal app credentials
* 2. Get these from: https://developer.paypal.com/developer/applications/
* 3. Set PAYPAL_MODE to 'sandbox' for testing, 'live' for production
*/
// PayPal Mode: 'sandbox' or 'live'
define('PAYPAL_MODE', 'sandbox');
// SSL verification (recommended ON in production)
// Windows local dev sometimes lacks a CA bundle, which causes:
// "SSL certificate problem: unable to get local issuer certificate"
// Keep this false for sandbox/local testing; set true for live.
define('PAYPAL_VERIFY_SSL', PAYPAL_MODE === 'live');
// Sandbox credentials (for testing)
define('PAYPAL_SANDBOX_CLIENT_ID', 'AUfuujuMbz9v57FMZd5-_Sq57_AU1-l7AL1bzBfr1wryX-opFY-eRqPNKmuCPCyBcixBHdMIEH9FsLIg');
define('PAYPAL_SANDBOX_CLIENT_SECRET', 'EFOvH8FQXjuobm_DX3D8H8dRuvaSwAUC-R50n451fB3g-qUrY6_8yVAVKkCvm-MlWlgR9-DI0ZoWLNes');
// Live credentials (for production)
define('PAYPAL_LIVE_CLIENT_ID', 'YOUR_LIVE_CLIENT_ID_HERE');
define('PAYPAL_LIVE_CLIENT_SECRET', 'YOUR_LIVE_CLIENT_SECRET_HERE');
// Currency (e.g., 'USD', 'CAD', 'EUR', 'GBP')
define('PAYPAL_CURRENCY', 'CAD');
// Get active credentials based on mode
function getPayPalClientId() {
return PAYPAL_MODE === 'live' ? PAYPAL_LIVE_CLIENT_ID : PAYPAL_SANDBOX_CLIENT_ID;
}
function getPayPalClientSecret() {
return PAYPAL_MODE === 'live' ? PAYPAL_LIVE_CLIENT_SECRET : PAYPAL_SANDBOX_CLIENT_SECRET;
}
function getPayPalBaseUrl() {
return PAYPAL_MODE === 'live'
? 'https://api-m.paypal.com'
: 'https://api-m.sandbox.paypal.com';
}
function getPayPalJsSdkUrl() {
$clientId = getPayPalClientId();
$currency = PAYPAL_CURRENCY;
return "https://www.paypal.com/sdk/js?client-id={$clientId}&currency={$currency}";
}