#wpgjetsfan13_api
1 messages · Page 1 of 1 (latest)
đź‘‹ Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1263939702726066259
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- wpg_test-expiredcard, 2 hours ago, 18 messages
Hello
We only send emails in test mode for very specific things
What are you trying to test here specifically?
I'm not testing anything specifically, my company just asked me to enable emails on test mode. So I see that only certain events are supposed to send emails in test mode
But even for those events, I do not receive emails
In test mode, Stripe doesn’t automatically send customer emails. To test your customer email settings, use email addresses that belong to your verified email domain or an active team member. If a test mode customer’s email matches either of those conditions, Stripe sends failed payment notifications, upcoming invoice reminders, trial ending reminders, and card expiring reminders in test mode.
This is what I'm following
But I don't receive any emails for failed invoice
I also tried refunds, which was listed in the section below on that page
Right but even in that scenario we only send test emails for certain things.
Okay do you have an example Invoice that you tested with for the failed payment reminder?
I guess they're a little confused because they're expecting that in production there will be emails sent, but they have no idea what to expect
Some emails will send in test mode but some won't. Some you can look at a preview in the Dashboard.
It really is a case-by-case basis
oh
This was the request: req_dFCJ2H4pBMyCGm
it was an invoice created by a subscription generated from the subscription API via a POST request
That is just a Subscription creation request -- not a payment failure?
Ah
I see the related Invoice does have a payment failure, okay one sec
However, I don't think this is the correct scenario for that email since this is a Card payment on the initial payment for the Subscription
These failed payment emails only send when your customer is off-session (when they aren't in your payment flow)
In this scenario there wouldn't be an email since it would be expected that you would show an error to your customer in your checkout flow
What you could do to test this though would be to use a test clock: https://docs.stripe.com/billing/testing/test-clocks
what does off-session actually mean? I'm not sure what you mean by that
Off session means your customer is not in your checkout flow.
it was not created via a checkout. We use setup checkout to add payment methods, then later they can reuse that method. I mean, we just manually attach the payment method id to the request
So imagine when a Subscription automatically renews after a month
Yes
Hmmm
Try creating your Subscription with off_session: true: https://docs.stripe.com/api/subscriptions/create#create_subscription-off_session
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
But the payment happens asynchronously
I'm not positive if we ever trigger this email on the first payment for a Sub
API doesn't throw an error for failed payment
so we rely on email to tell the user, we also track with webhooks in our system, so we can notify them
But I would be very surprised if we get to production mode and our customer doesn't receive an email when the invoice payment failed
Even if they are 'on-session'
because creating a subscription via the API with a pre-existing payment method, that can fail and the API doesn't give us an error, so how can we handle it ourselves?
I mean we can create our own notification system of course, but I just thought Stripe would handle that kind of email 🙂
One sec, let me test something
Okay yeah I just confirmed that we don't send these emails on creation -- only on renewal. I can file feedback internally about that as it does make sense to me that if you specify off_session: true when you create the Subscription then we would send the email on your behalf, but that isn't how it works right now.
Basically what you will need to do right now is expand the latest_invoice.payment_intent.latest_charge when you create the Subscription.
That will tell you the outcome of that initial payment attempt
See: https://docs.stripe.com/expand for expanding responses
Then if it fails on creation and you want to notify the customer, you will have to do that from your end.
I see. Thanks for the detailed explanation!
Ah I think I know the reasoning for this though... we don't send an email because on creation there is only a 23 hour window.
right, for incomplete/incomplete_expired
Before the Subscription moves to incomplete_expired
Whereas on renewal then the timing is indefinite (depending on your settings and how you want to handle things)
So yeah, doesn't make a ton of sense to send an email when the customer then only has a short amount of time to make the update...