Mollie webhook没叫?

问题描述 投票:0回答:1

因此,我正在尝试使用Mollie为学校项目进行虚假的测试付款。付款和付款后的重定向工作正常,但Webhook.php似乎没有被调用。这是付款脚本中正在发生的事情:

$payment = $mollie->payments->create([
"amount" => [
    "currency" => "EUR",
    "value" => "7.50"
],
"description" => "Ad Highlight",
"redirectUrl" => "https://[mysite]/redirect.php [working]",
"webhookUrl"  => "https://[mysite]/webhook.php"]);

这是网络挂钩的外观:

    $servername = "localhost";
    $username   = "[workingusername]";
    $password   = "[workingpassword]";
    $dbname     = "[workingDB]";
    $conn = new mysqli($servername, $username, $password, $dbname);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    $sql = "INSERT INTO test (te)
    VALUES ('TEST')";

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
require_once("mollie/vendor/autoload.php");
require_once("mollie/examples/functions.php");

$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setApiKey("[validkey]");

$payment = $mollie->payments->get($_POST["id"]);
$orderId = $payment->metadata->order_id;
/*
 * Update the order in the database.
 */
database_write($orderId, $payment->status);

if ($payment->isPaid() && !$payment->hasRefunds() && !$payment->hasChargebacks()) {
    /*
     * The payment is paid and isn't refunded or charged back.
     * At this point you'd probably want to start the process of delivering the product to the customer.
     */
}

您可以看到,我进行了一个测试查询,只是为了检查webhook是否正在执行任何操作。当我打开浏览器并直接转到webhook.php文件时。它实际上执行查询,我可以在数据库中看到它。因此,我得出的结论是Webhook文件可以,但是由于某些原因,Mollie在付款后没有调用它。

我也找不到任何错误日志或其他任何内容。该站点由Directadmin控制,该站点确实有错误日志,但是那里也没有有用的信息。

有人有什么想法吗?

php payment mollie
1个回答
0
投票

在付款脚本中,您仅创建付款,但是您实际上是否在对响应进行任何操作,并将用户重定向到给定的URL(在_links.checkout中),从而开始实际开始实际付款?

请参阅https://docs.mollie.com/reference/v2/payments-api/create-payment以获取对API响应的引用,并请参阅https://docs.mollie.com/payments/overview以了解支付过程所使用的流程的概述!

© www.soinside.com 2019 - 2024. All rights reserved.