update_subscription | R Documentation |
Updates the subscription with the provided ID. Enables changing plans, applying discounts, prorating, and updating trial end dates.
update_subscription(
subscription_id,
plan = NULL,
cancel_at_period_end = NULL,
coupon = NULL,
prorate = NULL,
proration_date = NULL,
source = NULL,
application_fee_percent = NULL,
metadata = list(),
tax_percent = NULL,
trial_end = NULL
)
subscription_id |
Identifier of subscription to be updated |
plan |
The identifier of the plan to update the subscription to. If omitted, the subscription will not change plans |
coupon |
The code of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that particular subscription |
prorate |
Flag determining whether to prorate switching plans during a billing cycle |
proration_date |
If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with upcoming invoice endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations. |
trial_end |
Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end will override the default trial period of the plan the customer is being subscribed to |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.