javascript - How to PreventManage Stripe Webhook Sending Invoice for $0 on Trial Signup? - Stack Overflow

I'm working on an app that es with a 14 day trial for free. To handle payments, I'm using Str

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
Add a ment  | 

2 Answers 2

Reset to default 4

A 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 a status of trialing.
  • 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信