Skip to content

3. Webhook

Harish Toshniwal edited this page Feb 13, 2017 · 6 revisions
  • Webhook is the URL to which instamojo send's the payment details as a POST request.

  • Quoting the Instamojo API docs:

We recommend passing both webhook and redirect_url URLs while creating the Payment link because users sometimes close the tab before redirection can happen and in that case, the webhook request comes in handy and will save you from manual updation of the database.

  • As said, our migrated table "mojo_payment_details" is updated through this webhook to avoid the risk of accidentally closing of the browser tab/window.

  • This controller will handle all incoming webhook requests and dispatch them to the proper controller method:

Route::post(
    'instamojo/webhook',
    '\Lubusin\Mojo\Controllers\WebhookController@handleWebhook'
);
  • Since instamojo webhooks need to bypass Laravel's CSRF protection, be sure to list the URI as an exception in your VerifyCsrfToken middleware or list the route outside of the web middleware group:
protected $except = [
    'instamojo/*',
];
Clone this wiki locally