Moodle paid enrolment with PayPal and Stripe

How to sell Moodle courses with enrolment on payment, choosing between the core PayPal gateway and the community Stripe plugin, and what to confirm for tax, refunds and payment account security.

On this page

How Moodle paid enrolment works and which gateway to choose

A training or education team that sells courses from its own Moodle needs one thing above all: learners should be enrolled automatically once payment clears, without staff adding them by hand. In Moodle, this is handled by a payment gateway plugin working alongside the enrolment method for paid courses. A learner chooses a paid course, is sent to the gateway to pay, and the gateway reports back to Moodle. Only after that confirmation does Moodle create the enrolment. The team should map this flow on paper before touching settings, because the points where a payment can succeed on one side and fail on the other are where support tickets come from. Decide early whether the course price, currency and enrolment duration are fixed or vary by cohort, since those choices shape every gateway setting that follows.

There are two gateway options to compare. The first is the core PayPal gateway, which ships with Moodle and is the default choice when the team wants no third-party plugin in the payment path. The second is the community Stripe gateway, the paygw_stripe plugin maintained by Alex Morris, which connects Moodle to Stripe to collect payments through providers such as credit cards, Alipay and Sofort. The plugins directory lists support for Moodle 4.1 to 5.3, so the team must confirm that its exact Moodle version falls inside that range before choosing it. Because Stripe is a community plugin, the team also owns its upgrade path across Moodle releases, and that cost recurs for as long as the plugin is in use. The Stripe payment gateway listing is the natural next read for version and maintenance details.

This page does not set out PayPal or Stripe account settings, API keys, webhook addresses or currency options. Those change with the vendor and the Moodle version, and they should be checked in the team's own Moodle administration screens and the vendor's current documentation. Payment accounts, tax treatment, invoicing and refund rules also remain the organization's responsibility. Finance, legal and tax advisers should confirm which taxes apply to each buyer, how refunds reverse an enrolment, and who holds the merchant account. A sound first step is a test course in a non-production Moodle, with test payments run through each gateway the team is considering.

What you need before enabling paid enrolment

Paid enrolment touches the Moodle version, the server, the public web address, the payment accounts and several internal decisions. Settle these before installing a payment gateway, because each one changes what the gateway can do and who must sign off on it.

Moodle version and plugin range

Confirm the exact Moodle version your site runs before choosing a gateway. The Stripe gateway plugin (paygw_stripe) supports Moodle 4.1 to 5.3, so a site on an older release needs an upgrade first, and a site on 5.3 must check that the plugin release matches. Record the version in your change request so the gateway choice can be tested against it.

Stripe plugin listing

Server requirements for the release

Each Moodle release sets its own PHP and database floor. Moodle 5.1 requires 64-bit PHP 8.2 or later and a supported database such as PostgreSQL 15 or MySQL 8.4, while Moodle 5.3 requires PHP 8.3 or later and PostgreSQL 17. Check these against your current servers, because a payment-enabled site is no different from any other site on these points.

Moodle 5.3 release notes

HTTPS on the public site

Card payments happen on a public address that learners reach from the browser. Confirm that the site serves a valid certificate for the domain Moodle uses in wwwroot, that redirects send all traffic to HTTPS, and that the gateway return and webhook addresses are reachable from the internet. Ask your network team who owns the certificate renewal process.

Merchant accounts and their owners

Each gateway needs a merchant account that belongs to the organization and receives the money. Name an owner for the PayPal business account and the Stripe account, and confirm who holds the login, the API keys and the webhook settings. Keep these credentials out of shared mailboxes and store them in your secrets process rather than in personal notes.

Pricing, currency and tax rules

Decide the course prices, the currency each course is sold in, and whether prices include tax. Finance should confirm how sales tax or VAT applies to online courses in each customer location, and whether the gateway's tax settings or an outside tax service will calculate it. Moodle records the sale, but the tax treatment is a business and legal decision.

Refund approval and records

Name the person or role who approves a refund, the time window for refund requests, and where refund decisions are recorded. Decide whether a refund also removes the learner's enrolment in Moodle and who performs that step. Agree this before launch so support staff do not improvise refunds for paid courses.

How a learner payment becomes a course enrolment

The flow starts when a learner selects a paid course in the browser and Moodle creates a pending payment record in its own database. The learner is then handed to the chosen gateway, either the core PayPal gateway or the community Stripe gateway, which collects the money outside Moodle. The gateway's callback returns the learner to Moodle, where the payment is verified before the enrolment is created and the confirmation email is sent. The trust boundary sits between Moodle and the payment provider, so check what the callback verifies and where each record is stored.

