Stripe Payments Code (Webhooks)

Does anyone have any code to handle Stripe payments processing (free or paid) ?

I have Paddle support but likely now will need to support Stripe also.

EDIT: Clarified webhook vs API. Aware that Chilkat plugin can handle their API

If you mean Xojo code for a web app, I can throw together some code for you. I’ve done it in PHP and it’s not very hard to authenticate a webhook request. But you’ll still need to use the Stripe API, because the payment notification does not include the line items. You use the API to expand that and some other details.

My recommendation is to host the hook on a server running nginx or Apache, and using one of the common web languages so you can take advantage of Stripe’s ready-to-use libraries. Making API requests is not difficult, but with an official library you don’t need to worry about keeping up with their API changes.

Thanks Thom and web app code was my first thought. I am however using @Tim_Parnell 's excellent Lifeboat tool so can have PHP running on the server

Ok, in that case, you can find plenty of examples online. A quick Google search yields Stripe Webhook PHP Example · GitHub which shows you a very bare-bones example of what a webhook could do. My own PHP hook script can be seen at Beacon/hook.php at master · thommcgrath/Beacon · GitHub, which is what I actually use on my server right now.

The trouble is less about handing the notification and getting data about the event, but actually writing the logic of what to do with that information. That’s always going to be custom business logic. Which if you don’t know how to write PHP code, will be trouble. It doesn’t have to be PHP of course, there are plenty of examples for other languages.

1 Like

Great thanks Thom for the information - looking at all possibilities now. If I went the PHP route then it has the advantage of many developers who could do what I want cheaply.