diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 43dc796bd5f..04326e7a3fe 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/triggers/interface_50_modStripe_Stripe.class.php + * \file htdocs/core/triggers/interface_80_modStripe_Stripe.class.php * \ingroup core * \brief Fichier * \remarks Son propre fichier d'actions peut etre cree par recopie de celui-ci: @@ -148,9 +148,9 @@ class InterfaceStripe { $namecleaned = $object->name ? $object->name : null; $vatcleaned = array( - "tax_id" => $object->tva_intra ? $object->tva_intra : null, // We force data to "null" if empty as expected by Stripe - "type" => 'vat', - ); + "tax_id" => $object->tva_intra ? $object->tva_intra : null, // We force data to "null" if empty as expected by Stripe + "type" => 'vat', + ); // Detect if we change a Stripe info (email, description, vat id) $changerequested = 0; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index a03c0a719c6..08e50e58be7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -495,12 +495,17 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) } else { + $vatcleaned = array( + "tax_id" => $vatnumber ? $vatnumber : null, // We force data to "null" if empty as expected by Stripe + "type" => 'vat', + ); + dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe'); $customer = \Stripe\Customer::create(array( 'email' => $email, 'description' => ($email?'Anonymous customer for '.$email:'Anonymous customer'), 'metadata' => $metadata, - 'business_vat_id' => ($vatnumber?$vatnumber:null), + 'tax_info' => $vatcleaned, 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) )); // Return $customer = array('id'=>'cus_XXXX', ...)