Is adding subscriber to group compatible with Stripe's pricing table?

Using the Subscriptions plugin with Stripe’s Pricing table, is it still possible to add subscribers to groups?

I’ve switched to using Stripe’s Pricing table to list my products, instead of the Subscriptions plugin. Subscribers are no longer added to my specified User group (for the original Discourse-created subscription, since added to my Pricing table). New products created in Stripe also aren’t appearing in the Discourse subscriptions plugin, as I thought they did before I switched to the Pricing table.

Is the expected behaviour, or have I broken something along the way?

If it’s expected, can I help add a line to the plugin guide, to highlight the consequences of switching to the Pricing table?

I will dig into the advice on webhooks & integration, but any pointers on how to automate adding subscribers to a group greatly appreciated :pray:

Thanks

1 Like

Yes, but you need to make sure you have created the products from discourse not from stripe.

Creating the product from discourse first:

Once you have created the product in discourse you then will create a plan for it where you specify the price as well as the group:

Then from stripe when you create the pricing table, you must select products only created from discourse:

Then when a user subscribes they will be added to the chosen group:

2 Likes

And if you have things that you didn’t create with Discourse that you want Discourse to know about (and you’re self-hosted) you can try rake subscriptions:subscriptions_import

2 Likes

Thanks for this detailed response, @blake ! I’ll set up the products and plans in Discourse, and mark this as the solution once tested

It looks like the coupons & promotion codes transfer happily between Stripe and Discourse. My final test is whether the integration still behaves after I add a description and marketing features to the product in Stripe (to populate the pricing table)

1 Like

Thanks for the additional hint, @pfaffman :smiley:

1 Like

Someone purchased my Discourse-created product+plan over the weekend, and they were not added to my specified group. So it seems that editing the product+plan in Stripe after creating it in Discourse somehow breaks this integration

I’ve also just tested this myself by buying a subscription, and I’m not added to the specified group

If anyone can advise how to test this further to figure out where things go wrong, I’m happy to do so

I’m also going to investigate other ways of integrating Stripe payments with Discourse

1 Like

Sorry this still isn’t working :thinking:

Good thing you mentioned this, I think there may be a separate issue with one-off payments. I just tested it locally and I’m seeing an error with the webhook call likely causing it to not add the user to the group or have the transaction show up in the user’s billing page.

I’ll see if I can come up with a code fix so that future transactions will work.

2 Likes

Okay, I’ve created a code fix for this issue. If you update your subscriptions plugin to the latest version it should work for all new one-off payments with the pricing table.

1 Like

Brilliant! Thanks for the quick fix :smiley:

I’ll test it myself and with customers, and mark this as the solution once I’m confident it’s working as expected

1 Like

I’m sorry to report that your code fix hasn’t solved the problem. I’ve had four purchases from two separate customers since the update, and none were added to groups. I also cannot see any payments or subscriptions on their billing pages

I believe the code fix has changed one thing - the products I created in Discourse since updating the Subscriptions plugin are now tagged with the metadata repurchaseable: false in Stripe. However, the product created before the code fix hasn’t had that metadata added (it has been purchased)

Let me know what I can do to help diagnose the issue!

First of all congrats on all the sign ups you are getting, that is pretty cool! Sorry things still aren’t working quite right with the subscription plugin though. In my local setup users are added to groups once they sign up, so I know it can work. I’ll do some more digging, and then send you a PM to ask about some details of your setup so that we can get to the bottom of this.

2 Likes

Okay I was able to replicate your issues in a production environment I setup to test out the plugin. I know the first thing to fix is to add checkout.session.completed as a event for your existing webhook.

If that is missing Stripe won’t send the Pricing Table checkout info to Discourse.

That should be all you have to do, but there may be another code fix I need to make which I’m currently digging into.

2 Likes

Hi Blake,

I got the same issue. After purchasing which is shown successfully in Stripe the update user does not work:
image

Hope you can help!

Thanks a lot in advance!

1 Like

Thanks for digging into this further, Blake. I’ve updated my Stripe webhook to add checkout.session.completed

I’ll be back when I have news of success/failure!

Note to self - find webhooks at https://dashboard.stripe.com/webhooks/. I first installed the Subscriptions plugin several years ago so was a bit rusty on the setup…

Stripe tells me that there have been No webhook attempts in the past 15 days so there’s obviously a block in communications somewhere

On your webhooks page do you have a URL like https://your-discourse-site/s/hooks?

Also you will need to make sure the Signing secret for the webhook matches what you have in Discourse:

I’m not sure if this is a question for me or @marpoe , but yes - I have the correct Discourse url in Stripe, and the correct Stripe secret in Discourse. I know the webhook is mostly working because Stripe creates products & plans in response to me setting them up in Discourse :smiley:

Adding the checkout.session.completed event to the webhook worked! :partying_face:

I just did a test purchase, and my user was successfully added to the group

Thank you for the time and thought you put into fixing this bug with one-off payments

3 Likes

This worked for me, too! Thanks a lot!

1 Like