#ruif90-upcoming-invoice
1 messages ยท Page 1 of 1 (latest)
subscriptions
but I don't have yet this new subscritpion, I have one, and I want to change my subscription plan, and I want a preview of what I'm going to pay if I change and what discount I will have
Gotcha, so the fields you're going to want to focus on are:
subscription - pass it the current subscription's ID
subscription_items - pass it an array of subscription items containing the new plan/price
subscription_proration_behavior - set this based on the proration behavior that you'd like
discounts if you want to pass additional/alter the discounts that will be applied
subscription_proration_date is also worth considering if you will be using prorations
subscription_items -> can I just pass the price Id as the id, or do I need anything else? Will it consider the tax rates, or do I also need to pass them?
For subscription_items.id you'll want to provide the ID of the existing subscription item, this indicates to the system that it should compare the information currently available for that subscription item with any differing information that you passed in (such as a different price).
For the tax rates, it's going to depend on what you pass into subscription_default_tax_rates and subscription_items.tax_rates.
It might be easier if you retrieve the current subscription and put it in a local variable. Then you could alter just the pieces you want to change, such as price or discount, and then use that variable to push the pieces you need into upcoming invoice request.
plan or price are strings, are those keys that are being expected?
//
// Summary:
// Plan ID for this item, as a string.
[JsonProperty("plan")]
public string Plan { get; set; }
//
// Summary:
// The ID of the price object.
[JsonProperty("price")]
public string Price { get; set; }
ye ๐ forget i'm dumb
is this values also possible to be fetched? which properties are those?