Switching to Discourse Subscriptions from WordPress Subscriptions

Continuing the discussion from Discourse Subscriptions

As the Discourse Subscriptions plugin matures I want to start planning for moving my existing memberships from WooCommerce Subscriptions to Discourse Subscriptions. The process below should apply to other WP membership/subscription plugins, not just WooCommerce.

There are three elements of this transition that need to be addressed:

  1. Creating subscriptions in Stripe
  2. Linking the Stripe subscription to the user in Discourse
  3. Reversing SSO so that Discourse becomes the SSO provider and WordPress the client

(1) Creating subscriptions in Stripe

It looks like creating the subscriptions in Stripe for existing users is a manual process at the moment. My members are already in Stripe, so the workflow would look something like this:

  • Export all subscribers and data from WooCommerce Subscriptions
  • Create a subscription in Stripe for a user from the customer Stripe dashboard and schedule the first payment to match the expiration date of the existing WooCommerce subscription.
  • Cancel the user’s subscription in WooCommerce.
  • Disable WooCommerce Subscriptions when done with all users.

More info from Stripe about migrations.

(2) Linking the Stripe subscription to the user in Discourse

Once the user is set up with a subscription in Stripe, how can we add this existing user to a subscription plan in Discourse? This is needed to give the user the ability to cancel the subscription and to remove the user from the group if the Stripe payment fails.

(3) Reversing SSO to use Discourse as provider and WP as client

This part is described here.


I’m stuck on figuring out if #2 can be done and would love to hear if anyone has made this switch.

Can the rake task rake subscriptions:import be expanded or another task added to also import and link user subscriptions?

4 Likes

Thrilled to see that you’re doing this.

Yeah this isn’t something the plugin will be able to help with, however, you might be able to use the Stripe API to automate some of this if you have any programming skills. If not, the manual method might be the only way to go.

Just so I’m clear on your problem: you’ve created the subscriptions in Stripe and you want to backfill the access in Discourse? Is that correct?

I think there should be a way to do this via the rake task, but it’s not something I’m going to be able to tackle soon unfortunately. It would be pr-welcome though :smiley: You’d have to create a DiscourseSubscriptions::Customer record with all the appropriate information and then add the user to the group.

You could even run this manually from console, too:

DiscourseSubscriptions::Customer.create(
    user_id: <user id>,
    customer_id: <stripe customer id>
    product_id: <stripe product id>
  )
4 Likes

Yes. This will happen after the steps from (1) are complete, when the customer in Stripe is assigned a new subscription.

The customer exists in Stripe already (in my case) because WooCommerce Subscriptions creates a customer in Stripe with a membership purchase, so the relevant data exists - including the credit card info.

Could this be fed a csv file instead of doing it one by one?

I think this will be a big barrier for anyone with an established membership-based community, therefore we’ll see only new communities taking it up.

2 Likes

I’ll add extending the rake task to my list, but as I mentioned I have a pretty long backlog yet to work through!

Yeah it could. Ruby can read a CSV file and loop through its contents, so that would be entirely possible.

2 Likes

Perfect - thanks Justin. I understand and look forward to future developments. I’m planning this as a winter project because it would take a lot of manual steps in any case.

2 Likes

Congratulations, Justin! This is a huge accomplishment! I started playing with it yesterday and can’t wait to start using it. I’ll also start looking at ways to help migration folks from things like WooCommerce. It’s not clear at this point whether it could be a “simple” (ha!) rake task or whether it’lll be more like a forum migration in which every job is a snowflake (I expect it’ll be the latter).

4 Likes

Thanks a bunch Jay :hugs:

The trick is going to be getting customer information from Stripe into the Customer table in the plugin and matching it up. From there, it’s largely just adding group membership. But you’re probably right in that it’ll be unique each time.

3 Likes

At first glance it looks like Stripe has an email address, so the trick will be that they’ll have a different email address in Discourse. . . .

4 Likes

In addition to the email address, Stripe and WooCommerce Subscriptions also share the customer ID: cus_ABCdefxyz and the card ID: src_1234ABxyzasdf and transaction ID: ch_0123ABCDefgh

IIRC PMPro also shares the same.

The way to go in my opinion is to export a table from both apps and confirm they match up in a spreadsheet, then use that csv file as the source.

3 Likes

I’m curious if this ended up working out. I’m looking at helping a customer move from MemberPress and it seems like I’ll need to do something similar. I’d love to learn from anyone who has tried something similar.

1 Like

Mine is still in the “to-do” mode. Other projects seem to butt in and take priority. @pfaffman probably has some guidance.

2 Likes