WordPress Simple Membership plugin allows you to create Stripe subscription/recurring payment buttons for membership payment from the payments menu of the plugin.
Once you create the button in the plugin, you can add a shortcode to place the subscription payment button on your membership Join Us page.
Creating Stripe Subscription Button for Membership Payment
Step 1) Create a Subscription Plan in Your Stripe Account
First you need to create a subscription plan in your Stripe account.
Login to your Stripe account. Then select Products link from the menu in left column.
Click New button to create a new product with a subscription plan.
Lets create an example product with a subscription pricing plan which would be 9.95 USD monthly. Here is how it should look:
Give the product a name and hit the “Create Product” button to go to the pricing plan interface:
The following screenshot shows how I have configured the pricing plan details. Leave the “ID” field empty so Stripe generates one for you.
Click on the “Add Pricing Plan” button to create it.
Adding a Trial Period to Your Stripe Subscription Plan
When you are creating a subscription plan within your Stripe account you can add a trial period. A trial period is a time frame in which the customer will be able to see your content without needing to pay. After the trial period has ended the customer will then get billed at the intervals you specify.
When you are adding the pricing plan (following the steps above), simply enter the number of days you’d like to offer the trial for in the Trial Period section. When your customer purchases the membership, they will need to enter their credit card details upfront even if there is a free trial period attached. This ensures your customers remain part of the membership even when the trial period finishes.
Example: Adding a Trial Period to a Subscription Plan
In the following example, my customers will receive a 14 day trial period before their subscription payments will be deducted from their bank account.
Getting the Plan ID
Now that you have created a product with a pricing plan, we need to get the ID of this pricing plan so it can be used in the plugin.
Click on the pricing plan name when viewing the product.
You can see the plan ID from this plan details interface.
Take note of the ID field from the details section. You will need to enter it in the simple membership plugin’s button configuration (we will do that in the next step).
The default plan names that Stripe creates has the “plan_” prefix. This is how you can verify that you are copying the Plan ID (and not mixing it with the Stripe Product ID).
Step 2) Create a Stripe Subscription Button in The Plugin
We can now create a subscription button in the membership plugin.
Go to Payments -> Create New Button interface from the admin side of this plugin. Then select the Stripe Subscription option.
Step 3) Configure the Payment Button Details
Complete the details for the button. Enter the plan ID (from step 1) in the Stripe Plan ID field.
Step 4) Configure the Stripe API Key Details
Enter your Stripe API Key details in the payment button also.
You can get Stripe API key details from your Stripe account.
Step 5) Save the button
Save the payment button after you have entered all the necessary details. This will create the payment button.
Take note of the Webook Endpoint URL as we will need it when we setup a Webhook in the next step
Step 6) Setup the Webhook in Your Stripe Account
Stripe uses webhooks to send notification to a script after a subscription is charged. We are going to setup a webhook and tell Stripe to notify the simple membership plugin.
Go to the Webhooks menu in your Stripe account then click Add endpoint button.
You should copy Webhook Endpoint URL from your button settings and paste it into URL to be called field.
Make sure you are viewing your Stripe account in the correct mode (Live or Test) so the webhook gets created for the correct mode. (in our case, we are doing it for Test mode).
For the Events to send field, select “Charge” and “Customer” events from the dropdown list. It will include all the different events for Charge and Customer.
The rest of the options should be left default. Click Add endpoint button and it should appear on the Endpoints list:
Step 7) Put the Payment Button on a Page
You can now put this newly created button on your membership join us page so the visitors can pay you using this button.
The Manage Payment Buttons tab shows you the shortcode you need to use to put your Stripe payment button on a page.
What Happens After the Payment?
If this is a payment made by a NEW member then the user will receive an email that contains a special link to complete the registration. Read the registration process overview documentation to learn more.
If the payment is made by an EXISTING member then the membership level (associated with this payment button) is applied to the existing member’s profile.
Note: The member must be logged into the site as a member for this plugin to recognize the user and treat him/her as an existing member.
SSL Certificate Requirement
Stripe payment gateway requires you to have SSL certification on your checkout page (the page where you put your payment button). So the URL of that page should have HTTPS (example: https://yourdomain.com/join-us-page).
If you are not already using an SSL certificate on your site then you should contact your hosting provider and request them to install it for you. This plugin is useful to force your payment page (where you have the Stripe payment button) to be loaded using HTTPS.