private function registerScripts() {
        $view = $this->getView();

        $view->registerJsFile($this->stripeJs, ['position' => \yii\web\View::POS_END]);

        if (!self::$handlerRegistered) {
            $js = "var handler = StripeCheckout.configure({
                key: '" . Yii::$app->stripe->publicKey . "'
            });";
            $view->registerJs($js);
            $js = 'jQuery("window").on("popstate", function(e) {
                handler.close();
            });';
            $view->registerJs($js);

            self::$handlerRegistered = true;
        }

        $js = 'jQuery("#' . $this->buttonOptions['id'] . '").on("click", function(e) {
                    handler.open({
                        name: "' . $this->name . '",
                        description: "' . $this->description . '",
                        amount: ' . $this->amount . ',
                        image: "' . $this->image . '",
                        currency: "' . $this->currency . '",
                        panelLabel: "' . $this->panelLabel . '",
                        zipCode: "' . $this->validateZipCode . '",
                        email: "' . $this->userEmail . '",
                        allowRememberMe: "' . $this->allowRemember . '",
                        token: ' . $this->tokenFunction . ',
                        opened: ' . $this->openedFunction . ',
                        closed: ' . $this->closedFunction . '
                    });
                    e.preventDefault();
         });';
        $view->registerJs($js);

    }