#jcalentine

1 messages · Page 1 of 1 (latest)

steel waspBOT
grim zephyr
#

Hi there, can you tell me more about the problems that you are trying to resolve?

thorny spire
#

ok so I am currently trying to implement a webhook after a successful payment.

#

I am getting successful payments with no issues but the webhook is giving me 403 errors

grim zephyr
#

OK, do you have the webhook event ID?

thorny spire
#

on the checkout.session.completed

#

yes one sec

#

we_1O0E7uJ4gBUKtXvTynXD3xs6

#

the payments are all succeeding but the webhooks are not.

grim zephyr
thorny spire
#

and i need the webhook to update my database after a successful checkout session

grim zephyr
#

and this event is still pending because your webhook endpoint responded 400, and the response from your server says Invalid Stripe Signature

thorny spire
#

yes

grim zephyr
#

I'd suggest you to double check the webhook secret that you use in your webhook integration.

thorny spire
#

that was because I tried something else

#

look at the one prior

#

one sec

#

let me do it again i just re-deployed my test server

#

here you go: we_1O0E7uJ4gBUKtXvTynXD3xs6

grim zephyr
#

Was there a new event? I don't see any

thorny spire
#

yeah one sec

#

you should see one 10:14:30pm

grim zephyr
#

No I don't see any, the latest event occured at
2023-10-13 02:14:29 UTC

thorny spire
#

can you check now?

grim zephyr
#

Still the same.

#

Do you have the event ID? it starts with evt_

thorny spire
#

evt_1O0axoJ4gBUKtXvTnnHa84Mx

#

here is the one prior: "id": evt_1O0atVJ4gBUKtXvT4pbzZDke

grim zephyr
#

Your server returned 403 this time

  <h1>Forbidden <span>(403)</span></h1>
  <p>CSRF verification failed. Request aborted.</p>```
thorny spire
#

yes

#

but my webhook is set with a csrf_exempt decorator because it is not required correct?

grim zephyr
#

Why do you want to set a CSRF verification in your webhook server?

thorny spire
#

I do not. I want to wait until i get a checkout.session.completed. Then i want to flag a user from standard to premium user in the database

#

i have this in my view: @csrf_exempt
def stripe_webhook(request):

grim zephyr
#

OK, then I'd suggest you to fix this CSRF problem and try again.

thorny spire
#

i am confused. So i need to provide a csrf token for the webhook?

grim zephyr
#

No, I don't think you need to do that. I mean you should remove the CSRF verification for webhook events sent from Stripe.

thorny spire
#

what about this event "id": "evt_1O0bbBJ4gBUKtXvT5FBL6Kfa",