Payment flow from learner checkout to enrolment, with the trust boundary marked.

Configuring paid enrolment step by step

This sequence takes a Moodle site from an unconfigured payment subsystem to a tested paid enrolment on a course, with each gateway step verified in test mode before any live money moves. It produces a course that sells access automatically and a documented set of settings you can hand to whoever runs the site next.

  1. Confirm the site version and gateway plugin

    Before touching settings, confirm which Moodle version you run and that the gateway plugin supports it. The Stripe gateway plugin (paygw_stripe) lists support for Moodle 4.1 to 5.3 in the Moodle plugins directory, so check that range against your exact release. For PayPal, the gateway ships in Moodle core, so the check is the core version and the PayPal account type you intend to use. Done means you have written down the Moodle version, the plugin version and the payment provider decision, and you have a copy of the site backup taken before the change.

  2. Enable the payment subsystem and gateway

    As a site administrator, enable the payment subsystem and then enable the chosen gateway in the payment gateway settings. For Stripe, install the paygw_stripe plugin through the standard plugin installer or your vetted deployment pipeline, then enable it. Confirm that the gateway appears as enabled and that the site-level payment account is selectable. Done means the gateway shows as enabled in the administration page, and no course has yet been changed.

  3. Create test-mode merchant accounts and keys

    Create or open the PayPal sandbox business account or the Stripe test-mode account, and generate the test credentials there. Keep test and live credentials in separate records so that no live key is ever pasted into a test configuration. Ask your finance and security teams who owns the merchant account, who can rotate keys and where the secrets are stored. Done means you have a test account with credentials recorded in your secrets process, and the owner of each credential is named.

  4. Set gateway credentials and callback addresses

    Enter the test credentials into the gateway settings in Moodle, then register the callback or webhook address that the provider will call back to. The address must match your site's public HTTPS address exactly, including the path Moodle generates for the gateway. Confirm the site URL setting matches the public address, because a mismatch is a common cause of payments that succeed at the provider but never enrol the learner. Done means the provider dashboard shows the webhook as active and a test event reaches Moodle without error.

  5. Configure the paid enrolment method on each course

    In each course, open participants enrolment methods and add the payment-based enrolment method. Set the price, the currency, the enrolment duration and, if you use it, the enrolment end behaviour. Set the currency to match the merchant account so that reporting and reconciliation line up. Save the method and confirm the course shows the enrolment option to a logged-out or unenrolled test user. Done means one pilot course shows the correct price, currency and duration on the enrolment page, and the duration matches what your sales terms say.

  6. Run an end-to-end test purchase

    Using a test learner account, buy the pilot course with the sandbox or test card details. Check that the payment is recorded in Moodle, the learner is enrolled with the expected duration, and the provider dashboard shows the matching transaction. Then test a failed payment and a cancelled payment, because each should leave the learner unenrolled and show a clear message. Done means the successful, failed and cancelled paths all behave as written in your test plan, and the results are saved with the date and versions tested.

  7. Switch to live credentials after sign-off

    Once the test results are signed off by the business owner, replace the test credentials with live credentials in the gateway settings, update the webhook to the live endpoint if the provider separates them, and run one small live purchase that you refund immediately after. Confirm that the refund is reflected in both Moodle and the provider. Before go-live, ask the business owner to confirm the tax treatment, invoice requirements and refund policy for each market you sell into, because those are outside what this configuration decides. Done means live payments are switched on, a documented owner exists for the keys, and the first live transaction has been reconciled.

How payment data maps to Moodle enrolments

This table compares each data item that moves between the learner account, the course enrolment instance, the payment record and the gateway transaction. Read it as a checklist of what the site must store so that every paid enrolment can be traced from a bank or gateway payout back to a Moodle user and course. Confirm the exact field names and callback behaviour in the gateway documentation and the Moodle version you run before you build the mapping.

Data itemWhere it lives in MoodleWhat the site must store or confirm
Learner identityUser account (user id and username)Store the Moodle user id on the payment record, not only the email address, because emails can change after purchase
Course and enrolment methodCourse id and the enrolment instance for the payment methodRecord the course id and the enrolment instance id so the enrolment can be reversed if a refund is issued
Price, currency and tax basisEnrolment cost, currency and any tax setting on the course or categoryConfirm whether the gateway amount includes tax and store the net, tax and gross values separately for reporting
Gateway transaction referencePayment record in the payment subsystemStore the gateway transaction or order id returned at payment, and check which id the webhook or return callback carries
Payment status and eventsPayment and gateway callback handlingConfirm which events the PayPal or Stripe plugin handles (completed, pending, refunded, disputed) for your Moodle version
Enrolment start and end datesEnrolment instance timing fieldsDecide whether access ends on a fixed date or a duration from purchase, and record the chosen rule for each course
Refund and reversal linkRefund record linked to the original paymentStore the refund id from the gateway against the original transaction and confirm whether enrolment is suspended automatically

