Enrolment: Stripe Payment with SCA and Coupon

Maintained by Picture of DualCube TeamDualCube 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.
930 sites
47 fans
Current versions available: 3

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 https://stripe.com.

2) Complete your merchant profile details from https://dashboard.stripe.com/account.

3) Now set up secret key and publishers key at https://dashboard.stripe.com/account/apikeys.

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


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

Comments RSS


  • Picture of IRVIN BAHAN
    Mon, Dec 14, 2020, 7:41 PM
    can we add alipay payment in this stripe api you have?
  • Picture of Carlos MP
    Sat, Dec 19, 2020, 3:08 AM

    @DualCube Team,

    Hello we are having troubles in version 3.2.1 (moodle 3.9) with this module when we try to apply a coupon discount, it doesn't do anything (Result: error 404 ). In debugging mode the post call says:

    Excepción - No such coupon: 'FELIZNAVIDAD'
    Más información sobre este error
    Información de depuración:
    Error code: generalexceptionmessage
    Trazado de la pila (stack):
    • line 38 of /enrol/stripepayment/Stripe/lib/Exception/ApiErrorException.php: Stripe\Exception\InvalidRequestException thrown
    • line 37 of /enrol/stripepayment/Stripe/lib/Exception/InvalidRequestException.php: call to Stripe\Exception\ApiErrorException::factory()
    • line 180 of /enrol/stripepayment/Stripe/lib/ApiRequestor.php: call to Stripe\Exception\InvalidRequestException::factory()
    • line 142 of /enrol/stripepayment/Stripe/lib/ApiRequestor.php: call to Stripe\ApiRequestor::_specificAPIError()
    • line 428 of /enrol/stripepayment/Stripe/lib/ApiRequestor.php: call to Stripe\ApiRequestor->handleErrorResponse()
    • line 113 of /enrol/stripepayment/Stripe/lib/ApiRequestor.php: call to Stripe\ApiRequestor->_interpretResponse()
    • line 64 of /enrol/stripepayment/Stripe/lib/ApiResource.php: call to Stripe\ApiRequestor->request()
    • line 26 of /enrol/stripepayment/Stripe/lib/ApiOperations/Retrieve.php: call to Stripe\ApiResource->refresh()
    • line 58 of /enrol/stripepayment/validate-coupon.php: call to Stripe\Coupon::retrieve()

    Any ideas? thanks and regards
  • Picture of Motif Class
    Sat, Dec 19, 2020, 3:50 AM
    My issue regarding the coupon not fully registering was solved here: https://github.com/dualcube/moodle-enrol_stripepayment/issues/57
  • Picture of Christian Cuzzoni
    Tue, Dec 29, 2020, 6:04 PM
    First I want to say thanks to you for this plugin. Second I have set up the stripe payment method for my moodle, but everytime I try to pay I receive this error message:

    Sorry! Your transaction is failed. Kindly contact your system administrator.

    Just to give you more hints:
    - In my moodle I already integrated PayPal that now is working.
    - For the tests with real payments I'm using an AMEX.
    - The value of the payment is 0.10 €

    Kind regards!
  • Picture of Morris Cerullo
    Wed, Dec 30, 2020, 11:35 PM
    Hi there.
    We had some pretty extensive customization done to the plugin that DualCube performed. We have been trying to get in contact with you through our regular contact, Suman, but have received no response for the last 3 months, despite repeated attempts. How can we get in contact with you to have our plugin updated?

    Thank you.
  • Picture of SOURADJOU Soliou
    Tue, Jan 12, 2021, 4:28 PM
    Hello, I'm From Benin, I suprisly don't found my currency wich is on of the largest currency in Africa. The : Franc CFA (XOF)
  • Picture of DualCube Team
    Thu, Jan 14, 2021, 2:53 PM
    Hello @Christian Cuzzoni,

    Thanks for sharing the concern with us. Every currency have their own minimum transaction limit imposed by Stripe. Your amount was lower than that. Kindly check the video for further information regarding the same.

  • Picture of DualCube Team
    Thu, Jan 14, 2021, 8:48 PM
    Hi @Morris Cerullo,

    Apologies for the delayed response. Would request you to please share the details at admin@dualcube.com.

  • Picture of DualCube Team
    Thu, Jan 14, 2021, 8:55 PM
    Hi @Kenny McCormack,

    Apologies for the delayed response.

    While testing the plugin with Finland card from our end, we could not find any issue.
    Below is a video showing that Finland cards are also working.

    Please refer the video- https://www.loom.com/share/9ca03c5ccc654e069449f3e4bd77ef1f
  • Picture of SOURADJOU Soliou
    Thu, Jan 14, 2021, 9:42 PM
    @DualCube Team,
    Please Help me add Francs CFA currency to your plugin.
    This is a great Job
  • Picture of DualCube Team
    Thu, Jan 14, 2021, 11:52 PM
    Hello SOURADJOU Soliou,

    Thanks for your request, will add that on our next release.
  • Picture of DualCube Team
    Fri, Jan 15, 2021, 12:16 AM
    Hello IRVIN BAHAN,

    Thanks for getting in touch with us, I am afraid, we don't have Alipay support currently.
  • Picture of DualCube Team
    Fri, Jan 15, 2021, 12:18 AM
    Hello Motif Class,

    We already updated your ticket. you can check it from GIthub.
  • Picture of DualCube Team
    Fri, Jan 15, 2021, 12:24 AM
    Hello Carlos MP,

    Did you created the coupon already via Stripe?
  • Picture of DualCube Team
    Wed, Jan 20, 2021, 10:25 PM
    Hi @Shane Leonard,

    Thank you for your valuable input. Yes, this feature is already in our planning list for the Pro version.

Please login to post comments