from customer_email to customer stripe uid

This commit is contained in:
Cyprian Beauvois 2019-07-19 17:54:27 +02:00
parent 251b5144a1
commit 35a0d8f705
1 changed files with 14 additions and 2 deletions

View File

@ -13,11 +13,16 @@ class BillingSrv
$this->container = $container; $this->container = $container;
} }
public function createPurchase($user_email, $items, $cbFormatter) private function setApiKey()
{ {
$apiKey = $this->container->getParameter('stripe_api_key_secret'); $apiKey = $this->container->getParameter('stripe_api_key_secret');
\Stripe\Stripe::setApiKey($apiKey); \Stripe\Stripe::setApiKey($apiKey);
}
public function createPurchase($customer, $items, $cbFormatter)
{
$this->setApiKey();
$line_items = []; $line_items = [];
@ -27,7 +32,7 @@ class BillingSrv
return ( return (
\Stripe\Checkout\Session::create([ \Stripe\Checkout\Session::create([
'customer_email' => $user_email, 'customer' => $customer,
'payment_method_types' => $this->container->getParameter('payment_method'), 'payment_method_types' => $this->container->getParameter('payment_method'),
'line_items' => $line_items, 'line_items' => $line_items,
'success_url' => $ngrok_url . $this->container->getParameter('stripe_success_url'), 'success_url' => $ngrok_url . $this->container->getParameter('stripe_success_url'),
@ -35,4 +40,11 @@ class BillingSrv
]) ])
); );
} }
public function retrievePurchase($paimentIntent)
{
$this->setApiKey();
$intent = \Stripe\PaymentIntent::retrieve($paimentIntent);
}
} }