Start a new topic

Getting a Customer's Unique ID

I'm using hosted pages and API, so it looks like I could:

  1. Extract the subscription id from the redirect url when a successful purchase is made by the customer. 
  2. Using the subscription id, I'd make an API call to Retrieve Subscription and extract the customer id from the response. 
  3. Using the customer id, I'd store that customer id in my database for the currently logged in user. 
  4. Later, when that customer wants to view their customer portal (hosted), I'd select that Chargebee customer id from my database and pass that as a parameter when I make an API call to Create a Portal Session. 

 

Is there a more efficient way to do this?

 

 

URLs I've researched on this topic:


1 Comment

Hi Joe


I believe your workflow is this - allow customers to login to your webpage - they purchase a subscription - using the customer ID, you'd like to create a portal session for the user. If this is not the workflow, please stop here and get back to me with your use case along with the workflow. 


If the above is your setup:


1. The customer ID can be retrieved from the redirect URL; you don't have to use the Retrieve Subscription API call to get the customer ID.

2. You can create a portal session for the customer using their ID.

3. Storing the customer ID in your database is optional. You can store them if there are any actions performed based on the active session.


If you still want to reduce the steps involved, can you elaborate your business model? It would help us offer you the best suggestions.


Thanks

Meena N




Login or Signup to post a comment