Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Billing Portal Configuration - Not serialising correctly (Update Products) #3057

Open
AshleyMedway opened this issue Mar 9, 2025 · 0 comments
Labels

Comments

@AshleyMedway
Copy link

AshleyMedway commented Mar 9, 2025

Describe the bug

When using BillingPortal.ConfigurationService the Feature SubscriptionUpdate is not sending the Products collection to the API

To Reproduce

var options = new ConfigurationCreateOptions
{
    Features = new ConfigurationFeaturesOptions
    {
        InvoiceHistory = new ConfigurationFeaturesInvoiceHistoryOptions { Enabled = true },
        PaymentMethodUpdate = new ConfigurationFeaturesPaymentMethodUpdateOptions { Enabled = true },
        SubscriptionCancel = new ConfigurationFeaturesSubscriptionCancelOptions
        {
            Enabled = true,
            Mode = "at_period_end",
            ProrationBehavior = "none",
            CancellationReason = new ConfigurationFeaturesSubscriptionCancelCancellationReasonOptions
            {
                Enabled = true,
                Options = ["customer_service", "low_quality", "missing_features", "switched_service", "too_complex", "too_expensive", "unused", "other"]
            }
        },
        SubscriptionUpdate = new ConfigurationFeaturesSubscriptionUpdateOptions
        {
            Enabled = true,
            DefaultAllowedUpdates = ["quantity", "price", "promotion_code"],
            ProrationBehavior = "create_prorations",
            Products = new List<ConfigurationFeaturesSubscriptionUpdateProductOptions>
                {
                    new ConfigurationFeaturesSubscriptionUpdateProductOptions
                    {
                        Product = "prod_xxx1",
                        Prices = ["price_xxx1"]
                    },
                    new ConfigurationFeaturesSubscriptionUpdateProductOptions
                    {
                        Product = "prod_xxx2",
                        Prices = ["price_xxx2"]
                    },
                    new ConfigurationFeaturesSubscriptionUpdateProductOptions
                    {
                        Product = "prod_xxx3",
                        Prices = ["price_xxx3", "price_xxx4"]
                    }
                },
            ScheduleAtPeriodEnd = new ConfigurationFeaturesSubscriptionUpdateScheduleAtPeriodEndOptions
            {
                Conditions =
                [
                    new ConfigurationFeaturesSubscriptionUpdateScheduleAtPeriodEndConditionOptions { Type = "decreasing_item_amount"  },
                    new ConfigurationFeaturesSubscriptionUpdateScheduleAtPeriodEndConditionOptions { Type = "shortening_interval" }
                ]
            }
        },
        CustomerUpdate = new ConfigurationFeaturesCustomerUpdateOptions
        {
            Enabled = true,
            AllowedUpdates = ["email", "tax_id", "address", "name", "phone"]
        }
    },
    DefaultReturnUrl = "https://example.co.uk",
    LoginPage = new ConfigurationLoginPageOptions { Enabled = false },
    BusinessProfile = new ConfigurationBusinessProfileOptions
    {
        Headline = "MyProduct",
        PrivacyPolicyUrl = "https://example.co.uk/privacy-policy/",
        TermsOfServiceUrl = "https://example.co.uk/terms-of-service/"
    },
    Metadata = new Dictionary<string, string>
    {
        { "type", "test" }
    }
};

var portalConfig = await service.CreateAsync(options, null, cancellationToken);

From the portalConfig result you can see that the Products under SubscriptionUpdate is null.
From the Developer Logs explorer you can see that the Products are not sent

Image

Expected behavior

Products are sent via the API. The resulting session that is created can update the subscription.

Code snippets

OS

windows

.NET version

.NET 9.0

Library version

Stripe.net 47.4.0

API version

2025-02-24

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant