From 35a0d8f7052e0eefe63b58dacffd836a2bda64c7 Mon Sep 17 00:00:00 2001 From: cbeauvoi Date: Fri, 19 Jul 2019 17:54:27 +0200 Subject: [PATCH] from customer_email to customer stripe uid --- BillingBundle/Service/BillingSrv.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/BillingBundle/Service/BillingSrv.php b/BillingBundle/Service/BillingSrv.php index 19da9b1..54738be 100644 --- a/BillingBundle/Service/BillingSrv.php +++ b/BillingBundle/Service/BillingSrv.php @@ -13,11 +13,16 @@ class BillingSrv $this->container = $container; } - public function createPurchase($user_email, $items, $cbFormatter) + private function setApiKey() { $apiKey = $this->container->getParameter('stripe_api_key_secret'); \Stripe\Stripe::setApiKey($apiKey); + } + + public function createPurchase($customer, $items, $cbFormatter) + { + $this->setApiKey(); $line_items = []; @@ -27,7 +32,7 @@ class BillingSrv return ( \Stripe\Checkout\Session::create([ - 'customer_email' => $user_email, + 'customer' => $customer, 'payment_method_types' => $this->container->getParameter('payment_method'), 'line_items' => $line_items, '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); + } }