#prince996 - subscription trial
1 messages ยท Page 1 of 1 (latest)
๐ Thanks for reaching out
I recommend you to take a look at schedules with subscriptions:
https://stripe.com/docs/billing/subscriptions/subscription-schedules#using-trials
sure let me check, thanks
hey i have checked the link, so basically you are suggesting to schedule a subscription with current phase with current subscription and second phase with the new subscription. right?
You need to create a schedule from the current subscription and add a second phase with the new plan/items
https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-from_subscription
like this. right? i have used this in my other scenario
could you please confirm once?
Yes something like, and if you need to specify trial period you can specify that to each phase:
https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-phases-trial
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay i will check and also i have one query, can i remove or cancel scheduled subscriptions?
You can find here a list of common use cases of the schedule subscription
https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases
This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
yeah sure, sorry, but it was a while since the thread was active
let me know if you need any more help
I am changing the code structure from this to new way below:
List<Object> phases = new ArrayList<>();
Map<String, Object> item1 = new HashMap<>();
item1.put("price", price.getId());
item1.put("quantity", 1);
Map<String, Object> item2 = new HashMap<>();
item1.put("price", subscriptionPlan.getStripePriceId());
item1.put("quantity", 1);
Map<String, Object> phase1 = new HashMap<>();
phase1.put("trial_end", startingDateSeconds);
phase1.put("items", item1);
phases.add(phase1);
Map<String, Object> phase2 = new HashMap<>();
phase1.put("items", item2);
phases.add(phase2);
Map<String, Object> params = new HashMap<>();
params.put("customer", subscription.getCustomer());
params.put("end_behavior", "release");
params.put("phases", phases);
SubscriptionSchedule.create(params);
but there is no start_date for the phase to start like we have the startDate for individual phases to start. could you please help me to understand the structure of this?
you mean the start date of the schedule?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes
I really suggest not using Maps but instead using the different builders we provide in our SDK. It would be easier to build your objects
actually because of code duplicacy i am trying to swicth from builder to maps. but i am confused with the process
so what would you suggest should i use builders always?
?
Hi there ๐ I'm jumping in as my teammate needed to step away. Please bear with me a moment while I catch up on the context here.
I'm not sure if we have a recommendation one way or the other here.
let me give a example suppose in some case i just have to give trial date params for trialing period subscription or in other startDate or endDate param for active subscriptions, so just for these params i have to write the whole builder code for these. that's why i am asking for suggestion which is best for this?
Either approach works, so I would recommend using whichever better fits what you want.
Sorry, I feel like I might not be understanding your question.
I'm archiving this thread, but if there are additional questions or anything else that we can assist with, then please let us know in #dev-help. ๐
cc @feral grove
thanks
so as i discussed yesterday on my query. so now i need to discuss more on this.
I have a requirement, suppose user has a yearly subscription with yearly trial period and user cancel the subscription in their trial period. so basically it will cancel the subscription but user is valid for the trail period right. so suppose then he again renew their subscription with the same package or may be with another package. so this will start after the period of current trial period. right?
so first i need to know how can i achieve this?
I am catching up on yesterday chat but it doesn't seem very clear to me. My first thought on your newest question is, I don't think after you cancel a Subscription "user is valid for the trial". Do you see such a behavior in a specific Subscription?
You may be looking for Pause and Unpause a Subscription (https://stripe.com/docs/billing/subscriptions/pause)
i didn't understand how pausing payment collection will work on my scenario. could you please tell me your thoughts on this?
my requirement is simple, if user cancels the current subscription then i will cancel it, but user is still valid for current period(maybe user is in trial period or active period) if available.
so after canceling he again thought of renewing the subscription and then he again choose the new subscription plan or same current plan. then it will be in active phase when the current period is over.
And may be he will do these actions(cancel or renew) again and again or number of times but my basic functionality is just that whatever he chooses it will be active when the current period is over.
Note: renew criteria is just that if he do cancel and renew number of times then i will detach the last renewed plan and then attach the new plan he selected. but the current existing plan period will work normally if there is days left.
What you describe doesn't sound like something we offer today. In our API concept once you "cancel" a Subscription, everything about it stops immediately. Workarounds I can think of are:
- Instead of cancelling, utilize pause/unpause to keep the Subscription on page without charging customer. Whenever they renewed you can unpause the Sub and update the new Plan accordingly
- Use the parameter
https://stripe.com/docs/api/subscriptions/update#update_subscription-cancel_at_period_endIt won't cancel the Sub immediately but scheduled to cancel at the period end. When they renewed you can simply Update the Sub again and unset this parameter - Subscription Schedule could be helpful. It's a bit of complicated API but it allow you to schedule change/cancel like 2. does
Hi, I am archiving this thread again. If you are back and have questions, feel free to ask to reopen