Struct SubscriptionUpdate

Source
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>

Source

pub fn new( client: &'a Paddle, subscription_id: impl Into<SubscriptionID>, ) -> Self

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn custom_data(&mut self, custom_data: Value) -> &mut Self

Your own structured key-value data.

Source

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.

Source

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.

Source

pub async fn send(&self) -> Result<SuccessResponse<Subscription>, Error>

Send the request to Paddle and return the response.

Auto Trait Implementations§

§

impl<'a> Freeze for SubscriptionUpdate<'a>

§

impl<'a> RefUnwindSafe for SubscriptionUpdate<'a>

§

impl<'a> Send for SubscriptionUpdate<'a>

§

impl<'a> Sync for SubscriptionUpdate<'a>

§

impl<'a> Unpin for SubscriptionUpdate<'a>

§

impl<'a> UnwindSafe for SubscriptionUpdate<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,