Core PayPal or the community Stripe plugin

The choice usually comes down to which payment methods your learners need and whether your organization already holds a PayPal business account. The core PayPal option is the natural path when PayPal covers your buyers and finance already manages that account. The Stripe plugin is a community plugin that becomes necessary when you need card payments through Stripe or methods such as Alipay and Sofort. Both options are configured inside your own Moodle site, so the payment account, tax settings and refund procedure stay with your organization.

  • Existing PayPal account. If finance already runs PayPal and learners pay that way, the core gateway keeps one fewer third-party plugin in your upgrade plan.
  • Card or regional methods. If you need credit cards, Alipay or Sofort through Stripe, the Stripe plugin is the route that covers those methods.
  • Both needed. Confirm whether your Moodle version and business policy allow more than one gateway at once, because each active gateway adds its own account, testing and upgrade work.
  • Ask finance first. Confirm which accounts the business owns, who can open and administer them, and which currencies and countries you must support.

Before you pick a gateway, confirm the payment methods your buyers actually use, because that answer decides most of the rest of the build.

What to check for tax and refunds before taking money

The payment gateway collects the money, but it does not decide how that money is taxed, how it is invoiced or what your refund policy says. Those decisions belong to your finance team or a tax adviser, and they need settling before the first course goes on sale. Start with the questions that shape the Moodle setup: which tax applies to each course, whether the price includes tax, and where the buyer is located when the sale happens. Your answers determine whether the enrolment fee is shown with tax included, whether a single rate applies across regions, and what the receipt must show. Confirm these rules with your own advisers, because DeployOpen does not provide tax advice.

Receipts and invoices are the second area to settle. Ask finance whether a receipt must carry a tax number, a tax breakdown, the buyer's name or an invoice sequence, and whether Moodle's own sale confirmation email meets that requirement or whether a separate invoice process is needed. Record the answer in writing, since the gateway plugin does not produce tax documents for you. Also agree which currency each course is priced in, because currency choice affects both the buyer's experience and the amount you reconcile later.

Refunds and chargebacks need a defined process before go-live. A refund issued through the payment provider does not remove the user's enrolment in Moodle by itself, so decide who reverses the enrolment, how quickly, and whether access is removed immediately or at the end of a period. Chargebacks arrive as disputes from the card network and may happen weeks after the course ends, so decide who responds to them, what evidence you keep (such as the enrolment record and course access logs) and who owns the reconciliation between the provider dashboard and Moodle. Check the current refund and dispute terms of PayPal or Stripe with the provider before you publish your refund policy.

Securing payment keys, callbacks and enrolment changes

A paid enrolment flow touches gateway credentials, a public callback address and the enrolment records that grant course access. The controls below cover those three surfaces on a self-hosted Moodle, where your team owns the server, the database and the logs. Each one is something to confirm in your own environment before go-live.

Store and rotate gateway secrets

Gateway API keys and secrets should never sit in course content, plugin settings exported to version control, or shared documents. Keep them in your secrets store or in protected configuration on the server, restrict file permissions on config.php, and record who holds each credential. Agree a rotation procedure with the gateway account owner, including how Moodle is updated during a rotation so that checkouts do not fail mid-sale.

Use least-privilege gateway accounts

Create a dedicated gateway user or API key for Moodle with only the permissions needed to create payments and read their status. Avoid using an owner or administrator login from the payment provider, because a leaked Moodle credential would then expose refunds, payouts and account settings. Ask the gateway vendor which permission sets are available for integrations and confirm them in writing.

Restrict who can change payment settings

Gateway configuration, enrolment instance settings and course price fields are high-impact, so limit them to a named group of administrators. Review the capabilities that allow editing enrolment methods and the payment account in Moodle, and remove them from teacher and manager roles where they are not needed. Keep the change history visible so a changed price, currency or receiving account can be traced to a person.

Verify callback authenticity

Payment providers notify Moodle of completed or failed payments through callbacks, and the enrolment decision should depend on a verified payment result rather than on a browser redirect alone. Confirm that the gateway plugin validates the provider's signature or confirms the payment with the provider's API before enrolling the user. Test a forged or replayed callback in staging and confirm it does not create an enrolment.

Enforce HTTPS and certificate checks

