5

In addition to ‘What is the current landscape regarding e-commerce plugins for Craft?’, I’m looking for current options for setting up membership subscriptions.

I have a site in development that was using the ‘Commerce’ and ‘Membership’ plugins from Dukt (private beta) but unfortunately they no longer appear to be available.

The basic requirements would be for a user to signup, pay for membership (ideally through Stripe in this case), which then automatically assigns users to different membership groups depending on their subscription level/status when appropriate (e.g. full, trial, expired, etc).

  • I'd like to know this too, have a potential project coming up that would do something like this. – hamishtaplin Feb 5 '15 at 15:19
12

I don't think that there currently is a plugin option right now, but keep an eye on the craft plugin page. However, given your requirement to "automatically assign users to different membership groups", I think you would need to write your own regardless. That is pretty specific and would require that you have your user groups set up to match the subscription plans.

I recently did something similar for a project. Saving for a few issues with javascript and learning the API for stripe it was fairly straightforward. It is currently a bit hard-wired to the specific project, however — I still need to abstract it so that it's more portable. I would be glad to share some tips, if you are up for writing your own.

stripe subscription plugin - custom field type

The process that I'm using is to store the StripeCustomerId in the custom fieldtype. As far as craft is concerned that's all just 1 field, that is auto-generated and never exposed to the client (i.e. they can't edit the 'stripeCustomerId').

Whenever an 'account' (could also be 'user') is created, I use the onSaveUser event to generate and store a StipeCustomerId. The rest of the field just sends calls to stripe to add card, delete card, create subscription, cancel subscription, etc. via service methods, and then refresh itself with the most up-to-date customer data from Stripe (doesn't ever store this info, just the customerId).

Besides this the only thing that you would need to add is to reassign the userGroup based on the plan selection. However, if you want to ensure that the userGroup is always synced with the Stripe account (i.e. if the client, for example, canceled the subscription directly from their Stripe account), you would probably need to create a webhook to trigger the userGroup re-assignment. Or instruct them to always re-save the user in craft afterwards.

| improve this answer | |
  • Massively helpful Douglas, thanks! I’m hopeful someone will release a supported plugin soon but as I need to tackle this over the next few weeks, I’ll have to try writing my own. – James Feb 5 '15 at 21:01
  • @James I successfully decoupled the plugin I was working on from the project and made it stand-alone, as well as adding some polish. Email me if you want to take a look at an alpha version. Email should be in my profile. – Douglas McDonald Feb 13 '15 at 16:29
  • Thanks Douglas. Can’t find an email on your profile, can you point me in the right direction. – James Feb 13 '15 at 19:42
  • Hi Douglas. I'm interested in this too. How is it going? – Clive Portman Jul 15 '15 at 5:28
  • I might be interested in this too. Is there contact info for Douglas anywhere? – Tyssen Aug 31 '15 at 4:29
0

Would it be possible to initiate the payment first, and then have stripe send an email/receipt that routes the individual to complete the signup from a registration page that assigns all people who register from that page to the appropriate group?

Let Stripe do the heavy lifting...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.