From 15d08e31b5e51f6f00985cf293a06bc2803588a8 Mon Sep 17 00:00:00 2001 From: Nick Ryan Date: Sat, 15 Jul 2023 12:35:21 -0400 Subject: [PATCH] Fix cancel subscription fields Corrected fields for current Stripe API version. - replaced `at_period_end` with `invoice_now` - added `cancellation_details` field - added `prorate` field https://stripe.com/docs/api/subscriptions/cancel --- src/resources/subscription_ext.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/resources/subscription_ext.rs b/src/resources/subscription_ext.rs index ee0955853..0f5acd15e 100644 --- a/src/resources/subscription_ext.rs +++ b/src/resources/subscription_ext.rs @@ -1,5 +1,6 @@ use serde::Serialize; +use crate::CancellationDetails; use crate::client::{Client, Response}; use crate::ids::SubscriptionId; use crate::resources::{CreateSubscriptionItems, Subscription}; @@ -7,12 +8,16 @@ use crate::resources::{CreateSubscriptionItems, Subscription}; #[derive(Clone, Debug, Default, Serialize)] pub struct CancelSubscription { #[serde(skip_serializing_if = "Option::is_none")] - pub at_period_end: Option, + pub cancellation_details: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub invoice_now: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub prorate: Option, } impl CancelSubscription { pub fn new() -> CancelSubscription { - CancelSubscription { at_period_end: None } + CancelSubscription { cancellation_details: None, invoice_now: None, prorate: None } } }