使用 Laravel Omnipay(mollie 网关)付款
Payments with Laravel Omnipay (mollie gateway)
我目前无法尝试使用 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 cannot load https://www.mollie.com/payscreen/select-method/PRMtm6qnWG. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://kapelhoektickets.dev' is therefore not allowed access.
我该如何解决这个问题?
But what's the $issuerId?
Issuer ID 是发行者的唯一标识符,例如ideal_ABNANL2A。创建支付时,将此 ID 指定为发行者参数,以将消费者直接转发到他们的银行环境。
您可以通过调用此 API url 查看可用发行者列表:
https://api.mollie.nl/v1/issuers
如https://www.mollie.com/be/docs/reference/issuers/list
所述
要了解有关发行人的更多信息,请访问 API 文档的这一部分:
https://www.mollie.com/be/docs/reference/issuers/get
我目前无法尝试使用 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 cannot load https://www.mollie.com/payscreen/select-method/PRMtm6qnWG. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://kapelhoektickets.dev' is therefore not allowed access.
我该如何解决这个问题?
But what's the $issuerId?
Issuer ID 是发行者的唯一标识符,例如ideal_ABNANL2A。创建支付时,将此 ID 指定为发行者参数,以将消费者直接转发到他们的银行环境。
您可以通过调用此 API url 查看可用发行者列表: https://api.mollie.nl/v1/issuers
如https://www.mollie.com/be/docs/reference/issuers/list
所述要了解有关发行人的更多信息,请访问 API 文档的这一部分: https://www.mollie.com/be/docs/reference/issuers/get