Stripe Donations Plugin

Note: the most recent fork of this plugin can be found here: https://github.com/chrisbeach/discourse-donations.git, but this is no longer actively maintained by @chrisbeach

We’ve built a plugin for accepting donations via a Stripe account!

Installation instructions are in the README.

You’ll need to create a Stripe account and add your API keys to the plugin settings.

This ads a button to the main navigation page which takes the user to a Stripe payment form.

Update: There is a new lighter, similar version of this plugin here: https://github.com/rimian/discourse-subscriptions

27 Likes

Any plans on automatically add a user that donated to a group? This would be good for adding a badge right to its image profile or upping them to a certain level.

10 Likes

PR submitted (italian translation).

2 Likes

Sounds great! Is there a forum with this plugin enabled so I could see it in action?

Also, any plans to allow markup in posts to render a Stripe checkout button? That would be really useful for my forum.

2 Likes

Yes, that’s something I plan to work on soon.

2 Likes

I only have it running on our staging server at the moment. I’ll let you know when we ship it. I’d love to hear of anyone else using it!

2 Likes

I’ve released a new feature:

The user can be added to a group or awarded a badge if the transaction is successful. You’ll need to create the badge and group then configure that in the settings.

12 Likes

Hi Rimian, how’s the Stripe plugin coming along?

When it’s ready for live use, I’d like to use it to take payments for posts from local businesses. It would replace the cumbersome way we currently take payments for commercial posts.

Your work could make my forum more profitable, and I really appreciate your efforts :thumbsup:

I am interested as well!

1 Like

Hi @rimian,

I tried installing the plugin but my forum wouldn’t start with the plugin installed unfortunately. The unicorn logs contain a “method not found” error.

I have raised a Github issue with the full log output

If you are no longer maintaining the discourse-donations plugin (that is, if I don’t hear back on this issue), I will attempt to fix the plugin on my fork of it: https://github.com/chrisbeach/discourse-donations

My original reason for forking the discourse-donations plugin is to add markdown support for creating Stripe Checkout buttons:

With my changes, Stripe checkout forms can be added to forum posts using markup:

[stripe amount=999 image=/img/someImage.png]
    Widget
[/stripe]

Which renders as:

<form action="/charges" method="POST">
    <script 
        src="https://checkout.stripe.com/checkout.js" 
        class="stripe-button"
        data-key="pk_test_6pRXXX"
        data-amount="999"
        data-name="Your Shop"
        data-description="Widget"
        data-image="/img/someImage.png"
        data-locale="auto">
    </script>
</form>
3 Likes

Hi Chris,

Unfortunately I am no longer working on this project.

It sounds like a rails 5 issue. Keeping up with discourse upgrades was always an issue.

I recommend forking, yes. I might be able to merge that back in.

Kind regards,

Rimian

@rimian, thanks for responding. I have fixed the Rails issue in my fork:

https://github.com/chrisbeach/discourse-donations/commit/340959c73b797e56e4d08d49cfa9eb456f48701a

Note that in this commit I also changed the README.md so that the TravisCI link points to my repo - if you take my changes, you will want to avoid the README.md change.

I’m now trying to get my Stripe Checkout button working… I’m nearly there!

3 Likes

Is discourse-donations no longer maintained by choiceaustralia?

If so, and the plugin is owner-less, I can give it some TLC from my fork, and would be open to PRs from other contributors.

3 Likes

@ChrisBeach Nice work! I had a quick look at this because I’m thinking about adding a donate button to my sandbox.

If you’re still working on this, maybe we can work in this together?

Here’s a couple of small changes.

https://github.com/chrisbeach/discourse-donations/pull/2

One bigger change to be made is that we need to store the stripe customer id in a UserCustomField so it can be used when charging repeat donors. Currently, every new transaction from the same user is creating new duplicate stripe customers.

