Moodle
The Orboni payment gateway adds crypto to Moodle’s own payments, with no code. A learner buying a course chooses Crypto in Moodle’s payment window and pays on Orboni’s payment page, picking a coin and paying from any wallet or exchange. The money goes to the wallets you set in the dashboard, and Moodle enrols the learner by itself once the payment is final.
It is a payment gateway of Moodle’s payment API, so it works for course fees (Enrolment on payment) and for any plugin that takes payments through that API. It runs on Moodle 4.5 LTS to 5.3 with PHP 8.1 or later, tested end to end on Moodle 5.3.1 and 4.5.16, on PostgreSQL and MySQL. It is free, and its source is open, under the GNU GPL (version 3 or later), as Moodle itself: orboni/moodle-paygw_orboni on GitHub.
Set it up
- 1Download paygw_orboni.zip from the newest release. In Moodle, open Site administration → Plugins → Install plugins and upload it, or unzip it into
payment/gateway/orboni(public/payment/gateway/orbonifrom Moodle 5.1) and visit Site administration → Notifications. The gateway is switched on in Manage payment gateways by itself. - 2In the Orboni dashboard, set the wallets you want to be paid to under Wallets, and copy a secret key under Developers → API keys — a test key (
sk_test_…) first. - 3In Site administration → General → Payments → Payment accounts, open an account (or create one) and press Orboni in its payment gateways column. Paste the key into Secret key.
- 4In the dashboard, under Developers → Webhooks, add an endpoint at the Webhook address the form shows, with every event, or at least the
checkout.session.*ones. Paste its signing secret (whsec_…) into Webhook signing secret, tick Enable and save. - 5Sell with that account. For a course fee: enable Enrolment on payment in Site administration → Plugins → Enrolments, then in the course add it under Participants → Enrolment methods, with the account, the fee and its currency.
- 6As a learner, press Select payment type, choose Crypto, and on the payment page, signed in to the dashboard, press Simulate payment: back on the site, the learner is enrolled. Then swap in your live key (
sk_live_…) and the live endpoint’s secret. The key decides test or live at Orboni.
How purchases move
Pressing the button makes a purchase and sends the learner to Orboni’s payment page for its price. The plugin reads the payment back from Orboni before it changes anything, and the purchase follows the payment as it is now — whether the webhook, the learner’s return or Moodle’s scheduled task comes first, twice or out of order. Moodle records the payment and gives access only once it is final, and only once.
| Payment | Orboni says | In Moodle |
|---|---|---|
| Paid in full | complete, paid | Moodle’s payment record, and the purchase delivered: the learner is enrolled, back at the course with “Thank you, your payment has arrived” |
| On the chain, not final yet | processing | Not delivered yet; the learner is told it is on its way, and is enrolled once final |
| Part paid | partially_paid | Not delivered; the learner is asked for the rest, with the way back to the payment page |
| Held for your review | held | Not delivered; the site administrators are told. Accept it in the dashboard and the learner is enrolled |
| Left by the page’s back link, nothing sent | open, unpaid | Closed, and the learner is back at the course’s payment, to pay another way |
| Ran out with nothing paid | expired, unpaid | Closed; the next press of the button starts a new purchase |
| Ran out part paid | expired, partially_paid | Not delivered, and the site administrators are told: settle the rest with the learner, then enrol them by hand |
| Paid for a price raised after the page opened | complete, paid | Not delivered, and the site administrators are told: enrol the learner by hand, or send the money back |
| Money that paid it left the chain | payment_reversed | The site administrators are told; Moodle cannot take access back by itself, so remove it by hand if the payment does not come back |
| More came after it was paid | extra_received | A line in the purchase’s history; send the extra back from your wallet if the learner asks |
A payment that arrives after its page was closed is still recorded and delivered. The site administrators’ notices come as Moodle notifications and email (An Orboni payment that needs you, in their notification preferences), each with a link to the purchase. Orboni purchases, linked from the gateway’s settings and its form, lists every purchase, its price, where it stands and what happened to it. Without a webhook a payment is still recorded once the learner comes back, and Moodle’s scheduled task reads back the rest every 15 minutes; set up the webhook all the same, and keep Moodle’s cron running.
Good to know
- The currency: the price’s own — US dollars, euros, pounds, yen or any of the 37 currencies a checkout session takes (Currencies in the API reference). Moodle offers the gateway only for a price in one of them. The payment page shows the price in it, and the learner pays its worth in the coin they pick.
- The least is worth $1.00. Below it the learner is told so before anything is made, and can choose another way to pay.
- The gateway’s surcharge, in Site administration → Plugins → Payment gateways → Orboni, is added to the price as for any Moodle gateway.
- A learner who presses the button again gets the same payment page while it is open, not a second one.
- Refunds: the money is in your wallet, so send it back from there, record the refund in the dashboard, and unenrol the learner in Moodle.
- Several Moodle sites can share one Orboni project: each adds its own endpoint and acts only on its own purchases. One endpoint serves all of a site’s payment accounts.
- What the plugin keeps and what it sends Orboni are declared to Moodle’s privacy API, and exported and deleted with a user’s data.
What the plugin sends
Each purchase makes a checkout session through POST /v1/checkout/sessions, with an idempotency key of the site, the purchase and its price, and the try, so a retry never makes a second one. Nothing is sent until the plugin has your key and a learner pays with it.
- amountinteger
- The price with the gateway’s surcharge, in the currency’s smallest unit: cents, or whole yen.
- currencystring
- The price’s currency, in lower case: usd, eur, jpy…
- descriptionstring
- What Moodle calls the item, as “Enrolment in course Kitchen basics”, cut at 250 characters.
- detailsstring
- The purchase number and your site’s name: “Purchase 42 at Example Academy”.
- client_reference_idstring
- The plugin’s id of the purchase: “42”.
- metadataobject
- moodle_purchase_id, moodle_item (the component, area and item, as enrol_fee/fee/4) and moodle_site — a key made from your Moodle site’s own identifier, so two sites on one project never act on each other’s events.
- customer_emailstring
- The learner’s email, where Orboni sends the receipt when your project sends receipts.
- localestring
- The learner’s language in Moodle, as en or pt-br.
- success_url, cancel_urlstring
- The plugin’s two return addresses, with the purchase and a key of its own: one reads the payment back and brings the learner to the course, the other closes a purchase with nothing sent and brings the learner back to its payment.
No name, address or other learner data is sent. A payment in the dashboard, an export or a webhook leads to its purchase by client_reference_id, and a purchase to its payment by the session id in its history on the Orboni purchases page.
This page as Markdown, for a program or an AI assistant: /docs/moodle.md. Something missing or unclear? Write to us from the dashboard’s Help & Support.