因此,我正在尝试使用 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"]);
这是 webhook 的样子:
$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 控制,它确实有一个错误日志,但那里也没有有用的信息。
有人有什么想法吗?