【发布时间】:2017-09-26 19:43:46
【问题描述】:
我目前无法使用 Omnipay 创建付款。我的项目中安装了以下库:
但我在启动时遇到了问题。我在example 中看到我需要这些参数:
$params = [
'amount' => $order->amount,
'issuer' => $issuerId,
'description' => $order->description,
'returnUrl' => URL::action('PurchaseController@return', [$order->id]),
];
但是 $issuerId 是什么?我想与Mollie 集成。
有人可能有一个使用 laravel Omnipay 和 Mollie 的例子吗?
更新:
我正在尝试使用 ajax 调用提交我的表单。在我的 PHP 函数中,我有以下代码:
$gateway = Omnipay\Omnipay::create('Mollie');
$gateway->setApiKey('test_gSDS4xNA96AfNmmdwB3fAA47zS84KN');
$params = [
'amount' => $ticket_order['order_total'] + $ticket_order['organiser_booking_fee'],
'description' => 'Kapelhoek wijkfeesten',
'returnUrl' => URL::action('EventCheckoutController@fallback'),
];
$response = $gateway->purchase($params)->send();
if ($response->isSuccessful()) {
// payment was successful: update database
print_r($response); die;
} elseif ($response->isRedirect()) {
// redirect to offsite payment gateway
return $response->getRedirectResponse(); die;
} else {
// payment failed: display message to customer
echo $response->getMessage(); die;
}
但现在我收到以下控制台错误:
XMLHttpRequest 无法加载 https://www.mollie.com/payscreen/select-method/PRMtm6qnWG。请求的资源上不存在“Access-Control-Allow-Origin”标头。因此,不允许访问 Origin 'http://kapelhoektickets.dev'。
我该如何解决这个问题?
【问题讨论】:
-
请注意,
issuer字段是可选的。你可以省略它,Mollie 只会显示一个屏幕,消费者可以在其中选择他们的银行。 -
@Daan,我的话题更新了,你能帮帮我吗?
标签: laravel laravel-5.3 payment omnipay mollie