dolibarr 24.0.0-beta
config.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
3 * Copyright (C) 2017 Saasprov <saasprov@gmail.com>
4 * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * Set Stripe environment: set the ApiKey and AppInfo
20 */
21
28require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php';
29require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/lib/Stripe.php';
30
31global $stripearrayofkeysbyenv;
32
33$stripearrayofkeysbyenv = array(
34 array(
35 "secret_key" => getDolGlobalString('STRIPE_TEST_SECRET_KEY'),
36 "publishable_key" => getDolGlobalString('STRIPE_TEST_PUBLISHABLE_KEY')
37 ),
38 array(
39 "secret_key" => getDolGlobalString('STRIPE_LIVE_SECRET_KEY'),
40 "publishable_key" => getDolGlobalString('STRIPE_LIVE_PUBLISHABLE_KEY')
41 )
42);
43
44$stripearrayofkeys = array();
45if (!getDolGlobalString('STRIPE_LIVE')/* || GETPOST('forcesandbox', 'alpha') */) {
46 $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
47} else {
48 $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
49}
50
51\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
52\Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
53\Stripe\Stripe::setApiVersion(getDolGlobalString('STRIPE_FORCE_VERSION', "2022-11-15")); // force version API
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.