首页 > 解决方案 > 无法让 https 在 ngrok 上正常工作。需要 https 来测试 pyament api webhook

问题描述

我刚刚开始实施mollie api来处理我网站上的付款。您需要一个 url 来重定向到和一个 url 作为 webhook 来更新付款状态。我仍在本地开发网站,但作为 url 的 localhost 不是一个选项。我安装了ngrok并尝试了在运行 ngrok http 命令时分配给我的HTTPS URL 。

当我使用 HTTP 链接访问我的网站时,一切看起来都很好,但是当我通过 HTTPS 链接访问我的网站时,我的网站无法加载我自己的 css 脚本,chrome 告诉我网站不安全,但我的 ssl 证书有效(可能不安全,因为它是自签名的)?

混合信号 chrome 给了我

我试图通过在(损坏的 https)网站上订购一些东西来测试 api,但在确认订单后我得到 419 错误响应(我在 laravel 8 中开发我的网站)。

很抱歉,如果我遗漏了重要信息,我是网络方面最大的菜鸟,我什至不知道从哪里开始。

编辑:这是关于我的问题的附加信息。

我在我创建订单的 laravel 控制器中测试来自 mollie 的支付 api。

public function order(CreateOrderRequest $request){
    $baseUrl = 'https://xxxx-xxx-xx-xxx-xx.ngrok.io/';
    $payment = $this->mollie->payments->create([
        "amount" => [
            "currency" => "EUR",
            "value" => "10.00"
        ],
        "description" => "My first API payment",
        "redirectUrl" => $baseUrl."/order/besteld",
        "webhookUrl"  => $baseUrl."/order/betaalupdate/".$id,
    ]);
    dd($payment);
    return redirect()->to($payment->getCheckoutUrl(), 303);
}

这个控制器是从路由中调用的:

Route::post('/winkelwagen/bestellen/bevestig', [CartController::class, 'order'])->name('orderConfirmed');

从以下形式调用:

<form action="{{route('orderConfirmed')}}" method="post" class="d-block">
            @csrf
            <div class="row">

                <div class="col-12 col-lg-6">
                    <h4 class="fat-title display-4 text-center mt20 text-white"><span class="text-color-light">AFLEVER</span>ADRESS</h4>
                    <hr class="hrdark mb40 mt40">

                    <div class="row">
                        <div class="col-12 col-md-6 mb20">
                            <label for="naam" class="fat-title">Volledige Naam</label>
                            <input id="naam" type="text" class="form-control" placeholder="Mary Fuego" name="naam"
                                   @if($user != null) value="{{$user->naam}}" @endif  required>

                        </div>
                        <div class="col-12 col-md-6 mb20">
                            <label for="email" class="fat-title">Email</label>
                            <input id="email" type="email" class="form-control" placeholder="Example@fuego.nl" name="email"
                                   @if($user != null) value="{{$user->email}}" @endif required>
                        </div>
                        <div class="col-12 col-md-6 mb20">
                            <label for="tel" class="fat-title">Telefoonnummer</label>
                            <input id="tel" type="tel" class="form-control" placeholder="0612345678" name="tel">
                        </div>
                        <div class="col-12 col-md-6 mb20">
                            <label for="plaats" class="fat-title">Plaats</label>
                            <input id="plaats" class="form-control" type="text" placeholder="Holten" name="plaats" required>
                        </div>

                        <div class="col-6 col-md-3 mb20">
                            <label for="postcode" class="fat-title">Postcode</label>
                            <input id="postcode" class="form-control" type="text" minlength="4" maxlength="6" placeholder="7451PJ" name="postcode" required>
                        </div>
                        <div class="col-6 col-md-3 mb20">
                            <label for="huisnummer" class="fat-title">Huisnummer</label>
                            <input id="huisnummer" class="form-control" type="text" placeholder="1" min="1" name="huisnummer" required>
                        </div>

                        <div class="col-6 col-md-3 mb20">
                            <label for="toevoeging" class="fat-title">Toev. (opt.)</label>
                            <input id="toevoeging" class="form-control" type="text" placeholder="A" min="1" name="toevoeging">
                        </div>
                        <div class="col-6 col-md-3 mb20">
                            <label for="straat" class="fat-title">Straat</label>
                            <input id="straat" class="form-control" type="text" placeholder="Handelsweg" name="straat" required>
                        </div>

                        @if($user != null)
                            <div class="col-12 mb20">
                                <button class="btn darkgraybg text-white w-100 btn-widetxt"
                                        data-bs-toggle="dropdown" aria-expanded="false" type="button">laad adress</button>

                                <div class="dropdown-menu softgreybg pb20 pt20 pr20 pl20">
                                    <label for="addresscopy" class="fat-title">Adress</label>
                                    <select class="form-select form-control" id="addresscopy" onchange="loadAdress(parseInt(this.value))">
                                        <option value="0">Geen Adress Laden</option>
                                        @foreach($addresses as $address)
                                            <option value="{{$address->id}}">{{$address->plaats}} {{$address->straat}} {{$address->huisnummer}} {{$address->toevoeging}}</option>
                                        @endforeach
                                    </select>
                                </div>

                            </div>

                            <input type="hidden" name="user_id" value="{{$user->id}}">
                        @endif

                    </div>
                </div>

                <div class="col-12 col-lg-6">
                    <h4 class="fat-title display-4 text-center mt20 text-white"><span class="text-color-light">BETAAL</span>METHODE</h4>
                    <hr class="hrdark mb40 mt40">

                    <button type="submit" class="btn btn-orange btn-widetxt w-100">
                        BESTELLEN
                    </button>
                </div>

            </div>
        </form>

在 https 页面上提交此表单后,我得到一个未记录的 419 PAGE EXPIRED。通过 http 提交后,我在 mollie 客户端中收到一个错误,我必须拥有 SSL

标签: laravelsslpayment-gatewayngrokmollie

解决方案


推荐阅读