Table of Contents

Class Subscription

Namespace
Cloudflare.NET.Subscriptions.Models
Assembly
Cloudflare.NET.dll

Represents a subscription for Cloudflare services.

Subscriptions manage billing plans and add-ons at account, user, or zone level. Each subscription has a rate plan that defines the features included and their pricing.

public record Subscription : IEquatable<Subscription>
Inheritance
Subscription
Implements
Inherited Members

Examples

var subscriptions = await client.Subscriptions.ListAccountSubscriptionsAsync(accountId);
foreach (var sub in subscriptions)
{
  Console.WriteLine($"{sub.RatePlan?.PublicName}: {sub.Price} {sub.Currency}/{sub.Frequency}");
  Console.WriteLine($"  State: {sub.State}");
  Console.WriteLine($"  Period: {sub.CurrentPeriodStart} to {sub.CurrentPeriodEnd}");
}

Constructors

Subscription(string, SubscriptionState, decimal, string, SubscriptionFrequency, RatePlan?, DateTime?, DateTime?, IReadOnlyList<SubscriptionComponent>?)

Represents a subscription for Cloudflare services.

Subscriptions manage billing plans and add-ons at account, user, or zone level. Each subscription has a rate plan that defines the features included and their pricing.

public Subscription(string Id, SubscriptionState State, decimal Price, string Currency, SubscriptionFrequency Frequency, RatePlan? RatePlan = null, DateTime? CurrentPeriodStart = null, DateTime? CurrentPeriodEnd = null, IReadOnlyList<SubscriptionComponent>? ComponentValues = null)

Parameters

Id string

Subscription identifier.

State SubscriptionState

Current state of the subscription.

Price decimal

Subscription price in the specified currency.

Currency string

Currency code (e.g., "USD").

Frequency SubscriptionFrequency

Billing frequency (weekly, monthly, quarterly, yearly).

RatePlan RatePlan

The rate plan associated with this subscription.

CurrentPeriodStart DateTime?

Start of the current billing period.

CurrentPeriodEnd DateTime?

End of the current billing period.

ComponentValues IReadOnlyList<SubscriptionComponent>

Optional component values for configurable features.

Examples

var subscriptions = await client.Subscriptions.ListAccountSubscriptionsAsync(accountId);
foreach (var sub in subscriptions)
{
  Console.WriteLine($"{sub.RatePlan?.PublicName}: {sub.Price} {sub.Currency}/{sub.Frequency}");
  Console.WriteLine($"  State: {sub.State}");
  Console.WriteLine($"  Period: {sub.CurrentPeriodStart} to {sub.CurrentPeriodEnd}");
}

Properties

ComponentValues

Optional component values for configurable features.

[JsonPropertyName("component_values")]
public IReadOnlyList<SubscriptionComponent>? ComponentValues { get; init; }

Property Value

IReadOnlyList<SubscriptionComponent>

Currency

Currency code (e.g., "USD").

[JsonPropertyName("currency")]
public string Currency { get; init; }

Property Value

string

CurrentPeriodEnd

End of the current billing period.

[JsonPropertyName("current_period_end")]
public DateTime? CurrentPeriodEnd { get; init; }

Property Value

DateTime?

CurrentPeriodStart

Start of the current billing period.

[JsonPropertyName("current_period_start")]
public DateTime? CurrentPeriodStart { get; init; }

Property Value

DateTime?

Frequency

Billing frequency (weekly, monthly, quarterly, yearly).

[JsonPropertyName("frequency")]
public SubscriptionFrequency Frequency { get; init; }

Property Value

SubscriptionFrequency

Id

Subscription identifier.

[JsonPropertyName("id")]
public string Id { get; init; }

Property Value

string

Price

Subscription price in the specified currency.

[JsonPropertyName("price")]
public decimal Price { get; init; }

Property Value

decimal

RatePlan

The rate plan associated with this subscription.

[JsonPropertyName("rate_plan")]
public RatePlan? RatePlan { get; init; }

Property Value

RatePlan

State

Current state of the subscription.

[JsonPropertyName("state")]
public SubscriptionState State { get; init; }

Property Value

SubscriptionState