Accept payments in PrestaShop
Install the MPS Payments module, paste your API key, and take MPS payments in a PrestaShop shop without writing code.
The MPS Payments module for PrestaShop adds Powered by MPS as a payment option to your shop's checkout. Your customer pays on the MPS checkout and comes back to your shop, and the module makes the order once MPS confirms the payment. You install it in the back office and paste two codes from the MPS platform.
The module sends the order amount, order number and your shop's return addresses to MPS (Mobile Payment Solutions) to open each payment.
Download mpspayments.zip — always the latest version. Every version is in its releases on GitHub, with the source.
One scheduled task to set up
You install the module from the back office and write no code. The module also needs an address called every 5 minutes. PrestaShop's Cron tasks manager module can do that; if it is not available on your shop, ask your hosting provider or the developer who looks after your shop to set up the task.
Before you start
- PrestaShop 8.0 to 9.x, on the PHP version it needs (7.2.5 or later for PrestaShop 8) with the
curlextension. The module refuses to install without it. Your host can confirm these. - Carts in euro (EUR)
- A test API key and its webhook signing secret, from Online › API keys on the MPS platform. Connect your webshop shows how.
- A way to call an address every 5 minutes: PrestaShop's Cron tasks manager module, or a crontab on your server (Scheduled checks)
- 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
In the back office, open Modules › Module Manager, click Upload a module, and drop
mpspayments.zip on it. PrestaShop installs it straight away.
Click Configure on Powered by MPS.
Paste your test key in API key and its webhook signing secret in Webhook signing secret, and click Save. 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).
Copy the address under Scheduled checks and have it called every 5 minutes, as Scheduled checks describes.
Pay a cart in your shop with one of the test cards. The order is made in Payment accepted, as How payments are confirmed describes.
Go live: paste your live key and its webhook signing secret, and click Save. See Switch to live payments for what MPS needs first.
The API key and the webhook signing secret are never shown again: leave a field empty when you save to keep what is stored. A saved API key cannot be cleared from the form: an empty field keeps it; paste a new key to replace it.
MPS is offered for every currency the module is allowed for in Payment › Preferences, but only when the cart is in EUR.
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 are still made or not exactly as they are in live mode.
A test key does not expire. It works until you revoke it.
How payments are confirmed
The module makes the order only once MPS says the cart was paid. Until then there is no order: no confirmation e-mail goes out and no stock is set aside, and a payment that does not go through leaves the shopper's cart exactly as it was.
The module never takes the shopper's return to your shop as proof of payment. It reads the payment from MPS and acts on what MPS says:
| MPS payment | PrestaShop |
|---|---|
| Paid, full amount | The order is made in Payment accepted, and the confirmation e-mail goes out. The payment reference is the order payment's Transaction ID. |
| Paid, less than the order total | The order is made with the approved amount as the amount paid, so PrestaShop puts it in Payment error. A private note gives both amounts. A card issuer can approve part of an amount; check before shipping. |
| Failed | No order. The shopper is sent back to the payment step, with their cart, to try again. |
| Shopper left without paying | No order. The cart stays as it was. |
The module reads the payment when the shopper comes back, when MPS sends a webhook, and on the scheduled checks at 10 minutes, 30 minutes, 1 hour and 6 hours after the payment was opened. An order is made even when the shopper closes the tab before returning, if it is paid within those 6 hours or a webhook arrives. A shopper who comes back before MPS has finished sees a short We are confirming your payment page that looks again by itself.
If a shopper manages to pay the same cart twice (two tabs, say), there is still one order. It gets a private note naming the second payment, to refund in MPS: only the order's own payment is refunded from PrestaShop.
Settings
| Setting | What it does |
|---|---|
| API key | Your API key, sent with every call. A key starting mps_test_ is a test key. Never shown again; an empty field on save keeps the stored key. Without it, MPS is not offered. |
| Webhook signing secret | See Webhook signing secret. |
| Gateway URL | Leave as is unless MPS asks you to change it. Only an https:// address is saved (empty means the default); anything else is refused and the previous one kept. |
| Debug log | Logs every call to MPS in Advanced Parameters › Logs, never the API key, the webhook signing secret or payment links. |
| Title, Description | What the shopper sees at checkout. Left empty, the title is Powered by MPS, the same in every language, and the description a standard text in the shopper's language (English, Dutch or French). |
| Scheduled checks | The address to call every 5 minutes. |
In a multistore, each shop has its own settings: pick the shop at the top of the back office before you configure.
Refunds
A partial refund, standard refund or product return on an MPS order refunds the payment: the credit slip's amount (tax and shipping included) is sent to MPS, and the order gets a private message with the answer. Ticking Generate a voucher refunds with the voucher instead, and nothing is sent to MPS.
A shopper whose group sees prices tax excluded, such as a B2B group, is the exception: a credit slip with a chosen amount or a deducted voucher does not say how much that is tax included. The module then sends nothing to MPS and says so in the order's private message. Refund that amount yourself through the refund API.
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
Upload the new zip the same way, in Modules › Module Manager › Upload a module. PrestaShop sees it is a newer version of a module already installed and upgrades it, keeping your settings.
Not supported yet
- Orders from the back office. Choosing Powered by MPS as the payment method of an order created in the back office takes no payment; it only labels the order.
- Currencies other than EUR. The payment option is hidden at checkout when the cart is not in 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.
Scheduled checks
PrestaShop has no scheduler of its own, so the checks run when an address is called. The module's
settings page shows the address, with its token parameter, for example
https://<your-shop>/module/mpspayments/cron?token=…. Call it every 5 minutes, either with a crontab
line on your server:
*/5 * * * * curl -fsS "https://<your-shop>/module/mpspayments/cron?token=…" >/dev/nullor with PrestaShop's Cron tasks manager module. A call without the right token is refused with
403.
Each call reads the open payments that are due: a payment is checked on the first call 10 minutes, 30 minutes, 1 hour and 6 hours after it was opened, and not after that.
Without the checks, an order is still made when the shopper returns or MPS sends a webhook. The checks are the safety net for a shopper who closes the tab on a shop MPS cannot reach.
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
localhostor a private network; - the key's webhook signing secret is pasted in the module. MPS signs every webhook; without the signing secret the module ignores them.
When either is missing, an order is made when the shopper returns, or else at the next scheduled check: 10 minutes, 30 minutes, 1 hour or 6 hours after the payment was opened. That can be hours later, and the scheduled checks 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.
Webhooks and the scheduled checks keep working while the shop is in maintenance mode.
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 like | whsec_ followed by 43 characters |
| Where to get it | Shown 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 it | Modules › Module Manager › Powered by MPS › Configure, Webhook signing secret. To remove it, switch Remove the webhook signing secret on and save. |
| When it matters | Only when your shop is on a public HTTPS address, where MPS can send webhooks at all |
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 made on what MPS answers, so a forged webhook cannot make an order.
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 Not configured: MPS is not offered at checkout until an API key is saved. Paste the API key and the webhook signing secret from the MPS platform (Online › API keys) in the module settings.
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 see | Cause | What to do |
|---|---|---|
| MPS is not offered at checkout | The API key is empty, the cart is not in EUR, or the module is not allowed for the currency, country or carrier in Payment › Preferences. | Paste an API key, and allow the module in Payment › Preferences. |
| MPS did not accept these credentials on save | A 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 included | More 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 checkout | MPS could not open the payment. | Switch Debug log on, try again, and read Advanced Parameters › Logs, filtered on MpsPayments. |
| Webhook refused: signature or timestamp does not match in the log, with Debug log on | The 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. |
| The shopper paid but there is no order | No webhook arrived (the shop is not on a public HTTPS address, or the webhook signing secret is not pasted in the module), the shopper did not come back, and the scheduled-check address is not being called. | Call the address once by hand: it reads every open payment whose next check is due, and makes the order. Then set up the Scheduled checks. |
| cart … was paid (payment …) but no order was made in the log | The shopper was deleted from the shop, the module was disabled, or MPS is no longer allowed for the cart's country, currency or the shopper's group in Payment › Preferences. | Fix it; the next scheduled check makes the order, if one is still due (the last comes 6 hours after the payment was opened). After that, a webhook makes it, or contact MPS with the payment reference. |
| An order is in Payment error | MPS approved less than the order total, or the cart was changed after the payment was opened. | Read the order's private note: it gives the amounts. |
Related
- Connect your webshop: the other shop systems, and the steps from test order to live
- Switch to live payments: from the test key to the live key
- For your developer: Webhooks, Payment lifecycle, Refunds and Test mode and test cards
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