I'm working on an app that es with a 14 day trial for free.
To handle payments, I'm using Stripe and listening for webhooks so I can perform functions on the backend when events happen.
One thing I've noticed, though, is that Stripe is sending me invoice data with an amount charged of $0 for the trial period. So, if a customer signs up, they get an invoice from Stripe for $0 (I have my webhook setup to fire off an email for each invoice I receive).
This isn't terrible, but from a UX perspective, I'd like to avoid the shock of getting an immediate invoice when someone is expecting a trial (even if that invoice is for $0).
I've considered just checking the data Stripe sends over and filtering out $0 invoices, but if I offer a discount or something, this doesn't seem like the best way.
Any thoughts/notes on how to implement this better?
I'm working on an app that es with a 14 day trial for free.
To handle payments, I'm using Stripe and listening for webhooks so I can perform functions on the backend when events happen.
One thing I've noticed, though, is that Stripe is sending me invoice data with an amount charged of $0 for the trial period. So, if a customer signs up, they get an invoice from Stripe for $0 (I have my webhook setup to fire off an email for each invoice I receive).
This isn't terrible, but from a UX perspective, I'd like to avoid the shock of getting an immediate invoice when someone is expecting a trial (even if that invoice is for $0).
I've considered just checking the data Stripe sends over and filtering out $0 invoices, but if I offer a discount or something, this doesn't seem like the best way.
Any thoughts/notes on how to implement this better?
Share Improve this question edited Oct 3, 2013 at 18:19 Tarang 76k39 gold badges219 silver badges279 bronze badges asked Oct 3, 2013 at 14:15 Ryan GloverRyan Glover 931 silver badge3 bronze badges 1- 1 Have you tried Stripe support? They are phenomenal and would surely be able to assist. They've helped me so many times I've lost count, sometimes over the most ridiculous queries. Give them a shot. – landland Commented Oct 4, 2013 at 22:38
2 Answers
Reset to default 4A couple options here:
When you create the customer/subscription, the API returns both the customer and the subscription data to you in its response. You can use data from either or both of these to filter intelligently. Of particular interest:
current_period_start
: This will also be the timestamp of the invoice.trial_end
: Until this timestamp, any invoice including a subscription is for a trial.customer
: If you don't like the others, you can always query the customer record when processing a $0 invoice. Customers in their trial period have astatus
oftrialing
.
If you're sending the email on
invoice.created
events, only the initial subscription invoice is created as closed. All other subscription invoices are open when Stripe creates them. (This is so you can make adjustments before the invoice is processed.) An invoice that's both $0 and closed has a high probability of being a trial—100%, in fact, if you're not otherwise creating already-closed invoices.
Try to listen for charges events. The event charge.succeeded
Only fired when user has ben charge successfully.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742284141a4415023.html
评论列表(0条)