building a webhook's endpoint |
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
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 )
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.
proof that an old dog can learn new tricks
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 )
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 $payload=@file_get_contents('php//input'). Will that work if I am in a method? [/quote]
proof that an old dog can learn new tricks
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 )
|
Welcome Guest, Not a member yet? Register Sign In |