mermberfix logo x
The MemberFix Team’s got you covered.
Membership plugins

Auto change membership levels in MemberMouse upon signup

mm-level-change-subscribe

Overview

Introduction

A few months ago we built an integration for our customer between his MemberMouse membership site and the PayKickStart shopping cart / sales funnel app.

At the time I also wrote an article explaining exactly how to integrate MemberMouse with PayKickStart including all of the custom code you need to make it work.

Recently, another MemberFix customer needed a similar integration between PayKickstart (PKS) and MemberMouse.

But this customer’s situation was a little bit different…

Video Tutorial

MemberMouse managing only SOME subscriptions?

On our customer’s site, MemberMouse wasn’t managing all of the member subscriptions.

It was managing the subscriptions of only some of the members, while the rest of the members’ subscriptions were being managed directly through Stripe.

That means that those members hadn’t signed up for the membership via the MemberMouse checkout form but through a different payment that hooked directly into Stripe.

NOTE: It’s important to understand that unlike most WordPress membership plugins, MemberMouse doesn’t interact with Stripe directly via API. Instead, MemberMouse acts as an intermediary between your site and Stripe. So in effect, MemberMouse is the party that manages the subscription, NOT Stripe.

Export MemberMouse subscriptions and import them into PayKickStart

As of this writing, MemberMouse offers us no solution to export subscriptions from their server.

However, the good news is that while MemberMouse manages a member’s subscription through their own server, it still creates a corresponding subscription for that member in Stripe. 

And Stripe DOES offer us the ability to export the subscriptions.

Not only that, but PayKickstart just so happens to have a special feature which allows to easily import those subscriptions. 🙂

Avoiding interruption for members

So what about keeping current members happy and avoiding unnecessary customer support, re-subscription, cancellation, issuing new passwords, and all that jazz?

In this case, the only solution that prevented interruption of service for existing members was to continue to allow MemberMouse and Stripe to manage their OLD subscriptions, and to use PayKickstart with MemberMouse for all the NEW members going forward.

Kind of a 2-party system if you will.

So all new members will check out via a PayKickStart checkout form instead of the MemberMouse checkout form. And their subscriptions will also be managed by PayKickStart.

The free and paid membership level issue

As I explained in my previous article, the MemberMouse integration with PayKickstart works correctly only when we use the “free” membership level in MM and PKS.

So, the membership level MUST be set as a “free” level in MemberMouse as shown in the screenshot below.

The reason for this is because paid levels in MemberMouse would require the payment to go through the MemberMouse checkout form.

And since you’re PKS to process the payment, that can’t be done.

pks free membership level - Auto change membership levels in MemberMouse upon signup

All the members who sign up will be added to the MemberMouse “free” membership level.

But, this could be a problem and you might say:

“Hey, but I want my members to be added to a paid membership because I have my content protected by that membership, not by the Free one. What should I do?”

The solution is to automatically change the MemberMouse membership level, right after the member signs up using the PKS checkout page from the “free” one to the paid membership level corresponding to the product set up on PayKickstart.

And, as you might imagine, this solution can be used in various other situations, and not only in this PKS and MemberMouse integration example. 🙂

What you’ll need for this tutorial

Let’s begin!

Step 1 – PHP script to automatically change membership level upon member subscribe

First of all, you’ll need a PHP script that automatically changes the default “free” membership level to your desired paid membership level in MemberMouse.

1 – You will need to create a PHP file, name it change_membership_pks.php and add the following code to it:

<?php

if(!isset($_GET["member_id"]) || empty($_GET["member_id"]))
{
exit;
}

$memberId = $_GET["member_id"];

$inputParams = "apikey=Your API Key Here&apisecret=Your API Secret&";
$inputParams .= "member_id={$memberId}&";
$inputParams .= "status=1&";
$inputParams .= "membership_level_id=The Level ID of the Paid Membership&";

$apiCallUrl = "https://YourDomain.com/wp-content/plugins/membermouse/api/request.php?q=/updateMember";
$ch = curl_init($apiCallUrl);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $inputParams);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);

?>
​

2 – For the above code, you will need to add your MemberMouse API credentials which you will be able to find in your WordPress Dashboard by going to MemberMouse > Developer Tools under “API Credentials” tab.

membermouse api credentials wp - Auto change membership levels in MemberMouse upon signup

3 – And, you will need to add the ID number of the paid membership that you want members moved to, which you can find by going to MemberMouse > Product Settings under “Membership Levels” tab and mousing over the membership name (the ID = 2 in the example screenshot below).

mm membermouse membership id - Auto change membership levels in MemberMouse upon signup

4 – Then add the file to your theme folder (https://yourdomain.com/wp-content/themes/your-child-theme-folder).

Obviously your child theme folder directory probably won’t be named “your-child-theme-folder”. 😉

IMPORTANT: I highly recommend that you first create a child theme, or use the My Custom Functions WordPress plugin whenever you add custom code to your theme files. Otherwise, any time you update your theme your changes will get wiped out!

Step 2 – Create a MemberMouse Push Notification

After the PHP file is created and uploaded to FTP, we will need a way to TRIGGER the code right after the user is added to the “free” membership. And for this we will create a MemberMouse Push Notification.

1 – Log in your WordPress dashboard and go to MemberMouse > Developer Tools.

membermouse push notification - Auto change membership levels in MemberMouse upon signup

2 – Click on “Create Push Notification” green button and add the below settings:

membermouse edit push notification - Auto change membership levels in MemberMouse upon signup

3 – The URL to your custom script will be:

https://yourdomain.com/wp-content/themes/your-child-theme-folder/change_membership_pks.php.

4 – Click on “Save Push Notification” and… that is all!

5 – Want our team to do this integration for you?

No problem, just visit our MemberFix product information page and sign up or get in touch for a call!

 

Do you use PayKickStart or ThriveCart or any other 3rd party shopping cart / funnel software? 

Why or why not? Let us know in the comments below!

 

Did you find this tutorial helpful?
0
1
User Review
100/100 (1 vote)

You may also enjoy...

WordPress based membership sites have certain requirements, and make use of certain applications that, in my experience, makes most of the popular hosting providers a poor choice.
Learn how to add a point-and-click color picker to your GravityForms forms fields using this simple and free technique!

One of the most annoying experiences you can put your members through is to force them into a long registration process. Choosing a username, choosing a password, yada yada. It’s

Learn how to create a high-converting “quiz” or “checklist” lead magnet using GravityForms and the GravityPDF plugin!
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments