Subscriptions: Allow users to purchase one-time products multiple times

So I’ve created a “CreateServer” product that will (one day) let someone purchase a Discourse installation. It adds them to the CreateServer group. When someone creates a server, it removes them from the group. That’s all good.

But if someone wants to get a second server, they can’t because they have already purchased the product. Is there a way to allow purchasing the same product multiple times? Or, perhaps my solution is to have the plugin modify the record that they purchased the subscription, and then they can buy another. It’s already removing them from the CreateServer group after they do the installation. . .

Something like

product=DiscourseSubscriptions::Customer.find_by(user_id: 2, product_id: create_server_id)
product.product_id: 'install fulfilled'
product.save

That’ll let the user buy it again. Do you think it’ll break something else?

3 Likes

If you’re using one-time payments, it shouldn’t break anything to change the product id, except the ability to see payment history.

I’d be open to adding the ability for users to purchase one-time purchase products more than once though.

5 Likes

How hard is that? I was somewhat surprised by this. If someone able to, say, purchase a new subscription for one that expired previously?

3 Likes

Repeated one-time buy would be great… This would kind of minimise the need for currently non-existing Subscriptions: Pay What You Want Support … Or maybe there is opportunity to merge those two features? :slight_smile:

2 Likes

Jay, is this also the case if the first subscription is cancelled and they come back later to re-purchase the same thing? I.e. monthly subscription was cancelled after one cycle and the customer comes back next year.

1 Like

No - once the subscription is cancelled and processed by Subscriptions, they can come back and purchase it. If they have an active subscription yet (though recurring billing may be cancelled), they will not be able to do so.

3 Likes

So then could the one-time purchases then just be automatically marked as non-active?

1 Like

One-time purchases are an entirely different mechanism in Stripe, so I’ll have to take a look. I do have an idea, but most of my plugin work is put on hold until after the new year.

5 Likes

Ah! That explains it. I haven’t had time to look carefully as my plugin has a zillion other moving pieces that I also don’t understand.

I don’t want to have anything to do with that not being true! :christmas_tree: :tada:

5 Likes

Hey Justin. I’m poking at this again. In practice, few customers have purchased multiple installs, so I decided to not worry about multiple purchases. But then I realized that testing whether purchasing a server installation is difficult if a user can do it only once. . .

So it appears that serialize_product is what determines if a product is subscribed, which determines whether you can purchase it.

I guess what needs to happen here is to have subscribed not get set to true of the product that they have purchased is a one-time product? It’s not immediately clear to me how to do that, as it looks like that information is at least a table-join away (or maybe another request away?).

What I’ve done for now is hacked the templates to just always show the payment link/button (something like {{#if product.subscribed_JP_disabled}}), and that’s allowing me to make multiple purchases, for what it’s worth.

5 Likes

Cool - it’s on my list but I have a few other higher demand features in store first, namely coupons.

5 Likes

Hi there,

I’m also very interested in this feature. Looking forward to the update! :wink:

3 Likes

Thanks for your vote and happy cakeday!

It’s on my list for the near future :slight_smile:

6 Likes