Stripe Payment with SCA and Coupon

Enrolment ::: enrol_stripepayment
Maintained by DualCube Team
Now avail the much-awaited coupon functionality while enrolling students in Moodle courses using a Stripe payment gateway for paid courses with Strong customer authentication (SCA). Stripe Receipt sent to customers for any successful transaction. This plugin will help the admins and webmasters to offer their students a percent-off or amount-off discount for the paid courses. This plugin helps admins and webmasters use Stripe as the payment gateway.
Latest release:
1185 sites
57 fans
Moodle 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11

Stripe Payment: 

Introducing the newest offering from Team Dualcube: Stripe Payment!

Now avail the much-awaited coupon functionality while enrolling students in Moodle courses using Stripe payment gateway for paid courses with Strong customer authentication (SCA).

This plugin will help the admins and webmasters to offer their students a percent-off or amount-off discount for the paid courses.

Stripe Payment:

1. Registered users can login to the Moodle site and happily apply the promo codes for a discount before payment. On successful payment, they can access the course.

2. Admins and Webmasters, now, can create, manage and keep track of all promotional codes directly in their Stripe dashboard.

3. Strong customer authentication (SCA) implemented with 4 layers of complex security to comply with EU Revised Directive on Payment Services (PSD2) on payment service providers within the European Economic Area.

4. The first of it's kind to use Payment intent method for Stripe-coupon. 

5. Works with all stable versions of Moodle till v 3.8.1

6. Latest Stripe SDK

Stripe Payment Documentation:

This plugin has all the settings for development as well as for production usage. Its easy to install, set up and effective.

Creating Merchant Account :

1) Create account at

2) Complete your merchant profile details from

3) Now set up secret key and publishers key at

4) For test mode use test api keys and for live mode use live api keys.

Now you are done with merchant account set up.

Installation Guidance : 

Login to your moodle site as an “admin user” and follow the steps.

1) Upload the zip package from Site administration > Plugins > Install plugins. Choose Plugin type 'Enrolment method (enrol)'. Upload the ZIP package, check the acknowledgement and install.

2) Go to Enrolments > Manage enrol plugins > Enable 'Stripe' from list

3) Click 'Settings' which will lead to the settings page of the plugin

4) Provide merchant credentials for Stripe. Note that, you will get all the details from your merchant account. Now select the checkbox as per requirement. Save the settings.

5) Select any course from course listing page.

6) Go to Course administration > Users > Enrolment methods > Add method 'Stripe' from the dropdown. Set 'Custom instance name', 'Enrol cost' etc and add the method.

Adding coupons:

Go to your Stripe Dashboard >  Product > Coupons > Create a coupon.

Type in the coupon’s name: it can be anything and for your reference only.
Type in the Coupon’s ID : This is the Coupon code which your students will need to enter if they want to avail the discount.

Choose Coupon Type: 
1. Percentage discount : offers % off on the course price 
2. Fixed amount discount : Offers a fixed amount off on the course price.

Duration: For duration, when using the value repeating, also specify duration in months as the number of months for which the coupon should repeatedly apply. Otherwise the coupon can be set to apply only to a single invoice or to them all.

Redemption : The max_redemptions and redeem_by values apply to the coupon across every customer you have. For example, you can restrict a coupon to the first 50 customers that use it, or you can make a coupon expire by a certain date. If you do the latter, this only impacts when the coupon can be applied to a customer. If you set a coupon to last forever when used by a customer, but have it expire on January 1st, any customer given that coupon will have that coupon’s discount forever, but no new customers can apply the coupon after January 1st.

If a coupon has a max_redemptions value of 50, it can only be applied among all your customers a total of 50 times, although there’s nothing preventing a single customer from using it multiple times. (You can always use logic on your end to prevent that from occurring.)


This completes all the steps from the administrator end. Now registered users can login to the Moodle site and view the course after a successful payment of the discounted price. 


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4


