#chiayi

1 messages · Page 1 of 1 (latest)

blazing wyvernBOT
warm geyser
#

hi! that means that your local server is not running.

abstract nacelle
#

the webhook api should be the endpoint of my backend server right?

#

i am able to access my backend server's swagger ui

warm geyser
#

not sure what you mean by "the webhook api".

abstract nacelle
warm geyser
#

makes sense

#

so do you have another terminal window that is running stripe listen --forward-to=localhost ?

abstract nacelle
#

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}
warm geyser
#

are you sure that python code is running on port 8000?

abstract nacelle
#

yes, this is the swagger ui

warm geyser
#

hmm, not sure, it mostly feels like it should work

#

does your endpoint work if you call it directly?

abstract nacelle
#

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"
}'
warm geyser
#

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

blazing wyvernBOT
abstract nacelle
#

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

ripe plaza
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

abstract nacelle
#

im running some tests! will let u know