{"id":28254983,"url":"https://github.com/chargebee/customer-portal-php","last_synced_at":"2025-06-16T06:31:33.999Z","repository":{"id":49037054,"uuid":"51425665","full_name":"chargebee/customer-portal-php","owner":"chargebee","description":"Opensource - PHP Customer Portal","archived":true,"fork":false,"pushed_at":"2017-04-04T08:05:27.000Z","size":330,"stargazers_count":71,"open_issues_count":3,"forks_count":37,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-05-19T20:19:12.294Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chargebee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-10T06:54:29.000Z","updated_at":"2025-04-30T06:59:40.000Z","dependencies_parsed_at":"2022-09-08T15:10:32.034Z","dependency_job_id":null,"html_url":"https://github.com/chargebee/customer-portal-php","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/chargebee/customer-portal-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fcustomer-portal-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fcustomer-portal-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fcustomer-portal-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fcustomer-portal-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chargebee","download_url":"https://codeload.github.com/chargebee/customer-portal-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fcustomer-portal-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260114338,"owners_count":22960884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-19T20:16:39.416Z","updated_at":"2025-06-16T06:31:33.949Z","avatar_url":"https://github.com/chargebee.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CUSTOMER PORTAL\n\n* [Introduction](#introduction)\n* [What can I do with the open source portal code?](#what-can-i-do-with-the-open-source-portal-code)\n* [Why would I want to use this?](#why-would-i-want-to-use-this)\n* [What can be done with this code?](#what-can-be-done-with-this-code)\n* [How is user management handled?](#how-is-user-management-handled)\n* [Theme customization](#theme-customization)\n* [Configuration](#configuration)\n* [How to get started?](#how-to-get-started)\n* [Feature wishlist and how to implement](#feature-wishlist-and-how-to-implement)\n* [Handle Portal Signup Emails](#handle-portal-signup-emails)\n* [Support and contribution](#support-and-contribution)\n* [License](#license)\n\n## Introduction\nChargebee is a subscription billing management service that eases the complexities involved in managing recurring payments. As part of a comprehensive subscription lifecycle management system, Chargebee provides hosted checkout pages and 'customer portals'.\n\nAs your business scales up, you might come across a scenario where you’d want certain specific and essential features to be implemented in your customer portal. Needless to say, this comes with a lot of dependencies such as:\n\n* The waiting time for the feature to be fully developed.\n* The iterations needed to get the feature right based on your requirements. \n* Additional cost. \n\nAlthough Chargebee's default [customer portal](https://www.chargebee.com/docs/customer_portal.html) covers the basic account management functionalities, some of you might need extensive customization based on your business needs. For this reason, we’ve created an open source implementation of the customer portal using our own API- so that you can continue to develop customized features of varying degrees or individual specificity, independently without the wait time.\n\n## What can I do with the open source portal code?\n\nThe code base for this portal is built on PHP and mirrors our current portal in terms of the UI and features. You could fork this to add any additional features that you think would help your business such as:\n\n* Reactivate Subscription (already available in the open source )\n* Pause Subscription \n* One time Checkout\n* Option to display customer specific plans, etc.\n\n## Why would I want to use this?\n\n***To help you transition to your own implementation easily***\n\nThis portal implementation adopts the UI and CSS from Chargebee’s portal.\n\n***For easy  adoption and to make changes to the portal using Bootstrap***\n\nThe UI for this portal is built using Bootstrap CSS and a base customized CSS is borrowed from Chargebee’s customer portal theme. \n\n***To add necessary functionalities on your own***\n\nThe code is modular which makes it easy to add the functionalities you need using the configuration files present under portal/config directory.\n\nHere’s a quick look at the open source portal design:\n\n![Portal UI](screenshot-1.png)\n\nBelow are the list of functions present in this portal:\n* Update Account Information\n* Add/Update Billing Address\n* Add/Update Payment Method\n* Add/Update Shipping Address\n* View \u0026 Download Past Invoices\n* Cancel Subscription\n* Reactivate Subscription\n\n## What can be done with this code?\n\nThis portal implementation adopts the UI and CSS from Chargebee’s portal to help you transition to your own implementation easily.\n\nThe UI for this portal built using Bootstrap CSS and the base customized CSS is borrowed from Chargebee’s customer portal theme. This is because it’s easy to adopt and make changes to the portal using Bootstrap. \n\nThe code is modular which makes it easy to add the functionalities you need using the configuration files present under portal/config directory.\n\n## How is user management handled?\n\nChargebee’s user management supports the entire account setup starting from portal set up to email address verification, password retrieval, login, and logout. \n\nTo understand the detailed workflow of the signup process, please follow the link below: \nhttps://www.chargebee.com/docs/customer_portal.html#how-can-your-customers-access-their-portal\n\nThe code that integrates with Chargebee’s user management system is located in [Auth.php](portal/Auth.php).\n\nIf you already have a user management system at your end, you could ignore this section and directly insert your authentication code in init.php. The rest of the codebase can be used as such.\n\n## Theme customization\nIf you’re using our user management option, you would have to customize the theme to match your website. \n\n## Configuration\n\nThe configuration details of this implementation are captured in the files present under the [portal/config](portal/config/) directory.\n\n**portal/config/config.ini:** This captures the settings that are required to connect to Chargebee account.\n\n**portal/config/infoandalerts.ini:** This captures the info \u0026 alerts texts displayed across the portal. You can customize the content as needed.\n\n**portal/config/portalsettings.ini:** This can be used to control the actions allowed in the portal.  \n\n*Example:*   \n1. If you do not want to allow your customers to cancel their subscription via the portal, you could set *cancelsubscription[allow]= ‘false’*.  \n2. If you’d like to allow your customers to change the plan but not the quantity, you could set *changesubscription[allow] = 'true'* and *changesubscription[planqty] = 'false'*.\n\n## How to get started?\n\nIn order to use this portal, you would have to:\n\n1. Add your server domain in your Chargebee site under *Settings\u003e Hosted Page Settings\u003e Whitelist Return URL\u003e Whitelisted Domain*. Please note that we only support port numbers 443, 80, 8443, 8080 \u0026 9001.\n\n2. Edit the properties below in the \"portal/config/config.ini\" file:\n   * SITE_URL and CANCEL_URL should be your server domain.\n   * APP_PATH: The name of the folder created in the ROOT directory. *Eg:* If the portal files are saved in your ROOT directory as portal, then the app path value should be the same (portal).\n    * SITE_NAME: Your Chargebee site name.\n    * SITE_API_KEY: Chargebee site API key.\n    * COOKIE_DOMAIN: should be your server domain.\n\n    ```ini\n    [GLOBAL]\n    SITE_URL = http://localhost\n    CANCEL_URL = http://localhost\n\n    [PATH] ;Set the APP PATH (Relative to ROOT Folder). Eg: If the portal files are saved in your ROOT directory as portal, then the app path value should be the same (portal).\n    APP_PATH = portal\n\n    [CHARGEBEE_ENVIRONMENT] ;Configure your Chargebee site name and API key.\n    SITE_NAME = \u003cyour-chargebee-site-name\u003e\n    SITE_API_KEY = \u003cyour-chargebee-site-api-key\u003e\n\n    [CHARGEBEE_COOKIE]\n    COOKIE_DOMAIN = localhost\n    COOKIE_PATH = /portal\n    ```\n\nIf you need assistance with the implementation, or have requirements regarding the same, please write to support@chargebee.com. \n\n## Feature wishlist and how to implement \n\nBelow is the implementation guide for features that might be important for your business. \n\n### Multiple Subscription\nThe existing code can be easily customized to support multiple subscriptions. \n\nWhen Chargebee’s authentication module is used:\n\nAs soon as the user is redirected from Chargebee, the “[Activate Portal Session](https://apidocs.chargebee.com/docs/api/portal_sessions#activate_a_portal_session)” API is called. In response, we return the list of subscriptions associated with the customer. If more than 1 subscription is present for the customer, you could direct him/her to a page where the subscription details are displayed. Depending on the subscription selected, the portal can be initialized by passing the subscription id to the [ServicePortal](https://github.com/chargebee/customer-portal-php/blob/master/portal/init.php#L63) object in the init.php file.\n\nWhen your own authentication module is used:\n\nYou could call the “[List Subscriptions For A Customer](https://apidocs.chargebee.com/docs/api/subscriptions#list_subscriptions_for_a_customer)” API to receive subscription details of a particular customer. If more than 1 subscription is present for a customer, you could direct him/her to a page where the subscription details are displayed. Depending on the subscription selected, the portal can be initialized by passing the subscription id to the [ServicePortal](https://github.com/chargebee/customer-portal-php/blob/master/portal/init.php#L63) object in the init.php file.\n\n\n### One Time Purchase\n\n\nSay a customer of yours wants to purchase a product that you’d sold in the past. You could create a page that would list all the products available for one time purchase. You would typically have a third party cart that the customer would use to select the product. When a customer places the order, instead of requesting the customer to checkout once again, you could connect with Chargebee via API and process the order through.\n\nThe one time products should be set up in Chargebee as Non Recurring Addons. You could list the one time products in a page and display this link/page in the Customer Portal. The products in the page have to be linked to the Non Recurring Addons in Chargebee. The [List Addon](https://apidocs.chargebee.com/docs/api/addons#list_addons) API call can be used to fetch and display the addon details.\n\nWhen the product is selected by the user, the product ID would be used to call the [Create Invoice](https://apidocs.chargebee.com/docs/api/invoices#create_an_invoice) API. Once the API call is successful, Chargebee will send a response and using this information, you could display the invoice details to the customer. The invoice will also be available in the portal.\n\n### Pause Subscription\n\nIf the subscription is paused, the following things have to be considered:\n\n* The customer should not be billed during the paused period. \n* The product should not be shipped during the paused period. \n* There should be an option to filter out subscriptions that have been paused.\n* Email Notifications (if enabled) should be customized accordingly.\n\n\nWith these in mind, the best way to achieve it would be by using a Custom Field value “Paused”. The workflow is as below:\n\n1. When the subscription is paused by the customer, “[Update a Customer](https://apidocs.chargebee.com/docs/api/customers#update_a_customer)” API has to be called and the custom field value should be passed (Paused= True).\n\n2. The next billing date should then be changed using the “[Change Term End](https://apidocs.chargebee.com/docs/api/subscriptions#change_term_end)” API call.\n\n3. If the “Subscription Changed” email notification is enabled, the customer will receive an email with the subscription changes. This email can be customized to include specific messages such as “Your subscription has been paused until X”. This can be done using conditions similar to the one shown below:\n\n  ```\n  {{#customer.cf_paused}}\n\tYour subscription has been paused until X\n  {{/customer.cf_paused}}\n  ```\n\n4. When the paused term gets over, the subscription renewal event will be triggered. Using this, “Update a customer” API has to be called to update the Custom Field value (Paused= false). When the paused term ends, the subsequent renewal dates will also change. The customer could be informed about this either while the subscription is being paused (a text message perhaps) or through the “Subscription Changed” email notification.\n\n**Optional**: The customer could also have the option to “Resume” the subscription. The billing date can also be set by the customer. In this case as well, the subsequent renewal dates will be changed ( a text message showing this before confirmation).\n\nIn the future, if you’d like to retrieve information about “Paused” subscriptions, you could do that by using the custom field value as the filter criteria.\n\nIf the subscription is paused while it is:\n\n* In Trial:  The subscription status remains “In Trial”.\n* Active: The subscription status remains “Active”.\n* Future: The subscription status remains the same and the next billing date is pushed further ahead.\n* Non Renewing: You might not want to show the “Pause” subscription option here because in this case, only the cancellation date will be shifted.\nCancelled: Hide the option.\n\n**Reports And Exports**\n\nSubscription pause will not affect the Active subscription count and the MRR reports. \n\nOnce the “Pause Subscription” feature is implemented, if you’d like to take an export of Active subscriptions alone, you’d have to use an additional filter criteria to ensure that the subscriptions with the custom field value “Paused” are excluded. \n\n\n### Handle Portal Signup Emails\n\nRight now, the {{customer_portal.signup_url}} mergevar (under email notifications) will redirect your customers to Chargebee's portal. If you're using the open source portal, to ensure that the customers are redirected to the open source portal page, the following actions are required.\n\n1. Customer clicks on the sign up link directly from the portal login page (as shown below).\n \n  ![Portal Signup ui](screenshot-2.png)\n\n In this case, the url should have the return url of the open source portal configured in it. The customer will then receive an email with the portal sign up link. Once the password is entered, customer will be redirected to the open source portal page.\n\n2. Customer accesses the sign up link from one of the email notifications (For example, 'Subscription Created'). \n\n If you'd like customers to be redirected to the open source portal page, you could replace the url for the particular email notification as shown below:\n\n**Customer_portal.signup_url:** https://honeycomics-test.chargebeeportal.com/portal/login?email={{customer.email}}#cb-portal-signup\n\n**Open_source.signup_url:** https://honeycomics-test.chargebeeportal.com/portal/login?email={{customer.email}}\u0026return_url=http://www.honeycomics.com#cb-portal-signup\n\nThe same goes for the {{customer_portal.login_url}} as well.\n\n\n### Support and contribution\n\nIf you’ve added new functionalities that you think might be helpful for all, do send us a [pull request](https://github.com/chargebee/customer-portal-php/pulls). For feature requests or feedback, submit [here](https://github.com/chargebee/customer-portal-php/issues/new). \n\nIf you’d like us to guide you through the set up process or if you have any questions regarding the portal implementation, please contact us at support@chargebee.com.\n\n\n## License\nSee the LICENSE file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchargebee%2Fcustomer-portal-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchargebee%2Fcustomer-portal-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchargebee%2Fcustomer-portal-php/lists"}