ディスコース購読を一度限りの支払いに強制する

Regarding the Discourse Subscriptions plugin, what would happen if I changed some settings from Stripe itself? For example, from Discourse it’s not possible to make a plan for a product a one-off payment. It has to be a day, week, month, or year-long subscription. But if I go into stripe.com I can change an existing subscription to a one-off payment. Can I do this? How would this change how that plan functions in Discourse? Would it then be a one-off payment?

It most definitely is possible! If you uncheck the recurring checkbox in the plan creation screen, it will be a one time payment.

However, you cannot change existing plans once they’re created.

「いいね!」 2

You’re right! I had a brain fart. What I actually meant to ask is whether it’s possible or not to have a one-off payment that terminates, and doesn’t go on indefinitely. For example, something like a “day-pass,” where you pay $5 and are put into a special group, and then after, say, a day, the subscription terminates and you’re then eliminated from the group until you pay again. Is this possible?

It is not at this time, unfortunately.

「いいね!」 2

I do something like that in a plugin. I (loosely) add to the user_group model an action that when a user is added to the subscription group, does an action, and then removes the user from the group. In your case, you’d make it so when the subscription added the user to the one-off-weeklong group it would

  • add the user to the weeklong group that gives permission to whatever categories
  • add a job that will delete them from the weeklong group when the week is up
  • add a user custom field with the date the week started so you could delete them if you have some redis disaster
  • remove them from the one-off-weeklong group.

If you’re interested in such, you can contact me or post in marketplace .

「いいね!」 3

しかし、それは愚かです。代わりに、サブスクリプション(サブスクリプションの場合)または顧客(一括払いの場合)のコールバックを追加するだけです。顧客は一種の誤称です。ストライプの顧客IDとストライプの製品IDが含まれています。したがって、次のようなことを行います。

add_model_callback(DiscourseSubscriptions::Subscription, :after_save) do
      Rails.logger.warn("Now got a subscription #{self.external_id} for #{self.customer_id}")
      # do stuff
end

  add_model_callback(DiscourseSubscriptions::Customer, :after_save) do
    Rails.logger.warn("Customer #{self.product_id} for #{self.user_id}")
    # do more stuuff
end
「いいね!」 1

この問題は解決しましたか?

さらにガイダンスを提供していただけますか?この機能の実装方法など。Railsには詳しくありません。よろしくお願いします!

それが私の最高の無料回答だと思います。

「いいね!」 3

ディスコースサブスクリプションプラグインを修正して解決しました。ありがとうございます。

しかし、元のディスコースサブスクリプションプラグインを使用しても、製品を削除できないことがわかりました。何かお考えはありますか?

削除する必要はありません。何も害はありません。販売したものの記録として必要です。Stripeコンソールから削除できるはずです。

「いいね!」 2

Stripe では、商品を削除することもできませんが、非アクティブ化/アーカイブすることはできます。

彼らは次のように述べています。

「いいね!」 2

これはまだ達成したいことなのか、それとも何か方法を見つけられたのか分かりません。Discourseに自動化された機能ではないようですが、他の方法があるかもしれません。毎日新しい飲み物を買ってテーブルに座る必要があるコーヒーショップのような取引に似ています。

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.