diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 9f5f0e4de96..a692e541050 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -33,6 +33,15 @@ global $conf; //use \includes\stripe as stripe; $stripe = array(); +if ((empty($conf->global->STRIPECONNECT_LIVE) && ! (empty($conf->stripeconnect->enabled))) || GETPOST('forcesandbox','alpha')) +{ + $stripe = array( + "secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY, + "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY + ); +} +else +{ if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')) { $stripe = array( @@ -47,8 +56,13 @@ else "publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY ); } +} require_once DOL_DOCUMENT_ROOT."/includes/stripe/lib/Stripe.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; \Stripe\Stripe::setApiKey($stripe['secret_key']); + +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + +\Stripe\Stripe::setAppInfo("Stripe", "dolibarr version", "https://www.dolibarr.org"); // add dolibarr version