DualCube Team (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Thu, Sep 30, 2021, 10:52 PM
    Hi Conrad, please do follow our updated documentation
    Here you can see a new section on how to create the token. Make sure you have configured each step as per our documentation. Let us know if this fixed the issue.
  • Mon, Oct 4, 2021, 1:45 PM
    hi DualCube Team, currently, I already set up this plugin correctly. But I encountered very annoying bugs.
    - Firstly, as soon as I complete the payment, I get redirected back to my site. However, it displays a message showing that "Thank you for enrolling in the course, unfortunately, the payment wasn't successful." But as soon as I click the Continue button. I get redirected to the course with the "successful enrolment" status. I don't know why this happens.
    - Secondly, as I wanted to double-check the error in Test Environment, I set up my test key provided by Stripe. Anyhow, as soon as I completed my purchase, it shows that
    Something else happened, completely unrelated to Stripe "debuginfo": "Only arrays\/objects accepted. The bad value is:''"

    Therefore, it's impossible for me to debug.
    - Moodle Version: 3.11 (latest)
    - enrol_stripepayment: 3.3.0
  • Wed, Oct 6, 2021, 7:48 AM
    The "something else happened" error results from requesting a transaction in the production environment with a customer id created in the test environment or vice versa. When the stripe plugin requests a stripe customer id for a new login (email address), it stores it in the enrol_stripepayment database table and uses that id for subsequent transactions.

    This means if you switch from stripe production environment to test environment, you either have to use a different login or you have to manually delete the database table row for that user (email address).
  • Thu, Oct 7, 2021, 9:17 PM
    Hi Jim, we are testing the plugin with the updated version of Moodle. We will soon release an update.
  • Fri, Oct 8, 2021, 9:47 AM
    I'm also getting the "something else happened" error. I'm still getting this error when testing with a new Moodle account and email address. The only common element is the credit card number. Could you please investigate further and advise? Thanks very much. (Really hoping for a timely solve so I don't have to use the PayPal alternative!) smile
  • Fri, Oct 8, 2021, 11:35 AM
    Shane, login to your stripe account and click on the "developer" tab. You will see under "API requests" the number of failed requests. If you click on that you can see the actual requests and the errors they generated from the stripe side. This will typically give you an idea of why it was rejected.
  • Fri, Oct 8, 2021, 12:52 PM
    @jim, we will look into this. We have created a git issue for you to track
  • Fri, Oct 8, 2021, 1:10 PM
    Thanks @DualCube Team. Thanks @Jim Crammond. I've identified the problem customer ID and deleted the 2 x rows pertaining to that customer from the mdl_enrol_stripepayment table... I hope that was correct. I'll let you know once the user has retested.
  • Wed, Oct 13, 2021, 4:42 PM
    Hi Dualcube.

    As I described before in emails we have a significant issue with Stripe payments after updating the plugin to the latest version, 3.3.0.

    Since then,
    1) Users are charged multiple times for the same product;
    (Course payments are stuck and/or multiplied in Stripe, it’s not clear have they gone through since Stripe claims our platform is hanging in the JotForm webhook and not providing/completing information (apologies if this is not 100% correct summary). Users just see multiple charges to their credit card for one course and obviously are dissatisfied.)
    2) Product name disappeared in Stripe transaction details (there is ID shown instead);
    3) (FIXED) we have lost a field where users could enter their coupon code.

    Have you had a chance to look into the problem? I've submitted admin account credentials In my email to as you asked. Could you please advise what we can do to solve this soonest?
  • Thu, Oct 14, 2021, 5:58 PM
    Hello Dualcube. We are very happy with the plugin... however lately we have an issue with Stripe payment showing as incomplete? Stripe suggested it was an issue between Moodle Plugin and Stripe integration. Your help would be very appreciated. Just started two days ago. Here is the message from Stripe

    PaymentIntent status:
  • Wed, Oct 20, 2021, 5:42 PM
    Hello, I hope you guys are doing fine. I want to know that if there is certain way of renaming this plugin. I want to rename it for my Moodle site. I tried already but it gave some kind of xml errors. I guess you guys can help. Thank you.
  • Wed, Nov 3, 2021, 8:15 PM
    Hi @Mohed, can you please explain the query a bit more i.e. what are you referring to as renaming this plugin?
  • Wed, Nov 3, 2021, 8:16 PM
    Hi Alexis, sorry to hear that.

    Can you please share a video of the whole payment flow on your end, so we can help you out.
  • Thu, Jan 13, 2022, 9:35 PM

    I'm having the same problem that others are having. I recently installed the plugin and it worked fine in test mode but when switching to live mode it generates an error. I've deleted the test customers but still receiving an error. Here is the process. BTW, I tried posting screen shots, but flagged me as spam, so I'm unsure how to provide you additional information.

    1. I initiate a buy now from my Moodle instance

    2. It successfully pulls up a stripe payment page

    3. I enter payment information which succeeds on Stripe's side

    4. Stripe redirects back to Moodle at the following at my site

    Which provides the following response
    "Something else happened, completely unrelated to Stripe{"exception":"invalid_response_exception","errorcode":"invalidresponse","message":"Invalid response value detected"}"

    5. I can't post the response code from Stripe because of the number of URLs. I'll try posting in a different message with the url suppressed.
  • Thu, Jan 20, 2022, 8:23 PM
    My strip accept payment but stiudents can not get access to course. Following error appears:-
    Access to was deniedYou don't have authorization to view this page.
    HTTP ERROR 403
Please login to post comments