#Suren-subscriptions
1 messages · Page 1 of 1 (latest)
sub_1Jydx7BfTh1Z0SMkM6EJ8twL
the problem is that only after an hour does past_due become
Most invoices generated for a subscription have a one hour period before finalization where changes can be made.
This behavior applies to all invoices except for the first invoice generated for a subscription where collection_method: charge_automatically.
For charge_automatically, the invoice only becomes past_due when payment is attempted and fails.
If you want the invoice to be paid immediately, you can use the API to finalize [0] and pay [1] the invoice after you receive the invoice.created event
[0] https://stripe.com/docs/api/invoices/finalize
[1] https://stripe.com/docs/api/invoices/pay
are you referring to the first payment?
Well, my problem now is that after the end of the cycle, the status becomes active and I need to immediately send past_due instead
that is, I expect that the active status becomes after a successful payment
just want to understand if i set collection_method: 'charge_automatically' subscription status will not be active if no payment has been made
I just think that there is default to set this flag
as you've already noticed, there's probably going to be a short period of time that the subscription is still active when the invoice has been created, but not yet finalized. You can minimize this time by using the API to immediately finalize and attempt payment. If the attempted payment fails, the subscription will change to past_due - this behaviour is applicable for charge_automatically
there are two options for collection_method : charge_automatically and send_invoice. As send_invoice implies, it will send your customer an invoice for them to fill up their payment details. I don't think this is what you'd want since it's completely different from charging automatically
I understand so I can't achieve this result right?
I just don't want the stripe to send me the active status at all if there was no payment
because when the active status is sent to me, I think that the payment has been made
no, you can't achieve this result. But why would receiving this status update be an issue?
ideally, the system would see that the status is active, and do nothing, since the previous status was also active
the fact is that I confirm the payment through the subscription status
yes I thought so too
but in such a case how to check whether the payment was made or not
Stripe will determine if the payment is made or not and update the subscription status accordingly. It would be easier for you to turn on/off your service based off the subscription status. If you want to also store the payment in your DB, then you can listen for the invoice.paid webhook event instead
Will invoice.paid work after every subscription payment?
out of curiosity, are you determining whether you should stop providing the service based on whether the user has completed payment?
yes, only there if the payment is not made there I will post a retry
sorry i didn't understand only there if the payment is not made there I will post a retry, could you maybe try to rephrase?
I mean Payment retries
so i stuck to the view that i can listen to invoice.paid for love subscription
is there a reason why you're not using automatic payment retries? there is a setting in the Dashboard for this
and for update too?
what do you want to update?
i just want to understand invoice.paid will work for both subscription create and subscription update
yes invoice.paid will generate for both subscription create and subscription update
no, the invoice will not contain the subscription metadata
the invoice will contain the subscription id : https://stripe.com/docs/api/invoices/object#invoice_object-subscription
it will also contain the customer id : https://stripe.com/docs/api/invoices/object#invoice_object-customer
which means I have to send a request to get a subscription
that's one option, or you can also store whatever data you need in your own database to be retrieved based off the subscription id or customer id
so I listen to invoice.paid then I will find the subscription id there and for this id I can already get the metadata of this subscription
yes, if that's the way you want to handle it
I'm just looking at the subscription id there now
there is only a subscription without an id
can you share the object id which you're looking at?
that's an example, it's possible that an invoice is created without a subscription as well. If you want to check how the event would look like, i would suggest using the events generated on your own Dashboard instead
aaaa yes you are right thank you very much