MPS Documentation
Shop plugins

Accept payments in Magento

Install the MPS Payments module on your Magento server, paste your API key, and take MPS payments without writing code of your own.

The MPS Payments module for Magento adds Powered by MPS as a payment method to your shop's checkout. Your customer pays on the MPS checkout and comes back to your shop, and the module marks the order paid once MPS confirms the payment. You paste two codes from the MPS platform in the admin.

The module sends the order amount, order number and your shop's return addresses to MPS (Mobile Payment Solutions) to open each payment.

Download mps-module-payments.zip — always the latest version. Every version is in its releases on GitHub, with the source.

Installing needs access to your server

You write no code, but installing runs commands on the server your shop runs on, and the module relies on Magento's cron. If you do not manage that server yourself, ask your hosting provider or the developer who looks after your shop to do the install step.

Before you start

  • Magento Open Source or Adobe Commerce 2.4.7 – 2.4.9, or Mage-OS on the same versions, on PHP 8.1 – 8.5 (whichever your Magento version runs on). Your host or developer can tell you which you have.
  • Someone with shell access to the server, and Magento's cron running, as for any production shop
  • Your store's currency set to euro (EUR)
  • A test API key and its webhook signing secret, from Online › API keys on the MPS platform. Connect your webshop shows how.
  • For orders confirmed the moment they are paid: your shop online and reachable from the internet. Your host or developer can confirm it; see For your host or developer.

Install and connect

Install the zip. Either way of installing a Magento module works.

From the zip, into app/code:

mkdir -p app/code/Mps/Payments
unzip mps-module-payments.zip -d app/code/Mps/Payments
bin/magento module:enable Mps_Payments
bin/magento setup:upgrade
bin/magento setup:di:compile        # in production mode
bin/magento setup:static-content:deploy   # in production mode
bin/magento cache:flush

With Composer, using the zip as an artifact repository. Put the zip in a folder of its own:

composer config repositories.mps artifact /path/to/folder-with-the-zip
composer require mobilepaymentsolutions/module-payments
bin/magento setup:upgrade

In the admin, open Stores › Configuration › Sales › Payment Methods and expand Powered by MPS.

Paste your test key in API key and its webhook signing secret in Webhook signing secret, set Enabled to Yes, and click Save Config. The module sends the API key with every call.

Saving checks the key with MPS straight away. The module shows Connected to MPS with a test key, or says that MPS refused the key (Troubleshooting). The API key and Webhook signing secret are stored encrypted.

Place an order in your shop and pay it with one of the test cards. The order moves to Processing, as How payments are confirmed describes.

Go live: replace the test key with your live key and its webhook signing secret, and click Save Config. See Switch to live payments for what MPS needs first.

Use Hyvä Checkout

Hyvä Checkout is a checkout from Hyvä that replaces Magento's own. The MPS Payments module draws its part of the checkout in Magento's checkout only, so a shop on Hyvä Checkout also needs the MPS Payments for Hyvä Checkout add-on. A shop on the Hyvä theme that keeps Magento's checkout (Hyvä's Luma checkout fallback) needs only the MPS Payments module.

Download mps-module-payments-hyva.zip — always the latest version. Every version is in its releases on GitHub, with the source.

Install the add-on before offering MPS in Hyvä Checkout

Hyvä Checkout lists every enabled payment method. Without the add-on, a shopper who chooses Powered by MPS there places an order that is never sent to the MPS checkout, and the order stays in Pending Payment until Magento cancels it.

Install and connect the MPS Payments module first, as in Install and connect. The add-on needs MPS Payments 1.0.0 or later, and Hyvä Checkout 1.1.13 or later.

Install the add-on the same way as the module.

From the zip, into app/code:

mkdir -p app/code/Mps/PaymentsHyva
unzip mps-module-payments-hyva.zip -d app/code/Mps/PaymentsHyva
bin/magento module:enable Mps_PaymentsHyva
bin/magento setup:upgrade
bin/magento setup:di:compile        # in production mode
bin/magento setup:static-content:deploy   # in production mode
bin/magento cache:flush

With Composer: put the zip in the same folder as mps-module-payments.zip and run:

composer require mobilepaymentsolutions/module-payments-hyva
bin/magento setup:upgrade

Place an order in your shop with a test key. At the payment step, choose Powered by MPS: it shows your Description, and a test-mode notice while the key is a test key. Place Order sends you to the MPS checkout. Pay with one of the test cards.

