Payment buttons
Quickstart
The payment button collects an mMoney payment on your website. You add one script, one container, and one render call.
1. Add the script
Add the mMoney payment script before the closing </body> tag:
<script src="https://merchant.mmoneyapp.com/assets/mmoney-payment.js"></script>
The script detects the merchant domain from its own URL. All API calls use that domain.
2. Add a container
Add a container where the button must appear:
<div id="mmoney-payment-button"></div>
3. Render the button
<script>
window.addEventListener('mMoneyReady', function () {
window.mMoney.payment.button.render({
amount: 10.00,
api_key: 'YOUR_API_KEY',
merchant_order_id: 'order_123',
currency: 'BBD',
onPaid: function (details) {
// The invoice is paid. Fulfil the order.
},
onCancel: function () {
// The user closed the payment sheet.
},
onRenderError: function (error) {
// The button could not render. Log the error.
}
}, '#mmoney-payment-button')
})
</script>
Rules
-
Use a unique
merchant_order_idfor each transaction. - The API key must have exactly the Receive Funds permission.
- Confirm payment on your server with a webhook or an invoice lookup. Do not trust the browser callback alone.
- Test the integration before you go live.