The time to store it would be after the creation of a new customer in the stripe service (which should also be a separate method, so it doesn’t need to be repeated in each different type of charge).

*edit. Also, it doesn’t look like the plugin is dealing with the Stripe transaction fee explicitly atm? I once did a Stripe WP integration for a charity. We found it best to explicitly tell the donor what the transaction fee was and ask them whether they wanted to cover it (most people do). The formula to calculate the transaction fee (by itself) is:

Fee($) = ((Donation  + .3 )  /  (1 - {Regional Percentage})) - Donation

If you’re wondering why it’s not just Donation x Regional Percentage (e.g. 2.9%) + Fixed fee (i.e. 30c), it’s because the amount you charge the donor as the transaction fee is applied to whatever total is charged from the donor’s card.

For example, if the donation is $100 the basic Stripe formula would tell us that the transaction fee is $3.2 (in the US):

3.2 = 100 x 0.029 + 0.30

If you then charge the donor $103.2, Stripe will actually apply the transaction fee to $103.2, not $100. This results in an actual transaction fee of $3.2928, leaving the donee with $99.9072 rather than $100. This difference is inconsequential with smaller sums, but not insubstantial with larger donations.

6 Likes

Delighted to benefit from your plugin writing experience @angus :+1:

I have made you a collaborator in GitHub so you should be able to commit directly to the repo in future.

The proposals regarding storing the Stripe Customer id, and making transaction fees visible to the donor so they can choose to cover them - both sound good to me.

Separately, I’m working on an another Discourse plugin that uses Stripe. This plugin will store transactions from forum users in the database, and allow the balance to be spent on pinning topics.

It’s slow going as I’ve decided to properly learn Rails and Ruby first, and coming from the comfortable statically-typed Java/Scala world, it’s quite a change!

6 Likes

Awesome thanks. I’ll add some more improvements via PRs if I have the time. PRs are still the way to go I reckon just to make sure you’re in the loop.

You mean people will pay money into a balance? Maybe a balance they see in their profile?

Neat. What kind of topics are they? Are folks advertising stuff?

Let me know if you get stuck with the Discourse codebase.

1 Like

Yup, on my local community forum, residents can post all they like, but I charge businesses if they want to create topics:

https://se23.life/t/how-to-pay-for-promotional-topics-current-cost-12/525

The process is embarrassingly manual at the moment. I’m hoping Stripe integration will encourage businesses to promote on my forums.

1 Like

Absolutely, yes. There will be a page of transactions (money in via stripe and money out via pinning promotional topics). Important to track all actions in an “accounting” style so the balance can be reconciled.

The balance can be shown on the header for the benefit of the user and admins.

There may well be other forum features that businesses are willing to pay for too.

1 Like

Funnily enough I spent 6 years of my childhood very close to Forest Hill. We lived on Madeira Road in Streatham. I was about to start at Dulwich College, then we moved back to Aus…maybe a story for a separate topic :slight_smile:

Yeah, this is pretty key. Perhaps there’s a way to outsource the tracking of individual accounts to Stripe and just have get/push endpoints in the app itself.

3 Likes

We’re a community run by a not-for-profit that accepts donations. Would love to hook up Stripe such that donations are reflected on a user’s profile, and showcased separately in a “contributors page”.

For example something like this sponsors page:

We don’t really have any need for the user to have access to restricted features or services – just a way of automatically recognising the financial contributions of members of our community.

I envisage that the customer email in Stripe would marry up with the email of the user in Discourse.

I imagine it would be useful to have some additional fields in the Discourse user profile such as:

  • an optional Stripe customer email; to capture the scenario where the user’s Stripe email is different to their forum email
  • an optional Contributor Title; so that the contribution can be listed under an alternate label to the user’s name; for example, some contributors prefer to have their company listed as the contributor
  • an optional flag to keep the contribution anonymous

Would this plugin ever come close to this goal? ie. should we be collaborating here or developing something separate

3 Likes