Wordpress 

Wordpress allows you to create websites, blogs and share content, services and products to users on the web. With content being generated in the form of research reports, courses, online tutorials and more everyday, you can monetize your content by setting up a paywall on your website.

Paywall is a way of gating your site's premium content on a subscription basis.

With Chargebee's plugin for Wordpress, you can implement a paywall on your site and charge users on a subscription basis. It allows you to restrict content based on the subscription on which your customers have signed up.

Note
  • The plugin is available only on request. We will send the Wordpress plugin zip file for you to install.
  • It is recommended to test the plugin on your Chargebee Test site before enabling it on your Live site.
  • Your customers should sign in to your website prior to checkout. For more information, take a look at why sign in is mandatory .

Prerequisites 

Ensure that you use these tools and their respective versions to setup the plugin:

  • Wordpress version 4.5.0 or above
  • PHP version 5.5.9 or above
  • MySQL version 5.6 or above, else MariaDB version 10.0 or above

Plugin Overview 

Chargebee's plugin creates the following in Wordpress. These are required to setup content restriction on your site:

Products:

  • Chargebee creates Product as a custom object in Wordpress
  • Plans in Chargebee will be created as Products

Levels:

  • Level is a custom object in Wordpress
  • You can map a Product to a Level to restrict content
  • You can also map multiple Products to a Level

Setup Wordpress plugin 

"
  1. Navigate to Wordpress dashboard > Plugins > Add new and click Upload Plugin.
  2. Upload the Chargebee plugin and click Activate Plugin.
  3. Next, go to Chargebee tab > Settings > Integration settings, enter your Chargebee site name and API key. If your Chargebee site URL is https://acme.chargebee.com, the site name to be entered is "acme".
  4. Click Save API Key and Synchronise. Plans from Chargebee can now be found under Wordpress dashboard > Chargebee tab > Products.
  5. Copy the Webhook URL, Username and Password from your Wordpress site.
  6. In your Chargebee User Interface, navigate to Settings > Configure Chargebee> API Keys and Webhooks and switch to the Webhooks tab. Click Add Webhook.
  7. Enable Protect webhook URL with basic authentication option and paste the Webhook URL, Username and Password in the respective fields. Click Create.
  8. In your Chargebee User Interface, navigate to Settings > Configure Chargebee > Checkout & Self-Serve Portal > Configuration > Portal and from the Self-serve portal access drop-down, choose via Single Sign On API.

Setup Levels in Wordpress 

Once the plugin is installed, Chargebee will create Levels in Wordpress. You can create restriction as follows:

  1. In your Wordpress dashboard and go to Chargebee tab > Levels. Enter the Level name and description.
  2. Select the Chargebee plan which needs to be associated with each Level. More than one plan can also be associated to a Level.
"

Setup Content Restrictions 

Chargebee's plugin allows you to setup a content restriction mechanism. You can set restrictions for your pages/posts as follows:

"

Everyone: All viewers can access the content

Select Level: Viewers on a particular level can only view the content. Once this option is selected, you can select a level

As restricted at Category level: Set a level at the Category level, which will apply to all posts/pages in the Category

"

As per content shortcodes: Restrict content based on the shortcode used on the page or post. Supported shortcodes are listed below:

Shortcode Usage 

These shortcodes can be used in your posts/pages to setup restrictions or guide users to sign up:

Action Shortcode Description
Show content [cb_content_show level="level_id"] Your content [/cb_content_show] This content will be shown to users who are on the plan associated with the Level ID mentioned in the shortcode.
Hide content [cb_content_hide level="level_id"] Your content [/cb_content_hide] This content will be hidden for the users who are on the plan associated with Level ID mentioned in the shortcode.
Checkout subscription [cb_product_subscribe_hosted class="btn" product_id="plan_id"] Subscribe [/cb_product_subscribe_hosted] End users can checkout the subscription by clicking the link, which will load Chargebee's in-app checkout.
Manage subscription [cb_account_portal class="btn"] Manage Subscription [/cb_account_portal] End users can manage their subscription by clicking the link, which will load Chargebee's self-serve portal.
Display subscription [cb_display_subscription] End users can view their subscription details.
Show content(guest users) [cb_not_logged_in] Your content [/cb_not_logged_in] This content will be shown to users who have not logged in to your website.
Show content(paid) [cb_paid_subscription] Your content [/cb_paid_subscription] This content will be shown to users on paid plans.
Show content(free) [cb_free_subscription] Your content [/cb_free_subscription] This content will be shown to users on free plans.
  • Replace "Product ID" in the Product Subscribe shortcode with Product ID of the plan which needs to be represented. Product ID of a plan is similar to the Plan ID in your Chargebee site.

  • Make sure the "level_id" placeholder is replaced with an actual level_id when using shortcodes. If "level_id" is not mentioned for [cb_content_show] shortcode, the content will be shown to all users. Similarly, if "level_id" is not mentioned for [cb_content_hide] shortcode, content will be hidden for all users.

Limitations 

  1. Addons will not be synced from Chargebee to Wordpress.

  2. Single page Checkout is not supported. In-app Checkout will load when your customer is making a purchase.

  3. Pricing table is not supported. However, if you would like to display multiple plans on a single page, you can use the Subscribe shortcode for each plan. This way, your customers can checkout directly from one page.

  4. Multi sites  in Wordpress is not supported.

FAQ 

1) How do I migrate to the new version of the Wordpress plugin by Chargebee?

You can un-install the plugin and install the new version. On contacting Support, we will share the latest file for you to install. Also, refer to the new set of shortcodes.

2) How to assign a default plan for anyone who signs up?

To assign a free plan as the default subscription for all new signups, go to your Wordpress site > Chargebee > Settings > General and choose an option from Default Membership Product dropdown. Note that only "free plans" i.e., zero-dollar plans can be assigned as a default plan for new sign-ups.

3) How to change the Content Restriction Message?

You can set a custom message for guests or free plan users accessing gated content. Navigate to your Wordpress site > Chargebee > Settings > General and set a custom restriction message in the text box provided.

4) What are the deprecated shortcodes?

These shortcodes are deprecated:

  • cb_login_form
  • cb_registration_form
  • cb_account_link
  • cb_update_payment_method_form
  • cb_product_subscribe

5) Plans from Chargebee are not imported, what should I do?

In case the plans from Chargebee are not imported, try updating Plan ID in your Chargebee site and sync again.

6) If the customer's subscription is changed in my Chargebee site, will it reflect on the Wordpress site?

Yes, it would reflect in your Wordpress site. The customer would now be shown content according to their new plan.

Was this article helpful?
Loading…