#anil-webhook-node
1 messages ยท Page 1 of 1 (latest)
Hi
What is your ask ?
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.
What you want to test/use locally? listening to a webhook event locally ?
Yes l
I used checkout.sessions.create to do the subscription now i want to listen to the webhook events.
You can use stripe cli:
https://stripe.com/docs/stripe-cli/about-events
You can follow this guide for going live:
https://stripe.com/docs/webhooks/go-live
Can you clarify this question please ?
They ask to enter the endpoint.
We can write anything?
you need to enter a https endpoint, your endpoint.
Okay.
I want credit to be deducted automatically After one month, how to credits are paid
I have installed cli and implemented webhook locally
You are looking for testing cards ?
Yes
I am running command stripe trigger payment_intent.succeeded
In the dashboard its showing incomplete.
Can you share the PaymentIntentId ?
You can use this test cards:
https://stripe.com/docs/testing#international-cards
But you are creating an event using stripe cli, you should have a PaymentIntent with status completed.
Can you share the eventId?
Can you share the eventId generated from the cli command
This is the event id
pi_3NDRyFSItyvlXDXE0rLcPMdM
This is a PaymentIntent Id, the vent id should be starting with evt_124
After running stripe payment_intent.succeeded i am getting this
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 ?
Stripe checkout
You can create a test Checkout Session and complete it using one of these cards:
https://stripe.com/docs/testing#international-cards
You'll get an event payment_intent.succeeded
With cli we can do it?
when using the cli you are getting a 3ds check because you are in India, you can't by pass it using the cli.
Yes if do with checkout session then i am getting success but i have write some console in the webhook that are not displaying
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?
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.
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?
Yes i am using it to forward events to local test
If the payment is done then webhook end point should run
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.
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?
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?
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?
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
What is the ID of your account?
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?
Cli to forward events
Okay, what command are you using for that?
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.
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
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.
Do you have the ID of a Payment Intent that one of those requests created?
This is the id
pi_3NDRyFSItyvlXDXE0rLcPMdM
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?
The --edit flag is supposed to open the fixture for editing in an editor/IDE:
https://stripe.com/docs/cli/trigger#trigger-edit
I am registering an end point
Wait, so you're not using stripe listen to forward events to a local endpoint?
Also, how does this relate to running the stripe trigger command with the --edit flag?
I was registering
But now i am trying with the ngrok to get https
Yes with edit flag it shows waiting for editor
Hello ๐
Taking over
This seems like a long thread, can you give me a quick summary of what you're stuck on currently?
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?
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?
Yes i am getting an object with all the details
With stripe-node, you'd want to see a buffer instead. So yeah something is parsing the body before it hits your endpoint
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?
Not sure! Did you change anything in your code?
It all depends on your integration, but yeah you could.
Okay.