This is a reference implementation for integrating WordPress with Chargebee. This plugin helps in managing memberships using Chargebee. Developer assistance would be required for further customizations.
This plugin also helps publishers using WordPress to easily provide access/restrict content to subscribers using the plans configured in Chargebee.
Chargebee manages the entire subscription life-cycle starting from trial to paid to canceled and also freemium users. The plugin automatically updates changes that happen in Chargebee to WordPress.
It also connects your subscribers to Chargebee’s customer portal in case you want to provide them with the option to manage their account. This includes viewing past payments, updating card details and also canceling their subscriptions.
What does the plugin do?
- The plugin acts as a paywall in resticting content to your users based on their pricing plans.
- Provides the option to add customers to a default plan during signup.
- Provides integration with other user registration plugins available in WordPress.
- Changes that takes place to subscriptions in Chargebee are updated in WordPress. These changes are updated using webhooks.
- Connects to Chargebee’s customer portal for your users to easily access and manage their account and payment information.
Easy access to Chargebee’s features with URLs
The plugin includes URLs that can be used for specific functions such as changing an existing user’s subscription to another plan and also to connect users to Chargebee’s customer portal. All this can be done within your WordPress site.
Easy integration with other user registration WordPress plugins
Additional information about the users can be passed to Chargebee when a new user signups in your WordPress site.
Access users’ Chargebee meta information using filters
- apply_filter(“cb_get_subscription”, $user_id) – gives the user’s subscription details present in Chargebee. This will be in the Chargebee Subscription object format.
- apply_filter(“cb_get_customer”, $user_id) – gives the user’s customer details present in Chargebee. This will be in the Chargebee Customer object format.
- apply_filters(“cb_get_user_plan”, $user_id) – gives the current user’s subscription plan ID in Chargebee.
The plugin supports short codes that can be embedded into posts or pages on your site. This can be used to display messages or content to users based on their current plan. It can also be used to create a custom pricing page.
Chargebee is an easy to use online billing platform for subscription businesses.
With Chargebee you can:
- Manage trial and freemium subscriptions
- Automatically invoice your customers and collect payment
- Notify your customers during various stages of the customer life cycle using our email notifications
- Set up, run and manage different discount campaigns
- Use your choice of payment gateway. Chargebee suppports Stripe, PayPal Pro, Braintree, Authorize.net, eWay and much more
- Automatically prorate subscriptions and also handle credits and refunds
- Create and manage offline subscriptions
- Completely customizable hosted payment pages and customer portal
- Handle EU VAT and general taxes
- Comprehensive API support with multiple client libraries
Find out more.
- Download the latest version of the plugin, unzip the file on your computer and then upload it to your WordPress Plugin directory(/wp-content/plugins directory).
- In your WordPress admin console, activate Chargebee in the “Plugins” section.
Once the Chargebee plugin is activated, it will appear on the menu bar.
Note: You can also install the plugin directly through your WordPress admin console. Go to the “Plugins” section, select “Add New”, search for “Chargebee” and then activate it.
- A Chargebee account. Signup for a free trial if you don’t have one.
- Configure your Chargebee site name, API key and default plan.
- Copy the webhook and “Return & Cancel” URLs from WordPress and configure them in Chargebee.
Save your changes to complete the setup.
You can restrict access to posts by specifying a plan for them, making it available only for users that are on the specified plan.
- Go to “Posts” in WordPress and select the post you want to restrict access to.
- Use the “Chargebee Access Control” section located at the bottom of the post to specify which plans have access to that specific post.
- Update your changes.
Plan Upgrade Page
You can use the plugin’s default plan listing page to upgrade to a specific plan to view the restricted content.
If users do not already have a valid credit card in Chargebee, during upgrade they will directed to Chargebee’s hosted checkout page to complete the upgrade.
Customer Portal Page
Chargebee’s customer portal can also be linked to your WordPress site to allow users to view and update their account and payment information as well as view past invoices.
- What are webhooks? How do I test them in a local environment?
Webhooks are callback services that notifies WordPress about the subscription changes that happen in Chargebee. Learn more about webhooks here
You cannot test webhooks locally. If you want to try it out locally. you should use a local tunneling tool like ngrok.
- Can I securely collect credit card information?
The plugin connects your WordPress site with the Chargebee app and uses Chargebee’s hosted checkout page for sign ups. Since the card details are collected through the hosted pages, you do not handle any sensitive card information, reducing your PCI compliance requirements.
- Are the hosted checkout pages customizable?
Absolutely! Our hosted pages support themes and are customizable. You can easily make the hosted pages match your website’s look and branding. Learn more here.
- Does the plugin include a customer portal?
Yes. Chargebee has its own customer portal that allows your site users to view and manage their subscription information.
- Does the plugin support multiple subscriptions for a customer?
The current version of the plugin only supports one Subscripion per Customer. We do have an Open Source version of the plugin you could use to add support for multiple Subscriptions for a Customer.
- How to migrate users from some other system to WordPress and use Chargebee plugin for integration?
If you are moving from a different system to WordPress and if you are using this plugin to integrate with Chargebee, then you need to migrate your users to WordPress first. Then use the WordPress user id as the Customer and Subscription ID in Chargebee to import your Customers into Chargebee.
The WordPress user ID is used as the mapping between WordPress and Chargebee. So it is required to do import first into WordPress and then to Chargebee for the plugin to work correctly.
To import Customers and Subscriptions into Chargebee, you could use Bulk Operations.
- Chargebee has many APIs. How do I invoke them in WordPress?
In order to invoke other APIs, just call the required API code from within WordPress. Initializing the environment for calling Chargebee’s APIs will be taken care by the plugin. After calling the API ensure that you update the user meta information of Chargebee in WordPress. The “do_action(‘cb_update_result’, $result)” takes the response received during the API call as input and updates the Chargebee user meta information in WordPress.
- How do I get support?
Contact our Support Team
Contributors & Developers
“Chargebee” is open source software. The following people have contributed to this plugin.Contributors
Icon and text changes
Redirection after logging in has been handled, if the customer comes clicking checkout from plan pricing page and also events without subscription object webhook call were failing has been handled
Minor bug fix. In plan listing page for premium plans, plan period has been skipped and now it is fixed
Support for showing specified number of characters for a restricted post and also redirecting user to custom login page when try to choose a plan without logging in site.
Added support for integrating with other user registration WordPress plugin.
Updating Chargebee user meta in WordPress after redirecting from customer portal, removed “chargebee plan” property, if invoice name is null then replace it will plan name and also added filters for developers to access the Chargebee user meta information.
Short code had been added to show custom messages based on the user plan
Option for customer to view the available plans and to switch their plan by themselves. Customers can use the Chargebee hosted page and customer portal feature.
Webhook calls are checked with the existing customer subscription information and if any change found they are fetched from the Chargebee.
Initial version of Chargebee plugin.