#krishna1433-subscription-error

1 messages · Page 1 of 1 (latest)

orchid dock
#

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?

pliant mantle
#

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);

#

Really sorry if this is all clumsy

orchid dock
#

Oh I am sorry, I misread the documentation. I see it now.

#

The phases themselves don't have a 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

pliant mantle
#

Oh makes sense now

#

Thank you much will try and let you know

pliant mantle
#

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

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?

pliant mantle
#

Yes

orchid dock
#

That would be the billing_cycle_anchor