#.suryamani
1 messages · Page 1 of 1 (latest)
4000000000000341 i will use this card for subscribe, when i click subscribe it show this card is declined but in webhook event it trigger customer.subscription.created event
But in Stripe cli Command prompt it shows invoice.payment_failed event
How are you create Subscriptions? With Checkout Session, the Subscription endpoint, something else?
I'm using graduation pricing
But how do you create the Subscription? Which API do you use?
Can you share an example Subscription ID (sub_xxx)?
sub_1NuT7pLabf7E4J4FX3yJZwRG
4000000000000341 i will use this card for subscribe, when i click subscribe it show this card is declined but in webhook event it trigger customer.subscription.created event
But to me all of this seems normal. Can you clarify what is the issue here?
if the payment is failure when subscribe which event event will trigger in webhook events
For subscriptions payment failures, the main event is invoice.payment_failed.
but for me In webhook event API customer.subscription.created event will trigger
The Checkout Session had to create a Subscription. It's just that the first payment failed. So it's expected.
You can ignore the customer.subscription.created event since you are using Checkout Session
Instead listen to checkout.session.completed, to know when the Subscription is created with the first payment successful.
I'm testing the sequence for email generate using webhook events. So, I test like Enter card details and click subscribe if I enter wrong details the payment will fail. My question is on that time which event will trigger?
The best way is to try this yourself, and look at all the events in https://dashboard.stripe.com/events
However I don't understand why you do all of this? If you are using Checkout Session to create Subscription, there are only one event you should listen to: checkout.session.completed. And then to monitor Subscriptions you can listen to invoice.paid and invoice.payment_failed. That's it. Everything else you can ignore.
I'm using pricing table
It's the same, you should listen to checkout.session.completed and ignore almost everything else.
First thing is I will insert a breakpoint in Webhook evnent API method and In command prompt i will run stripe.exe , stripe login and stripe listen --forward-to https://localhost:7150/api/Stripe/WebhookEvent these commands. Then If i will subscribe it hit the breakpoint and the event customer.subscription.created is trigger, or if i will cancel subscription it will hit the breakpoint and the event customer.subscription.deleted is trigger, or if i will upgrade or downgrade plan it will hit the breakpoint and the event customer.subscription.updated is trigger like that when the payment is failed it will hit the breakpoint but the event invoice.payment_failed is not trigger
Can you clarify: what are you trying to do, and what's the issue exactly?
I'm testing in local the events are correctly trigger or not
When i try to subscribe customer.subscription.created event is trigger, when i try to cancel customer.subscription.deleted event is trigger, but when the card detail is wrong then invoice.payment_failed event is not trigger
How will i test in local for payment failed and for this event invoice.payment_failed?
I just tried using this test card 4000000000000341 in a Chekcout Session, and I do get a invoice.payment_failed event.
But again you shouldn't listen to that event in this case. The Checkout Session will take care of telling the user to try a new card. There's nothing to do on your end.
No i need to send mail when the payment is failed so only I'm asking to you When invoice.payment_failed this event is triggered the Email will go to customer automatically
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
ok
Sorry I don't follow. Do you want to send the email youself or do you want Stripe to take care of it automatically?
No when the payment is failed i need to send email to my customers
Then you can listen to invoice.payment_failed event. As me colleague said, you can test it but using the 4000000000000341 test card: https://stripe.com/docs/testing#declined-payments
Yes I'm testing Email in my local
Is it working?
other events are correctly working only payment failed is not working
Can you explain me to how to test payment failed in local
What do you mean by "not working" exactly?
What steps are you following?
I have stripe_Exe file in my file manager then open the file path in command prompt and run these commands 1.stripe.exe 2. stripe login 3. stripe listen --forward-to https://localhost:7150/api/Stripe/WebhookEvent after run these commands I will insert breakpoint to Wenhooks API method and i will try to subscribe it will hit the breakpoint and i will check the event
Is this setup working for other events?
Yes
When i try to subscribe customer.subscription.created event is trigger, when i try to cancel customer.subscription.deleted event is trigger, but when the card detail is wrong then invoice.payment_failed event is not trigger
So the problem is not in the setup.
Could you please share the PaymentIntent/Subscription ID pi_xxx sub_xxx that you're making fail?
sub_1NuT7pLabf7E4J4FX3yJZwRG
The payment for this Subscription was successful.
Sorry When the subscription is completed then only id will store in our database
I thought you're trying to get the invoice.payment_failed event.
What steps are you following to trigger an invoice.payment_failed event?
Enter the declined card or insufficient amount card and click subscribe but it shows error in subscribe page and that same time it will hit the breakpoint in API but it will trigger the customer.subscription.created event
Have you tried this? Does this work? Why is the Subscription crated successfully then?
I don't know that why I'm asking you
Could you please share a screen recording of your process, as I am not following.
You can also use stripe trigger invoice.payment_failed to create a fake event: https://stripe.com/docs/cli/trigger
Sorry, I only see one window in this recording.
sorry i will resend
Hey! Taking over for my colleague. Let me catch up.
Did you see this video?
When i try to subscribe customer.subscription.created event is trigger, when i try to cancel customer.subscription.deleted event is trigger, but when the card detail is wrong then invoice.payment_failed event is not trigger
Can you share the Subscipriton Id ?
No when the subscription is completed then only subscription I'd will generate
but when the card detail is wrong
Then the failure you are seeing, is a client side validation maybe
what card tests are you using ?
I can't complete the subscription. I'm testing payment failed or trying to trigger invoice.payment.failed
What is the test card you are using?
4000000000000341
I don't understand this part
What guide are you following for building a subscription integration with Stripe ?
You should be following this guide:
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
I'm testing in my local to send separate emails for seperate events of webhook
I will record what should i do to testing
I will send that videos please see that
Let's focus on building the integration first correctly
No we don't need a video for now.
Could you please describe enumerate the API calls you are doing ?
and what event you want to consume ?
InvoicePaymentFailed
try this in your terminal:
stripe trigger invoice.payment_failed
I need to test to send mail by trigger this event when subscribe payment failed
credit card
You are using Stripe Element or Checkout ?
graduation pricing table
Try this card: 4000000000000002
Ah I see what you want to do
invoice.payment_failed is generated for a recurring payment
and not the first time
You need to create a Subscription first time with a valid payment
and test clock
After the first attempt
you update the Subscirption's default payment method with this payment pm_card_visa_chargeDeclined
and then advice time to the next period
If im trying to paying with wrong card on second time then it will trigger invoice.payment failed, am i right?
yes
"customer.subscription.pending_update_expired" I get this event when change plan using 4000000000000341 this card
Can you explain about this event?
can you share that eventId ?
customer.subscription.pending_update_expired
I meant the eventId evt_1234
"evt_1NyCHXLabf7E4J4FbTpsD7Tg"
That event is triggered when a customer’s subscription’s pending update expires before the related invoice is paid
https://stripe.com/docs/api/events/types#event_types-customer.subscription.pending_update_expired
here is the event you are looking for evt_1NyCHYLabf7E4J4FEyCwDmnW