The add-on has no settings of its own. How orders are confirmed, refunds and every setting below are the same as in Magento's checkout. When MPS cannot open the payment, the order is canceled and the shopper is sent back to their cart, as in Magento's checkout.

Test mode

A test key is an API key starting mps_test_. A card payment made with a test key is a test payment: the checkout shows a test-mode banner and takes only the test cards, no card is charged and nothing is paid out. Orders still move through paid or failed exactly as they do in live mode.

A test key does not expire. It works until you revoke it.

How payments are confirmed

The order is placed in Pending Payment, and the shopper goes on to the MPS checkout. The order confirmation e-mail is held back until MPS says the order is paid.

The module never takes the shopper's return to your shop as proof of payment. It reads the payment from MPS and moves the order on what MPS says:

MPS paymentMagento order
Paid, full amountInvoiced, Processing (or Complete for virtual products), and the confirmation e-mail goes out. The payment reference is the payment's Transaction ID.
Paid, less than the order totalOn Hold, with a comment. A card issuer can approve part of an amount; check before shipping.
FailedCanceled, with a comment. The shopper is sent back to their cart to try again.
Shopper left without payingCanceled, with a comment. The shopper is sent back to their cart to try again.

A retry is a new order from the same cart: a Magento order is paid once.

The module reads the payment when the shopper comes back, when MPS sends a webhook, and from Magento's cron at 10 minutes, 30 minutes, 1 hour and 6 hours after the payment was opened. An order is confirmed even when the shopper closes the tab before returning, if it is paid within those 6 hours or a webhook arrives.

Keep the pending lifetime above 6 hours

Magento itself cancels an order left in Pending Payment after Stores › Configuration › Sales › Sales › Orders Cron Settings › Pending Payment Order Lifetime (8 hours by default). Keep it longer than 6 hours.

Settings

SettingScopeWhat it does
EnabledWebsiteOffer MPS at checkout.
Title, DescriptionStore viewWhat the shopper sees at checkout. The default title is Powered by MPS, the same in every language. Set them per store view to change the wording per language; the default description is translated into Dutch and French.
API keyWebsiteYour API key, sent with every call; stored encrypted. A key starting mps_test_ is a test key: MPS test cards only, no card charged. Without it, MPS is not offered.
Webhook signing secretWebsiteSee Webhook signing secret.
Gateway URLWebsiteLeave as is unless MPS asks you to change it.
Debug logWebsiteLogs every call to MPS in var/log/mps_payments.log, never the API key, the webhook signing secret or payment links.
Payment from Applicable Countries, Payment from Specific CountriesWebsiteMagento's usual restriction by billing country: all countries, or only the ones you select.
Sort OrderWebsiteWhere MPS appears among the payment methods at checkout.

Every setting can also be set with bin/magento config:set payment/mps_payments/<field> <value>, or in app/etc/env.php, which locks it in the admin.

Refunds

Refund an MPS order with an online credit memo, opened from the invoice (Invoices → the invoice → Credit Memo → Refund), in full or in parts. A credit memo MPS refuses is not saved, and the message says why.

A test key can always refund. A live key needs the refund permission first: ask MPS to add it to your key. Every refund waits 4 hours before it is sent, and can be canceled in MPS until then.

Updates

Install the new zip the same way (unzip it over app/code/Mps/Payments, or put it in the artifact folder and run composer update mobilepaymentsolutions/module-payments), then run bin/magento setup:upgrade. Update the Hyvä Checkout add-on the same way: unzip it over app/code/Mps/PaymentsHyva, or run composer update mobilepaymentsolutions/module-payments-hyva.

Not supported yet

  • Ordering from the admin. MPS is a checkout payment method; it is not offered when an order is created in the admin.
  • Currencies other than EUR. The payment method is hidden at checkout when the store's currency is not EUR.

For your host or developer

The details below are for whoever runs the server your shop is on: your hosting provider or your developer.

Webhooks

The module sends its own webhook address with every payment, so there is no address to register anywhere. MPS sends a webhook the moment the payment arrives when two things are true:

  • your shop is reachable on a public HTTPS address. MPS cannot reach a shop on localhost or a private network;
  • the key's webhook signing secret is pasted in the module. MPS signs every webhook, and the module ignores webhooks while no signing secret is set.

When either is missing, an order is confirmed when the shopper returns, or else at the next scheduled read: 10 minutes, 30 minutes, 1 hour or 6 hours after the payment was opened. That can be hours later, and the scheduled reads stop 6 hours after the payment was opened. A payment completed after that, such as a late ANNA bank payment, while the shopper does not come back, is confirmed only by a webhook. Set up webhooks for a live shop.

