#fdc8cd4cff2c19e0d1022e78481ddf36
1 messages · Page 1 of 1 (latest)
Which webhook can I expect after the trial is over, if the payment doesnt come?
invoice.payment_failedfor the payment on the Invoice that's created at the start of the next period. Alsocustomer.subscription.updated.
- Which webhook can I expect if payment (1) would be succesful and it would fail the next month?
invoice.payment_failedon the Invoice at the start of the relevant month
Is it safe to rely on "customer.subscription.updated" and update the subscription status based on incoming data? IE past_due, active etc?
yes; that's what we document at https://stripe.com/docs/billing/subscriptions/webhooks#state-changes .
So if payment fails, user can try the payment again. When Stripe changes the status of the subscription to ie past_due, I will just reflect it in my application.
Is there any way I can simulate that the first payment went through and the second one (with saved payment method) did not?
ie some card with balance?
you can use the card 4000000000000341 https://stripe.com/docs/testing#declined-payments
oh yeah I forgot you were doing an initial payment, confused you with a different thread
you want to use 4242424242424242 for the first payment, and then later replace the customer's saved card with 4000000000000341 (you could do it in the Dashboard easily enough I think) before the next billing period or before advancing your TestClock
How can I simulate the event after 1 month with TestClock?
I have created a clock with 1 month in advance and I would like to apply such clock to the subscription I just created
Or I need to create a customer within such clock, do a checkout session for him, create a subscription and change the date?
you can't apply it to an existing subscription, it has to apply from the start https://stripe.com/docs/billing/testing/test-clocks?dashboard-or-api=api#setup-simulation
something like that yes
I would need to create such customer under a connected account tho
if you're using Connect with Direct Charges, then yes
same with the TestClock too, that would have to be created on the connected account
Maybe it will work the same way either its on the connected account or its on the main platform account?
I don't think it would no.
if you try to pass a test_clock object that you create on the platform, to a Customer on a connected account, you'd get a "No such test_clock" error
if you're using Connect with Direct Charges then all involved objects (Customer/CheckoutSession/TestClock etc) have to be created on the connected account, via the Stripe-Account header
All I am trying to achieve right now is to see if the payment fails if Stripe will update the subscription immediately to past due (if the first payment went through)
Seems like customer.subscription.updated arrived and the subscription is marked as past_due, therefore such behavior can be expected in the live mode aswell?
yes
However it seems like I did not receive any webhooks from the test clocks to my application, not sure if this is desired behavior?
I could only see such events in the subscription detail in the test clock tab
if you're using Connect you need to have Connect webhook endpoints so you recieve events on a connected account
(you can use https://stripe.com/docs/api/test_clocks/list with the Stripe-Account header)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.