Skip to content

Commit

Permalink
Merge pull request #1965 from stripe/cjavilla/add-pause-collection
Browse files Browse the repository at this point in the history
Add support for `PauseCollection` on `Subscription`
  • Loading branch information
remi-stripe authored Mar 24, 2020
2 parents 0b412c7 + 6123e0c commit 2d13cf4
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Stripe.net/Entities/Subscriptions/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ public Invoice LatestInvoice
[JsonProperty("next_pending_invoice_item_invoice")]
public long? NextPendingInvoiceItemInvoice { get; set; }

/// <summary>
/// If specified, payment collection for this subscription will be paused.
/// </summary>
[JsonProperty("pause_collection")]
public SubscriptionPauseCollection PauseCollection { get; set; }

/// <summary>
/// Specifies an interval for how often to bill for any pending invoice items. It is
/// analogous to creating an invoice for the given subscription at the specified interval.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Stripe
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class SubscriptionPauseCollection : StripeEntity<SubscriptionPauseCollection>
{
/// <summary>
/// The payment collection behavior for this subscription while paused.
/// One of <c>keep_as_draft</c>, <c>mark_uncollectible</c>, or <c>void</c>.
/// </summary>
[JsonProperty("behavior")]
public string Behavior { get; set; }

/// <summary>
/// The time after which the subscription will resume collecting payments.
/// </summary>
[JsonProperty("resumes_at")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime? ResumesAt { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Stripe
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class SubscriptionPauseCollectionOptions : INestedOptions
{
/// <summary>
/// The payment collection behavior for this subscription while paused.
/// One of <c>keep_as_draft</c>, <c>mark_uncollectible</c>, or <c>void</c>.
/// </summary>
[JsonProperty("behavior")]
public string Behavior { get; set; }

/// <summary>
/// The time after which the subscription will resume collecting payments.
/// </summary>
[JsonProperty("resumes_at")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime? ResumesAt { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ public class SubscriptionUpdateOptions : BaseOptions, IHasMetadata
[JsonProperty("off_session")]
public bool? OffSession { get; set; }

/// <summary>
/// If specified, payment collection for this subscription will be paused.
/// </summary>
[JsonProperty("pause_collection")]
public SubscriptionPauseCollectionOptions PauseCollection { get; set; }

/// <summary>
/// <para>
/// Use <c>allow_incomplete</c> to create subscriptions with <c>status=incomplete</c> if its
Expand Down

0 comments on commit 2d13cf4

Please sign in to comment.