From 0e83863d456bcc7ea19661429e773e71feb72467 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 4 Oct 2018 20:32:49 +0200 Subject: [PATCH] Add save or not source functionnality --- htdocs/public/payment/newpayment.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index e82baa634a0..f1ffb790d64 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -413,6 +413,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) $dol_type=GETPOST('s', 'int'); $dol_id=GETPOST('dol_id', 'int'); $vatnumber = GETPOST('vatnumber','alpha'); + $savesource=GETPOST('savesource', 'int'); dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe'); @@ -453,7 +454,9 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); // Create Stripe card from Token + if (! empty($savesource)) { $card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata)); + } else { $card = $stripeToken; } if (empty($card)) {