#mink4501_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/1232576733023309875
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
- You should listen to
checkout.session.completedevent instead
- There is
amount_paidproperty on the Invoice object
- There is
discountsproperty on the Invoice object
-
You should listen to checkout.session.completed event instead
=> To recognize when a subscription is due for its next cycle and has been paid, you need to use the invoice.paid webhook. -
There is amount_paid property on the Invoice object
=> When I look at an invoice.paid event, I want to know if it was a discount or if the payment was made through a free trial. How can I check just one field to know if a discount or free trial occurred?
For example, if amount_due and amount_paid are not the same, then I know that the invoice.paid was generated via discount or free trial?
- Sorry do you mean each time the subscription renew? If yes then yes
invoice.paidis correct.
- You are talking about $0 Invoice, correct? Because free trial means $0 invoice. In that case you can simply look at
discountsand see if there is any discount applied. If no, it means free trial. If yes, it means it had some amount but was reduced to 0
-
Sorry do you mean each time the subscription renew? If yes then yes invoice.paid is correct.
=> When invoice.paid occurs, how do you know when the payment actually happened in Stripe? -
You are talking about $0 Invoice, correct? Because free trial means $0 invoice. In that case you can simply look at discounts and see if there is any discount applied. If no, it means free trial. If yes, it means it had some amount but was reduced to 0
=> How can I distinguish within the invoice.paid event whether the price is $0 or $0 due to a free trial?
- What do you mean by actually happenned? If the amount >0 then yes a Payment should happenned
- As I mentioned above, you can look at
discountsto see if any discount applied to this Invoice
If you apply a discount and also apply a free trial when performing a subscription, the discount is not actually applied and the free trial is applied first.
So, to summarize my question again.
Q. When invoice.paid occurs, how do I determine if the $0 is due to the free trial or if I originally set the price of the current product to $0?
Check the discounts and amount_paid If amount > 0 and there are discount applied, it's you discount the price to $0. If amount = 0 and no discounts, it's the trial