#omri-subscriptionschedules
1 messages · Page 1 of 1 (latest)
hello! you need to separate it into two requests. You can't update the phases at the same time you create a SubscriptionSchedule from an existing Subscription.
- create a SubscriptionSchedule from an existing Subscription
- Update the newly created SubscriptionSchedule
thank you
I getting the error : You cannot migrate a subscription that is currently in the `incomplete` status. It must be in `active, past_due, unpaid, trialing` status to be released
how can I fix it?
you need to at least ensure the first invoice is paid
yep, you should use webhooks to listen for changes to your Subscriptions
which webhook event should I use?
have you implemented the relevant code to collect the PaymentMethod and pay the first payment for the Subscription yet?
I create subscription like that:subscription = Stripe::Subscription.create({ customer: @customer.id, items: [{ price: price.id, }], payment_behavior: 'default_incomplete', payment_settings: {save_default_payment_method: 'on_subscription'}, expand: ['latest_invoice.payment_intent'] }, stripe_account: entity.stripe_uid)
alright, after payment is completed, you should receive an invoice.paid event. You can refer to billing_reason=subscription_create [0] and subscription [1] to know if it's the first payment for a subscription and for which subscription
[0] https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
[1] https://stripe.com/docs/api/invoices/object#invoice_object-subscription
and then create a Subscription Schedule from that Subscription
ok, thank you..
but if the payment failed? how can I popup message to the user immediately?
when you attempt to confirmPayment, an error message will be returned and you can build your own pop up : https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#complete-payment. You can use test cards listed here : https://stripe.com/docs/testing
from the subscription object, how I know which invoice number is it?
Hi! I'm taking over this thread.
Hey
What do you mean by invoice number exactly? Are you looking for this property? https://stripe.com/docs/api/invoices/object#invoice_object-number
I mean how match invoice paid has to a certain subscription
When you get the invoice.paid event, in the payload you will have an invoice object. And the invoice will have a subscription property: https://stripe.com/docs/api/invoices/object#invoice_object-subscription
So for each invoice you can know the corresponding subscription.
subscription property is the subscription_id string, I know
but how I know how match invoice.paid has to this subscription after I retrieve the subscription?
sorry
I mean to word much
how much invoice.paid?
I'm sorry I'm not sure I understand. What exactly are you trying to do?
English is not my native language
You have a subscription ID, and you want to know how much the customer paid for the last invoice?
So you have a subscription ID, and want to know how many time the customer paid?
In that case you could use this https://stripe.com/docs/api/invoices/list to list all invoice of a specific subscription.
if invoice.billing_reason=subscription_create it is mean it is the first invoice of that subscription?
That's correct!
cool thank you
how can I create SubscriptionSchedule with quarterly or annually payment?
what have you tried?
not related to the previous issue we has before.
I need have option to create subscription with 3 differences interval payments, monthly, quarterly, annually
there is a rich API for describing phases with various start and end dates and 'interations' to repeat a certain phase for a certain number of months. I don't know what a "quarterly or annually payment" means exactly but you can almost certainly do it, just experiment with some code and the API.
in Stripe the intervals for payments are daily weekly and monthly and yearly
so if you want something else like 'quarterly' you need to do more manual work like using trial periods to skip from one month to the end of a quarter or something
maybe is that - > https://stripe.com/docs/products-prices/pricing-models#multiple-prices ?
how can I fix that: The subscription schedule update is missing at least one phase with a `start_date` to anchor end dates to ?
yes, you could have one product with multiple prices with different intervals
you'd start by giving me more information like the request ID req_xxx , like we ask you for every time you ask questions here so you should be expecting
will look later, it's busy right now
as it says, you need a start_date
a good option is to try setting it to to the current_period_start value of the subscription you created the schedule from.
thank you
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!