diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 8c9eb93004f..02dc94285f6 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -430,7 +430,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'dol_company' => $mysoc->name, // Usefull when using multicompany - 'dol_tax_num' => $taxinfo, + 'dol_tax_num' => $vatnumber, 'ipaddress'=> getUserRemoteIP() ); @@ -455,7 +455,13 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $stripe = new Stripe($db); $stripeacc = $stripe->getStripeAccount($service); - $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); + $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); + if (empty($customer)) + { + $error++; + dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERROR, 0, '_stripe'); + setEventMessages('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, null, 'errors'); + } // Create Stripe card from Token if ($savesource) { diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 6b910236e96..c731637fce6 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -177,6 +177,7 @@ class Stripe extends CommonObject } catch(Exception $e) { + // For exemple, we may have error: 'No such customer: cus_XXXXX; a similar object exists in live mode, but a test mode key was used to make this request.' $this->error = $e->getMessage(); } }