Welcome Guest, Not a member yet? Register   Sign In
building a webhook's endpoint
#1

(This post was last modified: 06-17-2022, 08:40 AM by richb201.)

I have a webhook coming from Stripe. Should I create my endpoint by using the controller and have its function call a function in a Model? Or is there a better way in CI3 such as directly accessing a view? If I do the view, how do I directly address  it from Stripe? This is running on the public internet.
proof that an old dog can learn new tricks
Reply
#2

I have the same question. Pls help.
Reply
#3

I found this, you guys can read it.

LORNAJANE Blog - Handling Incoming Webhooks in PHP

Be sure to also read the Comments.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Thx insite.
proof that an old dog can learn new tricks
Reply
#5

(This post was last modified: 06-18-2022, 08:14 AM by richb201.)

Insite I read the article (and comments) and can surely see the authors point. In my case, I am just marking if the users payment went through. I already have a record for each user in my table. So I just need to update the field to paid or not paid. I use RDS, not a local table, so there could be an aws delay. But I am not really doing any processing.

For speed purposes, should the webhook being going directly to a view, rather than a method in my controller? How can l directly address a view from the app that is sending the webhook? How do I path it?

Thx

(06-18-2022, 08:12 AM)richb201 Wrote: Insite I read the article (and comments) and can surely see the authors point. In my case, I am just marking if the users payment went through. I already have a record for each user in  my table. So I just need to update the field to paid or not paid. I use RDS, not a local table, so there could be an aws delay. But I am not really doing any processing.

For speed purposes,  should the webhook being going directly to a view, rather than a method in my controller? How can l directly address a view from the app that is sending the webhook? How do I path it?

Or is a method in the controller preferred?

Thx
proof that an old dog can learn new tricks
Reply
#6

If you need to also update a database table field then yes a method would be the way to go.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

(This post was last modified: 06-19-2022, 06:56 AM by richb201.)

Insite, good idea. Just one question. The examples show getting the payload with read file://input. How will thar work if I am going through a method?

[quote pid="397473" dateline="1655646259"]
Insite, good idea. Just one question? The examples (in stripe) show getting the payload with $[email protected]_get_contents('php//input').  Will that work if I am in a  method?
[/quote]
proof that an old dog can learn new tricks
Reply
#8

Yes, it should still work it's just pure php code.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB