Webhooks Stripe

47 views
Skip to first unread message

piero....@gmail.com

unread,
Nov 6, 2020, 8:32:34 AM11/6/20
to web2py-developers
I am trying to catch the webhooks event from stripe.
I got some problem doing this specially because of the explanation on their site is for Django and not fit with web2py.

This is the example for Django. They pass the request to catch the payload
@csrf_exempt 
def my_webhook_view(request): 
     payload = request.body event = None 
      try: 
           event = stripe.Event.construct_from( json.loads(payload), stripe.api_key ) 
      except ValueError as e: 
  # Invalid payload 
            return HttpResponse(status=400)

If I do this with Web2py I got an invalid function error because of the variabile in the definition. 
What should be the right way to catch the request call from stripe server to mine endpoint?
Reply all
Reply to author
Forward
0 new messages