Checkout pages, login sessions and callback endpoints must run over HTTPS with a valid certificate that your payment providers accept. Confirm that the wwwroot setting uses https, that HTTP redirects to HTTPS, and that the reverse proxy forwards the original protocol so Moodle generates correct callback URLs. Expired certificates are a common cause of failed notifications, so monitor certificate expiry alongside the site.

Log payment and enrolment events

Keep a record that links each order, payment reference, callback, enrolment and refund to a user and a course. Moodle's logs and the gateway's dashboard should agree, so reconcile them regularly and check that log retention meets your finance and audit requirements. Store logs outside the web server so an attacker who compromises Moodle cannot remove the trail, and test the export before you need it for a dispute.

Separate test and live credentials

Staging and test sites should use sandbox credentials and sandbox receiving accounts only, so that a test purchase cannot move real money or enrol real learners. Keep the two sets of keys in separate configuration with different names and check which environment a server is pointing at before each release. Confirm with the provider how test cards and sandbox webhooks behave, since they differ between gateways.

Common paid enrolment failures and fixes

This table lists the failures that most often appear once Moodle paid enrolment with PayPal or Stripe goes live, with the likely cause, the check to run and the fix to confirm in your environment. Read each row against your own gateway logs and enrolment records, starting with the payment record rather than the learner's report. The main takeaway is that most failures trace back to callbacks, currency settings or account mode, so verify those first.

FailureLikely causeCheck to runFix to confirm
Learner paid but was not enrolledThe gateway's return or notification callback did not reach Moodle, or the payment was never marked complete in Moodle's payment recordsFind the transaction in the gateway dashboard, then find the matching row in Moodle's payment and enrolment logs for the same user and courseConfirm the callback URL in the gateway settings, re-run the notification for the transaction, and confirm the enrolment is created once
Duplicate enrolments after a retried callbackThe gateway retried a notification that Moodle had already processed, and the handler did not check for an existing enrolmentSearch the enrolment table and payment records for more than one entry per user, course and transaction IDConfirm the gateway plugin version supports your Moodle release, remove the duplicate, and test a repeated notification in a staging site before go-live
Currency mismatch between course and gatewayThe course price is set in one currency while the gateway account settles in another, or the gateway does not support the currency chosenCompare the course cost currency, the site currency and the currency of the gateway account for a test purchaseConfirm the supported currencies with the gateway account, align the course and site settings, and record the decision in your configuration notes
Callbacks blocked by the web server or firewallA reverse proxy, web application firewall or outbound or inbound rule blocks the gateway's requests to the Moodle site, often on a path that is not in the allow listReview web server access logs for requests from the gateway during a test payment, and check whether the request was rejected with an error codeConfirm the callback path is allowed through every layer, including any reverse proxy and WAF rules, and test with a live payment flow in a non-production site first
Test credentials left in productionSandbox or test keys were entered in the production configuration, so real learners are charged in a test account or no real money movesCheck the gateway mode and the API keys in the Moodle configuration against your production account, and check the gateway dashboard for test-mode transactionsConfirm live credentials in the production gateway settings, restrict who can edit them, and reconcile any transactions taken during the test period
Enrolment not ended after a refundRefunds are issued in the gateway dashboard only, so Moodle has no record of the refund and the learner keeps accessCompare refunded transactions in the gateway with the active enrolments for those users and coursesConfirm how your process ends enrolments after a refund, whether through a manual step or a supported event hook, and test it with a refunded test purchase
Tax not applied or applied inconsistentlyTax settings were not defined for the course price, or the rule differs between the course, the site and the gatewayCompare the tax setting on a test purchase with the amount shown at checkout and the amount in the gateway reportConfirm your tax obligations with your finance or tax adviser, then set the matching configuration and confirm the result on a test order
Payment shows in gateway but learner sees no course accessThe enrolment instance is disabled, the enrolment start date is in the future, or the learner's account is suspendedCheck the course enrolment methods page, the enrolment dates and the user account status for the affected learnerConfirm the enrolment instance is enabled and dated correctly, then re-run the enrolment and confirm access as the learner

Questions buyers ask about paid enrolment with PayPal or Stripe

What drives the cost of setting up paid enrolment in Moodle?

The cost depends mainly on how many payment accounts and gateways you connect, how many course price points and enrolment rules you define, and how much of the tax and refund logic must be built or verified. Most of the effort is configuration and testing rather than code, but each gateway adds its own account setup, webhook or return-URL checks and sandbox testing. Costs are one-time for design, build and testing, and recurring for upgrades, plugin maintenance and periodic payment tests after Moodle or gateway changes. Ask any provider for a quote that separates the gateway work, course catalogue setup, testing and handover, and states which items recur.

How long does paid enrolment with PayPal or Stripe usually take?

