0
votes

I have a Stripe account for a company selling subscriptions on two websites:

  • on website A: subscription plans A1, A2, A3 (these are Products in Stripe parlance)
  • on website B: subscription plans B1, B2 (also Products)

I would like to use the Customer Portal to allow the customers of both websites to manage their plan. I would like to show only show the respective plans on the portals created for each website.
Is it possible? How can I achieve this?

I see that we can provide a configuration built at runtime when creating a portal session, but I don't see how to specify the product set.

1

1 Answers

2
votes

You can use the Customer Portal Configuration object’s features.subscription_update.products parameter to specify the products available in the portal session. This is what that would look like in Python:

    stripe.billing_portal.Configuration.create(
        business_profile={
            "headline": None,
            "privacy_policy_url": "https://example.com/privacy",
            "terms_of_service_url": "https://example.com/tod"
        },
        features={
            "subscription_update": {
                "default_allowed_updates": ["price", "quantity", "promotion_code"],
                "enabled": True,
                "products": [
                    {
                        "product": "prod_B1",
                        "prices": [
                            "price_123",
                            "price_456"
                        ]
                    },
                    {
                        "product": "prod_B2",
                        "prices": ["price_789"]
                    },
                ]
            },
            "payment_method_update": {
                "enabled": True
            },
        },
    )
    session = stripe.billing_portal.Session.create(
        customer="cus_123",
        return_url='https://example.com/account',
        configuration=configuration.id
    )