Stripe Customer Portal
A dedicated portal for the customers to go to their stripe account without logout from the website and loggin in the stripe. Also, it give access to account managers when they are handle multiple user accounts.
The initial requirements comes from client to make a portal which will connect the users in their website with their stripe account without separately login into the stripe and manage their subscriptions. But their was a catch. Not all the users use same email address in both stripe and the client website. So to achieve the initial portal connection I use stripe customer data endpoint (with PHP sdk) to get the customer id from stripe. If any users regular stripe email address is not matched with the user’s email in the website, I checked alternative email fields in the stripe portal.This customer_id fetching was done when login in the website. Then the user can directly connect to their billing portal by just clicking a button from their account in the website.
For further enhancements, client gave a new requirements.Some of the users account are handled by some common people and this is also a known system in their website. So I have make sure the if any email is found on any user account’s main email address or alternative email address, then I take the customer_id from the stripe portal and save them in a separate database table rather than saving in the user_meta which was done previously. Also, added a separate section so that users can be added or removed manually.
If you wan to check the source code please visit my github repo.