#mink4501_api

1 messages ¡ Page 1 of 1 (latest)

wheat bobcatBOT
#

👋 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.

main sandBOT
silk sinew
#
  1. You should listen to checkout.session.completed event instead
#
  1. There is amount_paid property on the Invoice object
#
  1. There is discounts property on the Invoice object
inland stratus
#
  1. 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.

  2. 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?

silk sinew
#
  1. Sorry do you mean each time the subscription renew? If yes then yes invoice.paid is correct.
#
  1. 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
inland stratus
#
  1. 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?

  2. 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?

silk sinew
#
  1. What do you mean by actually happenned? If the amount >0 then yes a Payment should happenned
  2. As I mentioned above, you can look at discounts to see if any discount applied to this Invoice
inland stratus
#

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?

silk sinew
#

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