#krishna1433-subscription-error
1 messages · Page 1 of 1 (latest)
That is interesting. I am not immediately sure why you got that error on that call. Can you send me the snippet of your code where you call the function to create a subscription schedule?
public SubscriptionSchedule CreateSubscriptionSchedule(List<Price> priceList, Customer customer, List<SubscriptionSchedulePhaseOptions> subscriptionSchedulePhaseOptionsList)
{
var ss = JsonConvert.SerializeObject(subscriptionSchedulePhaseOptionsList);
var options = new SubscriptionScheduleCreateOptions
{
Customer = customer.Id,
StartDate = SubscriptionScheduleStartDate.Now,
EndBehavior = "release",
Phases = subscriptionSchedulePhaseOptionsList
};
var service = new SubscriptionScheduleService();
var schedule = service.Create(options);
return schedule;
}
This is how I'm creating subscription
I'm calling this from
List<SubscriptionSchedulePhaseOptions> subscriptionSchedulePhaseOptionsList = new List<SubscriptionSchedulePhaseOptions>();
List<SubscriptionSchedulePhaseItemOptions> subscriptionSchedulePhaseItemOptionsList = new List<SubscriptionSchedulePhaseItemOptions>(); SubscriptionSchedulePhaseOptions subscriptionSchedulePhaseOptions = new SubscriptionSchedulePhaseOptions { StartDate = JavaScriptTimeStampToDateTime(double.Parse(paymentViewModel.InvoiceDetails[i-1].InvoiceDueDate)), Items = subscriptionSchedulePhaseItemOptionsList, EndDate = JavaScriptTimeStampToDateTime(double.Parse(paymentViewModel.InvoiceDetails[i].InvoiceDueDate)) }; SubscriptionSchedulePhaseItemOptions subscriptionSchedulePhaseItemOptions = new SubscriptionSchedulePhaseItemOptions { Price = priceList[i].Id, Quantity = 1 }; subscriptionSchedulePhaseItemOptionsList.Add(subscriptionSchedulePhaseItemOptions); subscriptionSchedulePhaseOptionsList.Add(subscriptionSchedulePhaseOptions);
https://pastebin.com/2ERxpkYg this is input to subscriptionSchedulePhaseOptionsList
Really sorry if this is all clumsy
Oh I am sorry, I misread the documentation. I see it now.
The phases themselves don't have a start_date
The schedule has a start date, so the parameter for that goes one level up from where you have it https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-start_date
So the schedule has a start date and each phase has an end date to define when to move to the next one
Thank you it's working now, but I have another problem. How do i set a custom date as debit date for the schedule
Tagging you just in case you missed this. @orchid dock
Bouncing between a couple threads. I have seen this and will look in to it in a minute.
Just getting back to this. By debit date, you mean when the customer is charged again?
Yes
That would be the billing_cycle_anchor