Start a new topic
Answered

How to prohibit an email to subscribe several times to same plan

My application doesn't support a user to have several subscriptions yet. But using Chargebee checkout page, a user can create several subscription with same email. Is there a way to prohibit the use of an email already attached to a subscription when creating a subscription through Chargebee checkout page?


Best Answer

Hi Erwan,


If you want to prefill the hosted pages with email address, the format would be:

https://account.chargebee.com/hosted_pages/plans/plan_id?customer[email]=toto@gmail.com


Is this what you're looking for? 


I'm assuming you would be validating the user on your end before emailing them the link


Hi Erwan,


At the moment, we allow same email addresses to checkout multiple times as this is required by quite a few businesses. If you would like to restrict this from happening, there are 2 approaches:


1. Using Customer ID as Email address: You can capture the email address on your end and pass this email address to the hosted pages and also pass this email address as the customer ID. Here's more on prefilling hosted pages. The downside to this approach is this: The customer could change their email address in future, but this wouldn't change their customer ID. Therefore, the customer will now be able to checkout another subscription using the new email address. 


2. Validating email addresses in your system: The other approach is where you maintain a local database in your application with the list of subscribed customers, and validate the email addresses entered before letting the customers proceed to checkout. 


Let me know if this helps.

Thanks, clear. Was not aware of the method to prefill hosted page, interesting.

I would like to have the following flow from my application to ensure that email used in checkout page is valid:


1) Ask email to user who want to subscribe to the service

2) User receives email and click on the link included to reach hosted checkout page

3) User proceed to checkout


However, I don't manage to have a link to my hosted checkout page with email prefilled automatically, something like:

https://account.chargebee.com/pages/v2/ufizehfuezfm/checkout?customer[email]=toto@gmail.com


Is that possible?

Answer

Hi Erwan,


If you want to prefill the hosted pages with email address, the format would be:

https://account.chargebee.com/hosted_pages/plans/plan_id?customer[email]=toto@gmail.com


Is this what you're looking for? 


I'm assuming you would be validating the user on your end before emailing them the link

Yes that's what I was looking for. I didn't realize that final URL is generated after calling that first URL. 

I also found how to generate this final URL via CURL request. 

After disabling hosted page in the settings (keeping only generation of hosted page URL through API) and putting customer email in read-only I got exactly what I need. Thanks again.

Glad to be of help Erwan :) Enjoy your day and do reach out to us if you've more questions.

Just curious - in the near future do you intend on providing a setting for either allowing or disallowing multiple concurrent subscriptions for situations where the customer should only ever have one (active or future) plan at a time?

Hello Adam


We're working on revamping our hosted checkout pages and the option to handle returning users is also included in this. However, let me have a discussion with our engineering team and get back to you with more details.

Login or Signup to post a comment