Keep ‘live’ PayPal credentials even though you’re using the ‘sandbox’ server

 hints, php, v1.5.0, v1.5.1, zen-cart  Comments Off on Keep ‘live’ PayPal credentials even though you’re using the ‘sandbox’ server
May 102013
 

When you use PayPal Express Checkout as a payment method and you’re switching to the ‘sandbox’ server occasionally to check things out, it can be painful.  Each time you switch between the live and the sandbox servers, you have to re-enter your PayPal account credentials to match the server.

The PayPal processing that’s built into Zen Cart checks for the presence of three (3) additional defined (or configuration) values when the sandbox server is currently configured.  You can create the file /includes/extra_configures/paypal_sandbox_credentials.php that contains your sandbox credentials:

<?php
// -----
// File: /includes/extra_configures/paypal_sandbox_credentials.php
//
// Contains the 'sandbox' credentials for your PayPal Express Checkout account, 
// allows you to permanently store your 'live' credentials in the database and 
// is automatically switched to these values (by /includes/modules/payment/paypal/paypal_curl.php) 
// if the 'sandbox' server is chosen in the payment module's configuration.
define('MODULE_PAYMENT_PAYPALWPP_SANDBOX_APIUSERNAME', 'apiusername');
define('MODULE_PAYMENT_PAYPALWPP_SANDBOX_APIPASSWORD', 'apipassword');
define('MODULE_PAYMENT_PAYPALWPP_SANDBOX_APISIGNATURE', 'apisignature');

Then, you can keep your live PayPal server credentials set in the PayPal Express Checkout payment module settings regardless of the PayPal server you’ve currently got configured!