diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index a0fdb313b3c..85455544c78 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -1168,15 +1168,17 @@ class Stripe extends CommonObject if (!$cs) { $this->error = 'Link SEPA <-> setupIntent->create failed'; dol_syslog($this->error, LOG_ERR); + $cs2 = null; + } else { + // note: $cs->mandate contains ID of mandate on Stripe side + $cs2 = $s->setupIntents->confirm($cs->id, ['mandate_data' => ['customer_acceptance' => ['type' => 'offline']]]); + if (!$cs2) { + $this->error = 'Link SEPA <-> setupIntent->confirm failed'; + dol_syslog($this->error, LOG_ERR); + } } - $cs = $s->setupIntents->confirm($cs->id, ['mandate_data' => ['customer_acceptance' => ['type' => 'offline']]]); - // note: $cs->mandate contains ID of mandate on Stripe side - - if (!$cs) { - $this->error = 'Link SEPA <-> setupIntent->confirm failed'; - dol_syslog($this->error, LOG_ERR); - } else { + if ($cs && $cs2) { dol_syslog("Update the payment mode of the customer"); // print json_encode($sepa);