Search code examples
.netcachingstripe-paymentsstripe-customer-portal

Can I cache the portal configuration object for multiple customers?


The Stripe documentation here describes how to create a Customer Portal Configuration.

This is what the example code looks like:

StripeConfiguration.ApiKey = "....";

var options = new ConfigurationCreateOptions
{
    BusinessProfile = new ConfigurationBusinessProfileOptions
    {
        Headline = "Cactus Practice partners with Stripe for simplified billing.",
    },
    Features = new ConfigurationFeaturesOptions
    {
        InvoiceHistory = new ConfigurationFeaturesInvoiceHistoryOptions
        {
            Enabled = true,
        },
    },
};
var service = new ConfigurationService();
await service.CreateAsync(options);

I'd rather not hit the Stripe API to create a new Configuration every time I want to generate a Customer Portal Session for my customers.

So my question is, can I cache the configuration server-side and use the same Customer Portal Configuration for all customers?

Or is there some kind of expiry or limitation on the configuration?


Solution

  • Stripe support confirmed that Customer Portal Configuration does not expire, and therefore we can use store the CustomerPortal.Configuration.ID and use it for multiple customers.