【问题标题】:Not redirecting to payment page when payment created创建付款时不重定向到付款页面
【发布时间】:2019-05-09 18:45:21
【问题描述】:

我正在尝试使用他们提供的示例将 laravel-mollie 集成到我的网站中。当我创建新付款时,它应该将我重定向到付款页面,但它没有显示任何内容.. 这是我的代码:

public function preparePayment($data, $orderId)
{
    $payment = Mollie::api()->payments()->create([
        'amount' => [
            'currency' => 'EUR',
            'value' => '100.00', // You must send the correct number of decimals, thus we enforce the use of strings
        ],
        "description" => "My first API payment",
        "redirectUrl" => route('mollie.payment.status'),
        'webhookUrl' => route('webhooks.mollie'),
        "metadata" => [
            "order_id" => $orderId,
        ],
    ]);

    $payment = Mollie::api()->payments()->get($payment->id);

    // redirect customer to Mollie checkout page
    return redirect($payment->getCheckoutUrl(), 303);
}

我打印了网址。这是显示链接。但不会重定向到付款页面。我做错什么了!谁能指出我?

【问题讨论】:

    标签: laravel-5.5 mollie


    【解决方案1】:

    $payment 对象看起来没问题,只需仔细检查 redirectUrl 的参数是否正确。

    另外,如果我没记错的话,在 Laravel 中重定向到外部 URL 应该是这样的:

    ...
    return redirect()->away($payment->getCheckoutUrl());
    

    【讨论】:

    • 感谢您的宝贵时间,但问题是,我在 trait 中使用了这段代码。这就是为什么它没有重定向..
    猜你喜欢
    • 2018-11-29
    • 2021-07-04
    • 2014-07-15
    • 2017-12-07
    • 2012-06-26
    • 1970-01-01
    • 2017-06-11
    • 2022-07-01
    • 1970-01-01
    相关资源
    最近更新 更多