Search code examples
laravellaravel-5.3paymentomnipaymollie

Payments with Laravel Omnipay (mollie gateway)


I'm currently stuck trying to create a payment with Omnipay. I have the following libraries installed in my project:

But I'm having problems starting. I see in the example that I need these params:

$params = [
    'amount' => $order->amount,
    'issuer' => $issuerId,
    'description' => $order->description,
    'returnUrl' => URL::action('PurchaseController@return', [$order->id]),
];

But what's the $issuerId? I would like to have an integration with Mollie.

Does someone maybe has an example of using laravel Omnipay with Mollie?

UPDATE:

I'm trying to submit my form with an ajax call. In my PHP function I have the following code:

 $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;
}

But now I'm getting the following console error:

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.

How can I fix this?


Solution

  • But what's the $issuerId?

    Issuer ID is The issuer's unique identifier, for example ideal_ABNANL2A. When creating a payment, specify this ID as the issuer parameter to forward the consumer to their banking environment directly.

    You can see a list of available issuers by calling this API url: https://api.mollie.nl/v1/issuers

    as stated in https://www.mollie.com/be/docs/reference/issuers/list

    To read more about the issuer visit this part of the API-documentation: https://www.mollie.com/be/docs/reference/issuers/get