GraphCool Functions Webhook endpoint


#1

Hello there, GraphCool mates!

I’m dealing with this … thing, and I’m not able to find a way out.

Let me give you some context:
I’m building a small e-commerce website for my brother that’s built with React + GraphQL (based on GraphCool, obvious) and I want to make charges with Stripe. I know how to handle the way of creating stripe customers and charges with GraphCool functions but … here’s the empty void that’s swalowing me down to despair …

Making a charge to stripe does not necessary means that the charge had succeed, Stripe makes a call to one endpoint that you have to send you a payload with the confirmation of the charge or the failure, for example, I give them the following endoing: https://my-ecommerce-app.com/stripe/webhooks
Inside this endpoint lets say I have a NodeJS app with Express.js that will handle the routing and bla bla bla.

What I want to know is … how do I expose a GraphCool function so I can set it into stripe so they send me the payment confirmation or failure to for example: http://localhost:60000/simple/v1/cj9yeqct1000801103ngrjihp/stripe-webhook (I got this URL with my GraphCool Framework Docker Cluster)

Where stripe-webhook at the URL is a GraphCool function : )

Hope to hear back from you guys because I’m on the need so I can keep working on this project.

Warm regards,
Alex.


#2

Functions you deploy to Graphcool are only accessible through the GraphQL API. You cannot deploy a webhook like this directly to Graphcool. So if you need a callback webhook for Stripe, you need to host that somewhere else. AWS Lambda functions are a good option for this.


#3

Okay, so I need another service apart from GraphCool to handle this, and then connect that backend service to GraphCool. Got it !!

Thanks, mate!