A webhook is matched to its order by the order number MPS echoes back, and only when the payment reference stored on that order is the webhook's. The payment reference is shown with the payment on the order in the admin.

Webhook signing secret

Every webhook MPS sends is signed with a signing secret that belongs to your key. Every key issued in the MPS platform, test or live, comes with one. With the signing secret pasted, the module checks the signature and that the webhook is less than five minutes old, and refuses anything that does not match with 401.

What it looks likewhsec_ followed by 43 characters
Where to get itShown with your key in Online › API keys. A new key comes with a new signing secret: paste it again when you switch keys.
Where to paste itStores › Configuration › Sales › Payment Methods › Powered by MPS, Webhook signing secret
When it mattersOnly when your shop is on a public HTTPS address: without it the module ignores webhooks

Without the signing secret pasted, the module ignores webhooks and settles orders by its scheduled checks and the shopper's return. Paste it to get orders confirmed the moment the payment arrives. Either way a webhook only tells the module to read the payment from MPS, and the order is moved on what MPS answers, so a forged webhook cannot mark an order paid.

Rotating the webhook signing secret

When MPS issues you a new signing secret, the previous one keeps being accepted for 24 hours and webhooks carry both signatures in that time. Paste the new signing secret whenever it suits you within that day; no webhook is lost.

Refund permission

Refunding from the shop needs the payments:refund scope on the API key: a test key always has it, a live key only once MPS granted it.

Upgrade a shop set up with a client ID and secret

The MPS Payments module 1.0.0 connects with an API key only: a client ID and secret no longer connect. The upgrade deletes the stored client ID and secret, and until you paste an API key MPS is not offered at checkout and the admin says MPS Payments is enabled but has no API key, so it is not offered at checkout. Paste the API key and the webhook signing secret from the MPS platform (Online › API keys) under Stores › Configuration › Sales › Payment Methods › Powered by MPS.

API keys need module version 0.2.0 or later.

How the key check works

For your developer or host. To check a key on save, the module reads a payment that does not exist. MPS answers 404 to a key it accepts, and 401 or 403 to a key it refuses. A 404 for that call in your server's logs is the check passing, not a fault.

Troubleshooting

What you seeCauseWhat to do
In Hyvä Checkout, Place Order with MPS goes to the order confirmation without the MPS checkoutThe Hyvä Checkout add-on is not installed or not enabled. The order stays in Pending Payment until Magento cancels it.Install the add-on and run bin/magento setup:upgrade.
MPS Payments is not offered at checkoutIt is not enabled, the API key is empty, the store currency is not EUR, or the billing country is not allowed.Set Enabled to Yes, paste an API key, use EUR, and check Payment from Applicable Countries.
MPS did not accept these credentials on saveA wrong or revoked API key (MPS refused the API key). A test key works until you revoke it.Create a new key in Online › API keys and paste it with its webhook signing secret. See API key errors.
Every call to MPS fails with 429 for a minute at a time, the right key includedMore than 10 calls with a wrong API key in one minute came from the server's outgoing address, so MPS refuses that address for 60 seconds. On shared hosting another site on the same address can cause it.Fix the wrong key; if the address is shared, ask the host for one of the shop's own. See API key errors.
The payment could not be started at checkoutMPS could not open the payment. The order is canceled and the cart restored.Set Debug log to Yes, try again, and read var/log/mps_payments.log.
Webhook refused: signature or timestamp does not match in the log, with Debug log onThe signing secret is not the one for this key (common after switching to another key), or the server's clock is more than five minutes off.Paste the signing secret shown with your key, and set the server clock right. See Webhook signing secret.
Webhook ignored: no signing secret configured in the log, with Debug log onNo webhook signing secret is pasted. Until then orders are confirmed by the return and the scheduled reads.Paste the key's Webhook signing secret.
An order stays Pending Payment after payingNo webhook was acted on (the shop is not on a public HTTPS address, or no webhook signing secret is pasted), the shop could not reach MPS when the shopper returned, and Magento's cron is not running.Check that bin/magento cron:run runs every minute. See Webhooks.

Need help? Contact MPS at contact@mps-emi.com or +32 55 89 09 77, or the MPS partner you work with. What to include.

Building with an AI assistant? Give it llms.txt, every page in llms-full.txt, this page as Markdown, or the OpenAPI document. See Build with AI.

Last updated on

On this page