问题描述
我在 PHP 中使用 mollie API 进行付款。但它给了我一些错误。我已经发布了我的代码和错误截图。
这是我的代码:
<?PHP
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
try {
require_once "vendor/autoload.PHP";
$mollie = new \Mollie\Api\Mollieapiclient();
$mollie->setApiKey("test_XXXX");
$orderId = time();
$amount = $_POST['amount'];
$payment = $mollie->payments->create([
"amount" => [
"currency" => "EUR","value" => "$amount",// You must send the correct number of decimals,thus we enforce the use of strings
],"description" => "Order #{$orderId}","redirectUrl" => "https://example.com/Mollie/return/".$orderId."/","webhookUrl" => "https://example.com/Mollie/webhook/","Metadata" => [
"order_id" => $orderId,],]);
print_r($payment);
$payment_data = array(
'payment_id' => $payment->id,'user_id' => $_POST['user_id'],'order_id' => $orderId,'mode' => $payment->mode,'description' => $payment->description,'status' => $payment->status,'added_date' => date('Y-m-d'),'added_time' => date('H:i:s')
);
print_r($payment_data);
header("Location: " . $payment->getCheckoutUrl(),true,303);
} catch (\Mollie\Api\Exceptions\ApiException $e) {
echo "API call Failed: ". htmlspecialchars($e->getMessage());
}
屏幕截图:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)