#icurrytheteam

1 messages · Page 1 of 1 (latest)

inner quailBOT
true steeple
vocal yacht
#

May I have a second to take a look?

true steeple
#

Sure, let me know if you have any specific Qs

vocal yacht
#

So my backend is setup almost exactly like the example. I'm pretty sure I'm using the right endpoint and correctly identifying the request header.

#

But I'm still recieving the verification failure.

true steeple
#

Are you getting a specific error in your webhook?

true steeple
vocal yacht
#

payment_invoice.succeeded

#

but it happens for all events

#

Do I just pass the endpoint secret when making the request in Postman?

true steeple
true steeple
vocal yacht
# true steeple Which request in Postman?

I created the post request using django on my local setup. After running the local instance to test, I'd like to make the request using postman. Specifically, I want to try manually firing the webhook in postman.

true steeple
#

Can you please share an evt_xx ID of one that is erroring?

#

Are you using the CLI?

vocal yacht
#

By evt_xxx, you're specifying the event id right?

#

also, i'm not using the cli

#

sorry if this seems obvious, but how do i fetch the id?

true steeple
#

Check the Dashboard

vocal yacht
#

i'm not recieving any events in the dashboard.

true steeple
#

Can you share the ID of an object you're creating in Postman? Anything

#

I can't really help without an ID

vocal yacht
#

I can give something now

#

evt_3MeH22KwCfM7dUhH0b2gKjIm

true steeple
#

And can you share the exact error you get in your webhook?

true steeple
#

Otherwise not sure which webhook this event is being sent to

vocal yacht
#

right, i realized that i was creating events with cli and not postman...

true steeple
#

So you're using stripe listen --forward-to correct?

vocal yacht
#

yes

#

stripe listen --forward-to localhost:4242/api/payments/webhook/

#

it seems to be listening

true steeple
#

Ok, and which value are you using as the signing secret?

vocal yacht
#

whsec_ecc086f76dc7abe8f12dd90d2f0b53af2a03b0cf2dfd4a13cc1923a5bf19a11d

#

this^^

true steeple
#

Is that what the CLI outputs when you use stripe listen?

vocal yacht
#

yes

true steeple
#

Can you share your webhook code please

#

And the full error

vocal yacht
#
    payload = request.body
    sig_header = request.META['HTTP_STRIPE_SIGNATURE']
    event = None

    try:
        event = stripe.Webhook.construct_event(
            payload, sig_header, endpoint_secret
        )
        print('hello1')
    except ValueError as e:
        # Invalid payload
        return Response({"message": "webhook contruct failed"},status=400)
    except stripe.error.SignatureVerificationError as e:
        # Invalid signature
        return Response({"message": "signature verification failed"},status=400)
    if event['type'] == 'payment_intent.succeeded':
        print('hello2')
        return Response({'message': "payment intent succeeded"}, status=200)
    elif event['type'] == 'payment_intent.created':
        print('hello4')
        return Response({'message': "payment intent created"}, status=200)
    elif event['type'] == 'invoice.payment_failed':
        print('hello55')
        failed_payment = event['data']['object']
        print(failed_payment)
        print('payment failed')
        return Response({'message': "payment failed"}, status=200)
    else:
        print('hello3')
        return Response({'message':"payment failed"}, status=400)```
#
@api_view(('POST',))
@authentication_classes([])
@permission_classes([])```
#

i had to split it into two since i dont have discord nitro

#

I'm recieving events now tho.

true steeple
#

Ok, so it's working?

vocal yacht
#

surprisingly, yes

#

i can do it using the cli

#

i didnt intent for that, but this works much better

true steeple
#

Perfect

vocal yacht
#

so thanks, i guess?

#

yeah, thanks

#

awesome