stripe-payments Stripe.Net Introduction


  • var stripeSubscriptionOptions = new StripeSubscriptionCreateOptions();

    //create a variable to hold options object

            stripeSubscriptionOptions.Quantity = model.update;

    //example option of quantity of seats for a subscription

            var subscriptionService = new StripeSubscriptionService();

    //create a service to make the API call

            var stripeSubscription = subscriptionService.Create(user.CustomerIdentifier, planId,


    // service.create( string CustID, string PlanID, Object SubscriptionOptions)

    //Customer ID should be saved from your database, you can retrieve planID from stripe using a PlanService and create the options object like above. If you NuGet the Stripe.Net intellisense works for these as well.


Somewhere in the beginning of your controller you should call

StripeConfiguration.SetApiKey(YOUR SECRET KEY VAR);

and for data safety it should be a value hidden as a secret in appsettings

if you do not set the API key you will not be able to modify subscriptions or create customers