One way to set this up would be using events.
To start with, you need to listen to events in Chargebee.
Every time a user goes through the Checkout process, the corresponding events get triggered. Using these events, you can get the subscription id and associate it with the customer record on your side. The trouble here would be uniquely identifying the customer record on your side with the subscriptions ids in Chargebee. You can overcome this if you are using our latest version of the Checkout page.
We have devised a success function that would return a hosted page id containing all the details of the subscription. You could use this to overcome the aforementioned restriction.
I'd like to create a way such that user creation (on our backend) happens atomically with successful subscription creation on Chargebee's end.
Our ideal account creation has a user + password field, and then a checkout button that brings up Chargebee Hosted Pages. Upon successful completion of the checkout, the user account is created on our side, and attaches the Chargebee subscription ID.
But it looks like it's difficult to get these totally in sync - the best way I could come up with is to use the Chargebee passthrough with the API to pass our user's registration details (username + password). But it definitely doesn't make sense to me to hand over the password to Chargebee (even if it is encrypted). I'd like a solution that avoids this, and avoids any ordering of the events (user creation and then subscription details, etc.).
I'd appreciate any suggestions. Here's an example of what I'd like to create: https://forge.laravel.com/auth/register