mollie / laravel-mollie

Mollie API client wrapper for Laravel & Mollie Connect provider for Laravel Socialite
https://www.mollie.com/
MIT License
326 stars 62 forks source link

paypal payment method not showing on checkout page #146

Closed daniele-chilicode closed 4 years ago

daniele-chilicode commented 4 years ago

Hi everyone, I followed the instructions to make a one-time payment with Mollie (and it works). In the Mollie dashboard I have activated the Paypal payment method as well as credit card, but the Paypal payment method does not appear on the checkout page (and that is the issue). I contacted the technical support of Mollie and Paypal and they said the connection between Mollie and Paypal is ok. There is something i am missing on the Laravel side (the things i had to handle to manage to enable users to pay with Paypal)? Can you help me? I google a lot to resolve this, but with no luck. Thank you

sandervanhooft commented 4 years ago

Can you share your code?

daniele-chilicode commented 4 years ago

Hi, here the code of the controller method (i removed some app specific code that is not of interest, like the redirect routes)

// ...
$user = Auth::user();
if ($user->mollie_customer_id == null) {
    $customer = Mollie::api()->customers()->create([
        'name' => $user->name,
        'email' => $user->email,
    ]);
    $user->mollie_customer_id = $customer->id;
    $user->save();
    $user = $user->fresh();
}

$payment = Mollie::api()->payments()->create([
    'amount' => [
        'currency' => 'EUR',
        'value'    => 12
    ],
    'customerId'   => $user->mollie_customer_id,
    'sequenceType' => 'first',
    'description'  => 'the description ',
    'redirectUrl'  => <the redirect route>,
    'webhookUrl'   => <the webhook route>,
]);

$payment = Mollie::api()->payments()->get($payment->id);

return redirect($payment->getCheckoutUrl(), 303);

Thank you

sandervanhooft commented 4 years ago

Did you confirm with Mollie support that your account is correctly set-up with PayPal for recurring payments, not only one-offs?

daniele-chilicode commented 4 years ago

Hi, after your message I requested PayPal support to enable recurring payments as you suggested. I thought it wasn't necessary for one-time payments. When they will enable it, I will try to pay again to see if paypal finally shows up between the valid payment methods. Thank you for your support!

sandervanhooft commented 4 years ago

No problem. I expect this will do the trick. I'll close the issue for now, let me know if it should be reopened.

daniele-chilicode commented 4 years ago

Hi, paypal said that they have activated recurrent payment (for the sandbox account for now), but i still cant see paypal on the available payment methods and if "force paypal method" with the following code

$payment = Mollie::api()->payments()->create([
            'amount' => [
                'currency' => 'EUR',
                'value'    => 10,
            ],
            'method' => 'paypal',
            'customerId'   => $user->mollie_customer_id,
            'sequenceType' => 'first',
            'description'  => 'description',
            'redirectUrl'  => 'the redirect route',
            'webhookUrl'   => 'the webhook route',
        ]);

i will get the error in the image.

errore_laravel

So i think i have a bad configuration in my laravel application. There is something i need to do to make the mollie laravel client knows about paypal (paypal client id and secrets)? Thank you in advance

sandervanhooft commented 4 years ago

This is something in the configuration of PayPal/Mollie, not your app. Best to contact Mollie support if you have set up PayPal recurring correctly now. Note that it also may take some time before the changes at PayPal are visible to Mollie. But I don't think that should take longer than 24h.