laravel-mollie: Not getting into the webhook?

Hi,

I’m struggling a bit… for some reason its not getting into the webhook.

Web route: Route::post('pay/status', 'DonateController@handle');

Controller code for store:

$payment = Mollie::api()->payments()->create([
        'amount' => [
          'currency' => 'EUR',
          'value' => '10.00', 
        ],
        "description" => "New Donation!",
        'redirectUrl' => "https://xxxx.com/",
        'webhookUrl'   => "https://xxxx.com/pay/status",
      ]);
      $donate = new Donate;
      $donate->payment_id = $payment->id;
      $donate->payment_status = 'Pending';
      $donate->save();
      return redirect($payment->getCheckoutUrl());

Handle:

public function handle(Request $request) {
      $donateid = $request->id;
      $donate = Donate::where('payment_id', $donateid);
      $payment = Mollie::api()->payments()->get($donateid);
      
      if($payment->isPaid()) {
        $donate->payment_status = "Paid";
        $donate->save();
      }
    }

VerifyCsrfToken:

protected $except = [
    'pay/status'
  ];

Its perfecty redirecting, but not getting into the handle part. Nothing in the log files aswell. It just redirect to the giving redirection url.

Any help would be awesome, thanks in advance for helping me and telling me what i’m doing wrong. 😉

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 33

Most upvoted comments

Hi @JerryKrakel ,

The webhook can only be called if its url is publicly available.

If you’re running a test server locally which is not reachable by Mollie, Mollie is unable to make a call to your webhook.

I’ve just googled a bit for a solution as it’s a common problem; perhaps you could use a service like this one which generates a online available webhook url for manual testing.

Does that help?