C# Class SaasEcom.Core.Infrastructure.PaymentProcessor.Stripe.SubscriptionProvider

Implementation for subscription management with Stripe
Inheritance: ISubscriptionProvider
Exibir arquivo Open project: pedropaf/saas-ecom

Public Methods

Method Description
EndSubscription ( string userStripeId, string subStripeId, bool cancelAtPeriodEnd = false ) : System.DateTime

Ends the subscription.

SubscribeUser ( SaasEcom.Core.Models.SaasEcomUser user, string planId, System.DateTime trialEnds, decimal taxPercent ) : string

Subscribes the user.

SubscribeUser ( SaasEcom.Core.Models.SaasEcomUser user, string planId, int trialInDays, decimal taxPercent ) : string

Subscribes the user.

SubscribeUserNaturalMonth ( SaasEcom.Core.Models.SaasEcomUser user, string planId, System.DateTime billingAnchorCycle, decimal taxPercent ) : object

Subscribes the user natural month.

SubscriptionProvider ( string apiKey ) : System

Initializes a new instance of the SubscriptionProvider class.

UpdateSubscription ( string customerId, string subStripeId, string newPlanId, bool proRate ) : bool

Updates the subscription. (Change subscription plan)

UpdateSubscriptionTax ( string customerId, string subStripeId, decimal taxPercent ) : bool

Updates the subscription tax.

UserSubscriptionsAsync ( string userId ) : Task>

Gets the User's subscriptions asynchronous.

Method Details

EndSubscription() public method

Ends the subscription.
public EndSubscription ( string userStripeId, string subStripeId, bool cancelAtPeriodEnd = false ) : System.DateTime
userStripeId string The user stripe identifier.
subStripeId string The sub stripe identifier.
cancelAtPeriodEnd bool if set to true [cancel at period end].
return System.DateTime

SubscribeUser() public method

Subscribes the user.
public SubscribeUser ( SaasEcom.Core.Models.SaasEcomUser user, string planId, System.DateTime trialEnds, decimal taxPercent ) : string
user SaasEcom.Core.Models.SaasEcomUser The user.
planId string The plan identifier.
trialEnds System.DateTime The trial ends.
taxPercent decimal The tax percent.
return string

SubscribeUser() public method

Subscribes the user.
public SubscribeUser ( SaasEcom.Core.Models.SaasEcomUser user, string planId, int trialInDays, decimal taxPercent ) : string
user SaasEcom.Core.Models.SaasEcomUser The user.
planId string The plan identifier.
trialInDays int The trial in days.
taxPercent decimal The tax percent.
return string

SubscribeUserNaturalMonth() public method

Subscribes the user natural month.
public SubscribeUserNaturalMonth ( SaasEcom.Core.Models.SaasEcomUser user, string planId, System.DateTime billingAnchorCycle, decimal taxPercent ) : object
user SaasEcom.Core.Models.SaasEcomUser The user.
planId string The plan identifier.
billingAnchorCycle System.DateTime The billing anchor cycle.
taxPercent decimal The tax percent.
return object

SubscriptionProvider() public method

Initializes a new instance of the SubscriptionProvider class.
public SubscriptionProvider ( string apiKey ) : System
apiKey string The API key.
return System

UpdateSubscription() public method

Updates the subscription. (Change subscription plan)
public UpdateSubscription ( string customerId, string subStripeId, string newPlanId, bool proRate ) : bool
customerId string The customer identifier.
subStripeId string The sub stripe identifier.
newPlanId string The new plan identifier.
proRate bool if set to true [pro rate].
return bool

UpdateSubscriptionTax() public method

Updates the subscription tax.
public UpdateSubscriptionTax ( string customerId, string subStripeId, decimal taxPercent ) : bool
customerId string The customer identifier.
subStripeId string The sub stripe identifier.
taxPercent decimal The tax percent.
return bool

UserSubscriptionsAsync() public method

Gets the User's subscriptions asynchronous.
public UserSubscriptionsAsync ( string userId ) : Task>
userId string The user identifier.
return Task>