所以我试着用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控制,它确实有一个错误日志,但也没有有用的信息。
有人有什么想法吗?
发布于 2020-03-04 21:59:03
我在这里遇到了你的问题,作为Mollie的员工,我能够在我们的系统中找到你的测试付款。事实证明您的SSL证书无效。错误消息显示:
SSL: certificate subject name 'localhost' does not match target host name '[mysite]'如果您需要更多信息,可以随时联系Mollie support。对于技术问题,电子邮件通常是最好的。
发布于 2020-01-19 23:30:07
在您的支付脚本中,您只创建了一个支付,但是您是否真的对响应做了什么,并将用户重定向到给定的URL (在_links.checkout中),以实际开始进行实际的支付?
有关API响应的参考信息,请参阅https://docs.mollie.com/reference/v2/payments-api/create-payment;有关支付流程使用的流程的概述,请参阅https://docs.mollie.com/payments/overview!
https://stackoverflow.com/questions/59810119
复制相似问题