#chiayi
1 messages · Page 1 of 1 (latest)
hi! that means that your local server is not running.
the webhook api should be the endpoint of my backend server right?
i am able to access my backend server's swagger ui
not sure what you mean by "the webhook api".
webhook api means the endpoint being setup in this doc https://stripe.com/docs/webhooks/quickstart?lang=python
makes sense
so do you have another terminal window that is running stripe listen --forward-to=localhost ?
yes correct
this is the webhook api code
@router.post("/chiayi-test")
async def chiayi_test(request: Request) -> dict:
endpoint_secret = "whsec_4c0915cdf92defdc3b87ac2b8e66dc0d6dff59d2bfee010248ddd6da6cc3b97d"
if endpoint_secret:
try:
event = stripe.Webhook.construct_event(
await request.body(), sig_header, endpoint_secret
)
except stripe.error.SignatureVerificationError as e:
print('Webhook signature verification failed.' + str(e))
return {"success": False}
return {"success": True}
are you sure that python code is running on port 8000?
yes, this is the swagger ui
hmm, not sure, it mostly feels like it should work
does your endpoint work if you call it directly?
like curl -d '{}' http://localhost:8000/chiayi-test
let me try
yep it works
curl --location 'http://localhost:8000/chiayi-test' \
--header 'Stripe-Signature: t=1690195645,v1=c76f6e038db24268a304d3fbc5dc427f2228826ca2965106236b5ae4069b0878' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "usr_O5F75bOxsstgS7",
"account_id": "acct_1NJ4dDKx3YMpzW4U"
}'
hmm, strange
really not sure. I'd make 100% sure that the three separate terminal windows(one to run the Python server, one to run stripe listen, one to run stripe trigger) are set up(e.g. you're not stopping the Python server to run stripe listen) and try to do a fresh test. Might also restart to make sure nothing else is listening on port 8000
ok i know why, it was because i am running stripe listen and stripe trigger on devcontainer A and localhost:8000 is hosted on devcontainer B
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
im running some tests! will let u know