Skip to content

Commit

Permalink
A more complete function
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Apr 26, 2019
1 parent a7362ca commit 22b8a67
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions htdocs/stripe/class/stripe.class.php
Expand Up @@ -238,17 +238,18 @@ public function customerStripe(Societe $object, $key = '', $status = 0, $createi
}

/**
* Get the Stripe payment intent. Create it with confirm=false
* Get the Stripe payment intent. Create it with confirm=false
*
* @param Societe $object Object to pay with Stripe
* @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe()
* @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
* @param int $status Status (0=test, 1=live)
* @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email for receipt
* @param int $mode automatic=automatic payment, manual=need confirmation
* @param int $mode automatic=automatic confirmation/payment when conditions are ok, manual=need to call confirm() on intent
* @param boolean $confirmnow false=default, true=try to confirm immediatly after create (if conditions are ok)
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found
*/
public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic')
public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false)
{
global $conf, $user, $mysoc;

Expand Down Expand Up @@ -318,7 +319,7 @@ public function getPaymentIntent($object, $customer, $key = null, $status = 0, $
$description=$object->element.$object->id;

$dataforintent = array(
"confirm" => false, // Do not confirm immediatly during creation of intent
"confirm" => $confirmnow, // Do not confirm immediatly during creation of intent
"confirmation_method" => $mode,
"amount" => $stripeamount,
"currency" => $object->multicurrency_code,
Expand Down

0 comments on commit 22b8a67

Please sign in to comment.