Akash Ahmad
Akash Ahmad

Reputation: 11

Filter products on basis of user stripe customer portal

I did the Stripe integration, I am using the Stripe Checkout and Stripe customer portal for payments management. I have 2 types of users, Students and Teachers. I want to show them subscription on the Customer portal based to their role. The Stripe is giving us the option for the product that we want to show but I am unable to figure out how to show the products to both the users based on their roles so that the Teacher don't see the Students products and the Students do not see the Teachers products.

Upvotes: 1

Views: 462

Answers (1)

Pompey
Pompey

Reputation: 1354

If you need multiple Customer Portal configurations, you can do so via the API[1]. You can specify what products and prices are allowed in each configuration by passing them in to the features.subscription_update.products parameter[2] of the billingPortal.configurations.create call.

Then when creating the Customer Portal session, you can pass in the ID for your Student or Teacher configuration to the configuration parameter[3] of the sessions.create function.

[1] https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#configure

[2] https://stripe.com/docs/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_update-products

[3] https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-configuration

Upvotes: 1

Related Questions