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

**URL:** https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732
**Category:** Feature
**Tags:** subscriptions
**Created:** [December 17, 2020, 11:32pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732 "2020-12-17T23:32:13Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 17, 2020, 11:32pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/1 "2020-12-17T23:32:13Z")

</div>

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

```ruby
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?

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [December 18, 2020, 3:30pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/2 "2020-12-18T15:30:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 18, 2020, 3:32pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/4 "2020-12-18T15:32:26Z")

</div>

> [@Discourse Subscriptions Plugin](https://meta.discourse.org/t/discourse-subscriptions-plugin/140818/273):
>
> I’d be open to adding the ability for users to purchase one-time purchase products more than once though.

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

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [December 18, 2020, 7:43pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/5 "2020-12-18T19:43:57Z")

</div>

Repeated one-time buy would be great.. This would kind of minimise the need for currently non-existing [Subscriptions: Pay What You Want Support](https://meta.discourse.org/t/subscriptions-pay-what-you-want-support/169008) .. Or maybe there is opportunity to merge those two features? 🙂

---

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [December 18, 2020, 7:56pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/6 "2020-12-18T19:56:52Z")

</div>

> [@pfaffman](#):
>
> if someone wants to get a second server, they can’t because they have already purchased the product.

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.

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [December 18, 2020, 8:00pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/7 "2020-12-18T20:00:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 18, 2020, 8:11pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/8 "2020-12-18T20:11:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [December 18, 2020, 8:17pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/9 "2020-12-18T20:17:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 18, 2020, 8:21pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/10 "2020-12-18T20:21:36Z")

</div>

> [@justin](#):
>
> One-time purchases are an entirely different mechanism in Stripe

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.

> [@justin](#):
>
> most of my plugin work is put on hold until after the new year.

I don’t want to have anything to do with that not being true! 🎄 🎉

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 7, 2021, 5:40pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/11 "2021-01-07T17:40:02Z")

</div>

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.

> <https://github.com/discourse/discourse-subscriptions/blob/main/app/controllers/discourse_subscriptions/subscribe_controller.rb#L127-L134>

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.

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [January 7, 2021, 5:41pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/12 "2021-01-07T17:41:42Z")

</div>

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

> [@Subscriptions: Coupon Support](https://meta.discourse.org/t/subscriptions-coupon-support/169006):
>
> Is there a way to use Stripe “coupons” ?

---

<div class="post-metadata">

### Author: ![thethirdpudding](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thethirdpudding/32/86901_2.png) [@thethirdpudding](https://meta.discourse.org/u/thethirdpudding)
#### Post date: [January 8, 2021, 3:38pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/13 "2021-01-08T15:38:11Z")

</div>

Hi there,

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

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [January 8, 2021, 3:45pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/14 "2021-01-08T15:45:05Z")

</div>

Thanks for your vote and happy cakeday!

It’s on my list for the near future 🙂

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [January 20, 2021, 8:09pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/15 "2021-01-20T20:09:35Z")

</div>

PR is up for this here:

[https://github.com/discourse/discourse-subscriptions/pull/46](https://github.com/discourse/discourse-subscriptions/pull/46)

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [January 31, 2021, 8:17pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/16 "2021-01-31T20:17:56Z")

</div>

Sorry for the delay but this is now merged!

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [January 31, 2021, 8:17pm UTC](https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/17 "2021-01-31T20:17:59Z")

</div>


