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
IdstringSubscription identifier.
StateSubscriptionStateCurrent state of the subscription.
PricedecimalSubscription price in the specified currency.
CurrencystringCurrency code (e.g., "USD").
FrequencySubscriptionFrequencyBilling frequency (weekly, monthly, quarterly, yearly).
RatePlanRatePlanThe rate plan associated with this subscription.
CurrentPeriodStartDateTime?Start of the current billing period.
CurrentPeriodEndDateTime?End of the current billing period.
ComponentValuesIReadOnlyList<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
Currency
Currency code (e.g., "USD").
[JsonPropertyName("currency")]
public string Currency { get; init; }
Property Value
CurrentPeriodEnd
End of the current billing period.
[JsonPropertyName("current_period_end")]
public DateTime? CurrentPeriodEnd { get; init; }
Property Value
CurrentPeriodStart
Start of the current billing period.
[JsonPropertyName("current_period_start")]
public DateTime? CurrentPeriodStart { get; init; }
Property Value
Frequency
Billing frequency (weekly, monthly, quarterly, yearly).
[JsonPropertyName("frequency")]
public SubscriptionFrequency Frequency { get; init; }
Property Value
Id
Subscription identifier.
[JsonPropertyName("id")]
public string Id { get; init; }
Property Value
Price
Subscription price in the specified currency.
[JsonPropertyName("price")]
public decimal Price { get; init; }
Property Value
RatePlan
The rate plan associated with this subscription.
[JsonPropertyName("rate_plan")]
public RatePlan? RatePlan { get; init; }
Property Value
State
Current state of the subscription.
[JsonPropertyName("state")]
public SubscriptionState State { get; init; }