Stripe Payment with SCA and Coupon

Enrolment ::: enrol_stripepayment
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.
Latest release:
1062 sites
544 downloads
48 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. 


Screenshots

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

Contributors

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

Comments RSS

Show comments
  • Picture of Jim Crammond
    Thu, Jan 28, 2021, 2:46 PM
    Regarding making coupons specific to courses. One way to do this could be to add the coursename or courseid as metadata to the coupon in Stripe and then have the plugin match that to the coursename /id when it is checking to see it is valid in validate-coupon.php
  • Picture of Jim Crammond
    Sat, Jan 30, 2021, 4:14 AM
    @DualCube Team,

    There is an issue with coupons that can lead to users getting enrolled into courses for free. The issue is with coupons that become invalid, e.g. due to reaching max number of redemptions. In the case where a coupon exists but is not valid, the code in validate-coupon.php returns nothing, which is then treated as zero cost in enrol.php. You then get the button to Enrol straight into the course.
    I have a fix for this if interested
  • Picture of Kris Si
    Mon, Feb 1, 2021, 4:29 PM
    Hi everytime i try to pay via Stripe i get the following error:
    Fatal error: Can't use function return value in write context in /.../enrol/stripepayment/charge.php on line 47
    Please advise?
    Moodle 2.7
  • Picture of Vitalii Lu
    Mon, Feb 15, 2021, 10:09 PM
    Hello @DualCube Team,

    Could you advice how to solve the issue? We have the stripe plugin on the Moodle Workplace (Synergy Learning hosted). But the payment form doesn't work. It is possible to fill in with card details (number, valid date, CVC), but nothing happens on the Submit button click.
    At the same time, Stripe support reported they don't receive any transactions.

    Moodle Workplace 3.9.1+ (Build: 20200727)
    Stripe Payment plugin 3.0 (Build: 2020013100) 2020072200

  • Picture of SOURADJOU Soliou
    Sat, Mar 13, 2021, 2:12 PM
    Hello, Dual cube
    , thanks for your answer, Any news about the next release?
  • Picture of Nik Bernaz
    Wed, Mar 24, 2021, 9:56 PM
    Hello. I am using the latest Moodle install (3.10.2) and I can get the transaction through Stripe without problem, but I cannot add a coupon (already created on Stripe), as clicking the APPLY CODE button does nothing. It does not tell me when the coupon is correct, and if I use a random one, it does not give me an error message either. Any ideas ?
  • Picture of Jim Crammond
    Sun, Mar 28, 2021, 11:45 PM
    Nik, if you go into Stripe and into the Developer->Logs section you should see if any attempt at applying the code was made. Failing that you could check the enrol/stripepayment directory to see if there is an error_log file that might give you a clue
  • Picture of Melvyn Gomez
    Tue, Mar 30, 2021, 2:20 PM
    In my work, we discovered a strange behavior in the plugin. For example, if we set the stripe payment method in a course with the cost of $50, the settings of the method are saved in the table mdl_enrol with the right value of $50.
    Almost all the users pay the exactly amount ($50) and that amount is saved in the field tax of the table mdl_enrol_stripepayment, but there are a few users that pay succesfully with a value different from the cost setted in the enrolment method, that value always is lower than the cost. Those users didn't used a discount coupon.
    Is possible that can be a bug undetected in the plugin?
  • Picture of Jim Crammond
    Wed, Mar 31, 2021, 12:51 PM
    Melvyn, could these lower than $50 transactions have involved foreign currency conversions or international credit cards?
  • Picture of Digital Tricksters
    Wed, Mar 31, 2021, 6:56 PM
    You can try stripe subscription plugin by Digital Tricksters. Thank you.
  • Picture of Melvyn Gomez
    Tue, Apr 6, 2021, 11:35 PM
    Jim, all the transactions are in USD, not foreign currency
  • Picture of Kris Si
    Wed, Apr 7, 2021, 3:04 PM
    is there a way to activate billing address for plugin version 3.2.1? I do not see it in the settings although it is available in the screenshots?
  • Picture of Jim Crammond
    Mon, Apr 12, 2021, 6:00 AM
    Melvyn, I suggest you go into Stripe into the Developer->Logs section. Look for the relevant "POST /v1/payment_intents" API calls and look at the amount in the response body. If it is "5000" then you know it is the Stripe backend that is changing the amount. Otherwise it is indeed the stripe plugin.
  • Picture of IRVIN BAHAN
    Thu, Apr 15, 2021, 4:48 PM
    Hello @DualCube Team,

    I need help on how to change the email message sent to the just enrolled students using stripe... We already used and all are working, except how can we managed to change the message sent by the enrolled students. thank you
  • Picture of John Moodle
    Fri, Apr 23, 2021, 4:03 PM
    Hi there, thanks for a great plugin. I noticed that a site administrator is the only one who can add the Stripe API key? Can the permissions be opened to a manager? Is this error only occurring for me? I checked the role permissions and I have ticked all Stripe permissions (eg: enrol/stripepayment:config). I understand that only one API can be added, but it's more a question of allowing managers to add this key without opening site admin access to them.
Please login to post comments