pub struct SubscriptionUpdate<'a> { /* private fields */ }
Expand description
Request builder for updating a subscription using its ID.
When making changes to items or the next billing date for a subscription, you must include the proration_billing_mode
field to tell Paddle how to bill for those changes.
Send the complete list of items that you’d like to be on a subscription — including existing items. If you omit items, they’re removed from the subscription.
For each item, send price_id
and quantity
. Paddle responds with the full price object for each price. If you’re updating an existing item, you can omit the quantity
if you don’t want to update it.
If successful, your response includes a copy of the updated subscription entity. When an update results in an immediate charge, responses may take longer than usual while a payment attempt is processed.
Implementations§
Source§impl<'a> SubscriptionUpdate<'a>
impl<'a> SubscriptionUpdate<'a>
pub fn new( client: &'a Paddle, subscription_id: impl Into<SubscriptionID>, ) -> Self
Sourcepub fn customer_id(&mut self, customer_id: impl Into<CustomerID>) -> &mut Self
pub fn customer_id(&mut self, customer_id: impl Into<CustomerID>) -> &mut Self
The customer ID to use for the preview. Include to change the customer for a subscription.
Sourcepub fn address_id(&mut self, address_id: impl Into<AddressID>) -> &mut Self
pub fn address_id(&mut self, address_id: impl Into<AddressID>) -> &mut Self
The address ID to use for the preview. Include to change the address for a subscription.
Sourcepub fn business_id(&mut self, business_id: impl Into<BusinessID>) -> &mut Self
pub fn business_id(&mut self, business_id: impl Into<BusinessID>) -> &mut Self
The business ID to use for the preview. Include to change the business for a subscription.
Sourcepub fn currency_code(&mut self, currency_code: CurrencyCode) -> &mut Self
pub fn currency_code(&mut self, currency_code: CurrencyCode) -> &mut Self
Supported currency code. Include to change the currency that a subscription bills in.
When changing collection_mode
to manual
, you may need to change currency code to USD
, EUR
, or GBP
.
Sourcepub fn next_billed_at(&mut self, next_billed_at: DateTime<Utc>) -> &mut Self
pub fn next_billed_at(&mut self, next_billed_at: DateTime<Utc>) -> &mut Self
Datetime of when this subscription is next scheduled to be billed. Include to change the next billing date.
Sourcepub fn set_discount(
&mut self,
discount: Option<SubscriptionDiscountEffectiveFrom>,
) -> &mut Self
pub fn set_discount( &mut self, discount: Option<SubscriptionDiscountEffectiveFrom>, ) -> &mut Self
Details of the discount applied to this subscription. Include to add a discount to a subscription. None to remove a discount.
Sourcepub fn collection_mode(&mut self, mode: CollectionMode) -> &mut Self
pub fn collection_mode(&mut self, mode: CollectionMode) -> &mut Self
How payment is collected for transactions created for this subscription. automatic
for checkout, manual
for invoices.
Sourcepub fn billing_details(
&mut self,
billing_details: Option<BillingDetails>,
) -> &mut Self
pub fn billing_details( &mut self, billing_details: Option<BillingDetails>, ) -> &mut Self
Details for invoicing. Required if collection_mode
is manual
. None
if changing collection_mode
to automatic
.
Sourcepub fn unset_scheduled_change(&mut self) -> &mut Self
pub fn unset_scheduled_change(&mut self) -> &mut Self
Change that’s scheduled to be applied to a subscription.
When updating, you may only set to null
to remove a scheduled change.
Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes.
Sourcepub fn items(
&mut self,
items: impl IntoIterator<Item = TransactionItem>,
) -> &mut Self
pub fn items( &mut self, items: impl IntoIterator<Item = TransactionItem>, ) -> &mut Self
List of items on this subscription. Only recurring items may be added. Send the complete list of items that should be on this subscription, including existing items to retain.
Sourcepub fn custom_data(&mut self, custom_data: Value) -> &mut Self
pub fn custom_data(&mut self, custom_data: Value) -> &mut Self
Your own structured key-value data.
Sourcepub fn proration_billing_mode(
&mut self,
mode: ProrationBillingMode,
) -> &mut Self
pub fn proration_billing_mode( &mut self, mode: ProrationBillingMode, ) -> &mut Self
How Paddle should handle proration calculation for changes made to a subscription or its items. Required when making changes that impact billing.
For automatically-collected subscriptions, responses may take longer than usual if a proration billing mode that collects for payment immediately is used.
Sourcepub fn on_payment_failure(
&mut self,
mode: SubscriptionOnPaymentFailure,
) -> &mut Self
pub fn on_payment_failure( &mut self, mode: SubscriptionOnPaymentFailure, ) -> &mut Self
How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to prevent_change
.
Sourcepub async fn send(&self) -> Result<SuccessResponse<Subscription>, Error>
pub async fn send(&self) -> Result<SuccessResponse<Subscription>, Error>
Send the request to Paddle and return the response.