From 0dc0e46cdd9d9067603d0fc5b5b9339f2881c21e Mon Sep 17 00:00:00 2001 From: mbarreiro Date: Mon, 8 Jul 2024 10:05:37 +0100 Subject: [PATCH] add requestOption when creating customers --- src/Concerns/ManagesCustomer.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Concerns/ManagesCustomer.php b/src/Concerns/ManagesCustomer.php index 66894d35..9f1f324e 100644 --- a/src/Concerns/ManagesCustomer.php +++ b/src/Concerns/ManagesCustomer.php @@ -53,11 +53,12 @@ protected function assertCustomerExists() * Create a Stripe customer for the given model. * * @param array $options + * @param array|null $requestOptions * @return \Stripe\Customer * * @throws \Laravel\Cashier\Exceptions\CustomerAlreadyCreated */ - public function createAsStripeCustomer(array $options = []) + public function createAsStripeCustomer(array $options = [], array $requestOptions = null) { if ($this->hasStripeId()) { throw CustomerAlreadyCreated::exists($this); @@ -90,7 +91,7 @@ public function createAsStripeCustomer(array $options = []) // Here we will create the customer instance on Stripe and store the ID of the // user from Stripe. This ID will correspond with the Stripe user instances // and allow us to retrieve users from Stripe later when we need to work. - $customer = static::stripe()->customers->create($options); + $customer = static::stripe()->customers->create($options, $requestOptions); $this->stripe_id = $customer->id; @@ -116,15 +117,16 @@ public function updateStripeCustomer(array $options = []) * Get the Stripe customer instance for the current user or create one. * * @param array $options + * @param array|null $requestOptions * @return \Stripe\Customer */ - public function createOrGetStripeCustomer(array $options = []) + public function createOrGetStripeCustomer(array $options = [], array $requestOptions = null) { if ($this->hasStripeId()) { return $this->asStripeCustomer($options['expand'] ?? []); } - return $this->createAsStripeCustomer($options); + return $this->createAsStripeCustomer($options, $requestOptions); } /**