diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index af30cf2ff57..a531a821d29 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -444,10 +444,12 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) $thirdparty = new Societe($db); $thirdparty->fetch($thirdparty_id); + // Create Stripe customer include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $stripe = new Stripe($db); $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); + // Create Stripe card from Token $card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata)); if (empty($card)) @@ -1559,7 +1561,7 @@ if (preg_match('/^dopayment/',$action)) ?> - // Create a Stripe client + // Create a Stripe client. var stripe = Stripe(''); // Create an instance of Elements diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 1e9eb7a5181..c61de994874 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -46,11 +46,11 @@ $stripearrayofkeysbyenv = array( $stripearrayofkeys = array(); if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')) { - $stripearrayofkeys = $stripearrayofkeysbyenv[0]; + $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test } else { - $stripearrayofkeys = $stripearrayofkeysbyenv[1]; + $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live } \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);