Hormis Lona
Hormis Lona

Reputation: 523

Can I use localhost URL as Webhook URL in Instamojo?

I am implementing instamojo payment method into my website. Can I use a localhost URL as Webhook URL in order to test the process?

Upvotes: 1

Views: 3606

Answers (5)

Aditya Sengupta
Aditya Sengupta

Reputation: 473

I'm from Instamojo.

You can't use a local URL. This is because a webhook request is a POST request that is made from our server. Therefore, the only URLs that we can make these requests to would be URLs that are publicly available.

For testing purposes, I would recommend using RequestBin. You can create a new bin and paste the URL for that bin in the webhook URL field of your Instamojo link. This will give you a link that is accessible by our server and you can inspect the POST requests to this link by appending ?inspect at the end of the URL.

Upvotes: 7

Mayur Fartade
Mayur Fartade

Reputation: 317

You cannot use the localhost URL as a webhook URL in order to test the process. But you can simply bypass it, open hosts file from C:\Windows\System32\Drivers\etc\hosts At the end of the line write

127.0.0.1      yourname.com

And access localhost using yourname.com. Just change localhost/your-location url with yourname.com/your-location in the PHP file.

Upvotes: 0

Hiway
Hiway

Reputation: 440

It is possible to forward Instamojo's webhooks to your local machine using tools like localtunnel.

Suppose you are running your local server at port 8000, in a new terminal window, execute this:

  • lt --port 8000

It will show you output like:

  • your url is: https://whawgpctcs.localtunnel.me

This is a temporary webhook URL that will forward every HTTPS request sent to https://whawgpctcs.localtunnel.me to your local server running on port 8000.

  • Paste this temporary url into Instamojo's webhook field and continue testing.

  • Remember to remove the temporary webhook URL from Instamojo once you are done testing

The temporary webhook URL is valid as long as the lt --port 8000 command (and your Internet connection) is active.

Upvotes: 3

Hormis Lona
Hormis Lona

Reputation: 523

We can't use localhost or as Webhook URL.If it is used the following error will show "Domain name should not be "localhost" or "127.0.0.1" ". So it must be a live URL.

Upvotes: 0

Sudhir pradhan
Sudhir pradhan

Reputation: 82

I doubt if you can use local host URL but instead you can create new links, as below https://www.instamojo.com/api/1.1/links/

Upvotes: 1

Related Questions