#anil-webhook-node

1 messages ยท Page 1 of 1 (latest)

shadow sableBOT
prisma tinsel
#

Hi
What is your ask ?

wicked dome
#

I want to use subscription mode, so i need to listen webhook events like invoice.paid or payment_failed

#

Right now i am looking to use this locally.

prisma tinsel
#

What you want to test/use locally? listening to a webhook event locally ?

wicked dome
#

Yes l

#

I used checkout.sessions.create to do the subscription now i want to listen to the webhook events.

prisma tinsel
wicked dome
#

Okay.

#

For production where to use webhook end point

#

Where to use this webhook api

prisma tinsel
wicked dome
#

Okay.

#

Register endpoint

#

We can write /stripe or anything right?

prisma tinsel
wicked dome
#

They ask to enter the endpoint.
We can write anything?

prisma tinsel
#

you need to enter a https endpoint, your endpoint.

wicked dome
#

Okay.

#

I want credit to be deducted automatically After one month, how to credits are paid

#

I have installed cli and implemented webhook locally

prisma tinsel
#

You are looking for testing cards ?

wicked dome
#

Yes

#

I am running command stripe trigger payment_intent.succeeded

#

In the dashboard its showing incomplete.

prisma tinsel
#

Can you share the PaymentIntentId ?

#

Can you share the eventId?

wicked dome
prisma tinsel
wicked dome
#

This is the event id

pi_3NDRyFSItyvlXDXE0rLcPMdM

prisma tinsel
#

This is a PaymentIntent Id, the vent id should be starting with evt_124

wicked dome
#

After running stripe payment_intent.succeeded i am getting this

prisma tinsel
#

Ah that payment intent required a 3DS authentication, because you are in India. You need to complete that payment using your frontend code

#

How are you accepting payment in your frontend ?

#

Are you using Stripe Checkout or Element ?

wicked dome
#

Stripe checkout

prisma tinsel
wicked dome
#

With cli we can do it?

prisma tinsel
#

when using the cli you are getting a 3ds check because you are in India, you can't by pass it using the cli.

wicked dome
#

Yes if do with checkout session then i am getting success but i have write some console in the webhook that are not displaying

granite marten
#

Hi there ๐Ÿ‘‹ jumping in as my teammate needs to step away soon.

Can you summarize for me what you're trying to do and where you're running into problems?

wicked dome
#

I am using webhook so with cli but getting 3ds check so he is saying we can't bypass this .

#

So i told him if i do with the frontend ( checkout.sessions.create) then i am getting payment succeeded but in the webhook endpoint i used console that values are not showing.

granite marten
#

Can you provide more details, I'm not sure I'm following what you're describing. How is 3DS related to the using a webhook? What are you using the CLI for, generating test events or are you using it to forward events to a local test webhook endpoint?

but in the webhook endpoint i used console that values are not showing.
What does this mean? What code are you running, what behavior were you expecting to see, and what behavior did you see instead?

wicked dome
#

Yes i am using it to forward events to local test

#

If the payment is done then webhook end point should run

granite marten
#

Is it not running?

#

I'm going to need explicit details about what you're trying and what you're seeing to get an understanding of what you're trying to accomplish and what you're seeing that you aren't expecting.

wicked dome
#

In the /webhook end point i am using console inside each switch case , but they are not printing, if the endpoint is running then it should print the console matched with the switch case right?

granite marten
#

Maybe, hard to say without understanding the code you're referring to, maybe the variable you're using for the switch is null? Is your switch going into the default case, do you have a long line there? Did you put a console line outside of the switch to see if that logs anything out, so you can remove any uncertainty about it being related to the switch statement?

wicked dome
#

Yes i have used console outside switch also

#

Do i am doing something wrong here?

granite marten
#

I don't know, I still don't have a good understanding of the code you're running or process you're using to test it.

#

What steps are you taking to test your endpoint code?

wicked dome
#

I am using this

#

For webhook.

#

I have a button after clicking on button checkout page opens and i am filling the details and submit the payment, the payment succeeded, shown in the stripe dashboard also

granite marten
#

What is the ID of your account?

wicked dome
#

acct_1MiwZrSltyvlXDXE

#

This is the account id

shadow sableBOT
granite marten
#

I'm not finding an account with that ID, so I'm unable to review your webhook endpoint settings.

#

Did you register your webhook endpoint that you're testing to your Stripe account in the Stripe dashboard? Or are you using the Stripe CLI to forward events to your local server for testing, if this option, what command are you using to start the CLI listener?

wicked dome
#

Cli to forward events

granite marten
#

Okay, what command are you using for that?

wicked dome
#

Stripe trigger payment_intent.succeeded

#

By doing this i got payment incomplete , need to enable 3ds security.

#

So to test locally what are the other methods?

#

To register an endpoint.

granite marten
#

stripe trigger doesn't send Events to your webhook endpoints, it executes requests against your account to try to trigger the request type of Event. If you're wanting to forward Events from your account to a local listener, you need to use stripe listen:
https://stripe.com/docs/cli/listen

wicked dome
#

Yes i follow this
Step 1 ) i forward to 3000 then run the above command

#

Like here is showing trigger succeeded but in the dashboard payment is incomplete.

granite marten
#

Do you have the ID of a Payment Intent that one of those requests created?

wicked dome
#

This is the id
pi_3NDRyFSItyvlXDXE0rLcPMdM

granite marten
#

Alright, so it looks like that payment is requiring 3DS based on your account's country and the country of the test card being used:
https://support.stripe.com/questions/3d-secure-authentication-for-international-card-payments-to-indian-businesses

What is the overall goal here, to be able to test your webhook endpoint with your flow or to explicitly be able to test it via stripe trigger?

If the first one, I would recommend trying to run through your test checkout experience and see if the Events from that are forwarded to your endpoint as expected.

If the goal is to be able to run this with stripe trigger, then I think you'll need to override the default fixture that it is using.

#

Can you try running:
stripe trigger payment_intent.succeeded --edit
and in the editor replace pm_card_visa with pm_card_in and let me know what behavior that results in?

wicked dome
#

Okay i run the command

#

But by editor what do you mean

granite marten
wicked dome
#

I am registering an end point

granite marten
#

Wait, so you're not using stripe listen to forward events to a local endpoint?

granite marten
wicked dome
#

I was registering
But now i am trying with the ngrok to get https

#

Yes with edit flag it shows waiting for editor

copper siren
#

Hello ๐Ÿ‘‹
Taking over
This seems like a long thread, can you give me a quick summary of what you're stuck on currently?

wicked dome
#

Actually i am using webhook api in next js

#

So i am getting signature verification failed

#

May be the issue with body parser

#

Do you have any idea?

copper siren
#

Most likely an issue with the parser. Endpoint expects raw request body

#

have you tried printing it out to see what you're getting before calling constructEvent?

wicked dome
#

Yes i am getting an object with all the details

copper siren
#

With stripe-node, you'd want to see a buffer instead. So yeah something is parsing the body before it hits your endpoint

wicked dome
#

Okay i am checking what's the issue here

#

Its working now

#

But it prints all the case like payment failed
Subscription created
Payment succeeded

#

Do you have any idea?

copper siren
#

Not sure! Did you change anything in your code?

wicked dome
#

No

#

Can we return something like payment succeeded to frontend after switch case?

copper siren
#

It all depends on your integration, but yeah you could.

wicked dome
#

Okay.

shadow sableBOT