diff --git a/src/Checkout.php b/src/Checkout.php index 99a7ea5c..1c631ef4 100644 --- a/src/Checkout.php +++ b/src/Checkout.php @@ -9,6 +9,11 @@ use JsonSerializable; use Stripe\Checkout\Session; +/** + * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions + * + * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions + */ class Checkout implements Arrayable, Jsonable, JsonSerializable, Responsable { /** @@ -66,9 +71,10 @@ public static function customer($owner, $parentInstance = null) * @param \Illuminate\Database\Eloquent\Model|null $owner * @param array $sessionOptions * @param array $customerOptions + * @param RequestOptionsArray|\Stripe\Util\RequestOptions|null $opts * @return \Laravel\Cashier\Checkout */ - public static function create($owner, array $sessionOptions = [], array $customerOptions = []) + public static function create($owner, array $sessionOptions = [], array $customerOptions = [], $opts = null) { $data = array_merge([ 'mode' => Session::MODE_PAYMENT, @@ -107,7 +113,7 @@ public static function create($owner, array $sessionOptions = [], array $custome $data['cancel_url'] = $sessionOptions['cancel_url'] ?? route('home').'?checkout=cancelled'; } - $session = $stripe->checkout->sessions->create($data); + $session = $stripe->checkout->sessions->create($data, $opts); return new static($owner, $session); } diff --git a/src/CheckoutBuilder.php b/src/CheckoutBuilder.php index 40d94600..114fb1fd 100644 --- a/src/CheckoutBuilder.php +++ b/src/CheckoutBuilder.php @@ -6,6 +6,11 @@ use Laravel\Cashier\Concerns\AllowsCoupons; use Laravel\Cashier\Concerns\HandlesTaxes; +/** + * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions + * + * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions + */ class CheckoutBuilder { use AllowsCoupons; @@ -60,9 +65,10 @@ public static function make($owner = null, $instance = null) * @param array|string $items * @param array $sessionOptions * @param array $customerOptions + * @param RequestOptionsArray|\Stripe\Util\RequestOptions|null $opts * @return \Laravel\Cashier\Checkout */ - public function create($items, array $sessionOptions = [], array $customerOptions = []) + public function create($items, array $sessionOptions = [], array $customerOptions = [], $opts = null) { $payload = array_filter([ 'allow_promotion_codes' => $this->allowPromotionCodes,