Duration depends on the gateway you choose, the number of courses and price points, and how quickly your finance and legal teams confirm pricing, tax and refund rules. Setting up the core PayPal gateway is one stream of work, while the community Stripe gateway adds plugin installation, a check against your Moodle version and Stripe account configuration. A catalogue of a few courses with one price each takes far less than a catalogue with bundles, discounts and cohort-specific prices. Ask for a timeline in the written scope that lists the decisions your organization must make and the dates by which it must make them.

What must our team provide before paid enrolment can be built?

Your team must provide the payment accounts, the price list for each course, the tax treatment rules, and a written refund policy. Finance should confirm which legal entity receives payments, which currencies you sell in, and how receipts and invoices are issued. Your administrators should provide access to the Moodle site with rights to install and configure enrolment and payment plugins, and test learner accounts for end-to-end checks. Without these decisions, the build can only be tested against placeholder values, so agree the owners and due dates before work starts.

Can an in-house team set up PayPal or Stripe enrolment on its own?

An in-house team with Moodle administration experience can usually configure the core PayPal gateway and a supported Stripe gateway, provided it has the payment account access and time to test. The harder parts are usually the non-technical decisions and the test plan: confirming tax and refund handling, checking that enrolment, receipts and access revocation behave correctly after a refund, and documenting the steps for future upgrades. A partner is useful when the team lacks spare capacity, when several gateways or course catalogues are involved, or when the work needs a written test record for auditors or finance. Either route should end with a documented configuration and a rehearsed refund process.

How do Moodle upgrades affect the Stripe plugin?

Each Moodle upgrade can change the payment subsystem or plugin APIs, so the Stripe gateway plugin must be checked against the target version before the upgrade starts. The community plugin page for paygw_stripe, maintained by Alex Morris, lists support for Moodle 4.1 to 5.3, so confirm that your target release is in that range before scheduling work. Moodle 5.1 requires 64-bit PHP 8.2 or later and PostgreSQL 15, MySQL 8.4, MariaDB 10.11 or Microsoft SQL Server 2017 or later, and Moodle 5.3 requires 64-bit PHP 8.3 or later with PostgreSQL 17 or MariaDB 11.4 among its listed database versions. Test a complete purchase, a refund and an enrolment check on a staging copy after every upgrade, because the plugin version and the Moodle version must both match.

Who is responsible for tax and refunds on paid courses?

Your organization is responsible for tax and refunds, not the Moodle core project, the gateway plugin maintainer or DeployOpen. Your finance and legal teams decide the tax treatment of each sale, the refund conditions and the records you must keep. A partner can configure the sale and refund flows to follow your written rules and can test them, but it does not give tax advice or decide your refund terms. Ask your tax adviser to review the price settings and the receipt output before launch, and write down who approves a refund and how access is removed afterwards.

What should we check in a payment gateway before going live?

Check that the gateway runs in the sandbox mode first, that the live credentials are stored outside shared documentation, and that the return and notification addresses match your Moodle site. Confirm that an enrolment is created only after the gateway reports a completed payment, and that a failed or cancelled payment leaves the learner unenrolled. Test one full refund and confirm that the learner's access is removed as your policy requires. Also confirm the currency, the tax setting, the receipt content and the support contact shown to learners. Record each test result so that the same checks can be repeated after the next upgrade.

How DeployOpen scopes and supports Moodle payment integrations

DeployOpen plans, builds, documents and supports Moodle paid enrolment inside infrastructure you control, whether the gateway is the core PayPal option or the community Stripe plugin. Each engagement starts from a written scope that names the gateway, the courses being sold and the finance and tax rules your organization must follow.

How we scope

  • We confirm which courses, cohorts and price points will be sold and which enrolment rules apply to each.
  • We record which gateway accounts, currencies and payment methods your finance team has approved.
  • We agree in writing who owns tax setup, refund policy and reconciliation before any build starts.

How we build

  • We configure the payment gateway, the enrolment on payment method and the course price settings in a test Moodle site.
  • We check the gateway plugin against your Moodle version and the PHP and database versions it requires.
  • We test successful payments, failed payments, cancellations and refunds end to end before go-live.

How we hand over

  • We document account setup, webhook and callback settings, and the steps to rotate gateway credentials.
  • We provide a runbook covering refund handling, enrolment checks and how to review payment logs.
  • We walk your administrators through the configuration so they can answer audit and finance questions.

How we support

  • Fixed-scope engagements close with agreed deliverables, and ongoing support is available as a retainer.
  • Retainers can cover Moodle upgrades, gateway plugin updates and retesting after each release.
  • We can retest payment flows after changes to Moodle, the gateway account or your hosting environment.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.