# Accept payments in Odoo (/odoo) > Install the MPS payment provider, paste your API key, and take MPS payments in Odoo without writing code. The **MPS** payment provider for Odoo adds **Powered by MPS** as a payment method to your Odoo: on the eShop, on Odoo's own payment links and on portal invoices. Your customer pays on the MPS checkout and comes back to Odoo, and the payment is registered once MPS confirms it. You install it as an Odoo app and paste two codes from the MPS platform. The provider sends the order amount, order number and your shop's return addresses to MPS (Mobile Payment Solutions) to open each payment. Get it from the [Odoo Apps Store](https://apps.odoo.com/apps/modules/20.0/payment_mps), or [download payment_mps.zip](https://github.com/mps-emi/plugins/releases/download/odoo-latest/payment_mps.zip) — always the latest version. Every version is in its [releases on GitHub](https://github.com/mps-emi/plugins/releases?q=odoo&expanded=true), with the [source](https://github.com/mps-emi/plugins/tree/main/odoo). - Odoo 20, Community or Enterprise, on your own server or on Odoo.sh - Orders in euro (EUR) - A test API key and its webhook signing secret, from **Online › API keys** on the MPS platform. [Connect your webshop](/connect-your-webshop#create-a-test-key) 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](#for-your-host-or-developer). Odoo Online (the odoo.com SaaS) does not install third-party addons, from the Apps Store or uploaded. Run Odoo yourself or on Odoo.sh to use the MPS provider. ## Install and connect Get the addon from the [Odoo Apps Store](https://apps.odoo.com/apps/modules/20.0/payment_mps). It is free. - **On Odoo.sh:** click **Deploy on Odoo.sh** on the listing, or commit the `payment_mps` folder to your repository. - **On your own server:** click **Download for v 20.0** (or use the download above), unzip it into a folder on your addons path, and restart Odoo. Turn on developer mode, open **Apps**, click **Update Apps List**, search for **MPS** and click **Activate**. Open **Invoicing › Configuration › Payment Providers** (or **Website › Configuration › Payment Providers**) and click **Powered by MPS**. On the **Configuration** tab, paste your test key in **API Key**, and under **Advanced** its webhook signing secret in **Webhook Signing Secret**. Click **Publish** so the provider is offered at checkout, and save. The provider sends the API key with every call. Saving checks the key with MPS straight away. If MPS refuses the key, Odoo says so and nothing is saved ([Troubleshooting](#errors)). While a test key is in use, the provider form shows *This is a test key*. Pay an order, a payment link or a portal invoice with one of the [test cards](/online-payments#test-mode). The Odoo transaction moves to **Confirmed**, as [How payments are confirmed](#how-payments-are-confirmed) describes. Go live: replace the test key with your live key and its webhook signing secret, and save. See [Switch to live payments](/take-live-payments#a-shop-plugin) for what MPS needs first. A provider needs an API key to be enabled or published; without one, saving says *Fill in the API key from the MPS platform (Online › API keys) before enabling or publishing MPS.* ## 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](/online-payments#test-mode), no card is charged and nothing is paid out. Payments still confirm or fail exactly as they do in live mode. A test key does not expire. It works until you revoke it. Odoo's own **Live** switch on the provider makes no difference to MPS: the key decides. ## How payments are confirmed The provider never takes the shopper's return to Odoo as proof of payment. It reads the payment from MPS and moves the Odoo transaction on what MPS says: | MPS payment | Odoo transaction | |---|---| | Paid, full amount | **Confirmed**: the payment is registered and the sale order confirmed (unless the quotation still waits for the shopper's online signature: Odoo confirms only signed quotations). The payment reference is the Odoo transaction's **Provider Reference**. | | Paid, less than the order total | **Pending**, with a message. A card issuer can approve part of an amount; check before delivering. | | Failed | **Canceled**. The shopper can pay again. | | Shopper left without paying | **Canceled**. The order stays payable. | The provider reads the payment when the shopper comes back, when MPS sends a webhook, and on a schedule at 10 minutes, 30 minutes, 1 hour and 6 hours after the payment was opened. A payment is confirmed even when the shopper closes the tab before returning, if it is paid within those 6 hours or a webhook arrives. ## Refunds Refund an MPS payment with Odoo's **Refund** button on the payment record: open the paid invoice and its payment. Refund in full or in parts. A refund still in progress is checked again after 10 minutes, 30 minutes, 1 hour and 6 hours. 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](/refunds#cancel-a-refund) until then. ## Updates Odoo does not update addons by itself. To update, replace the `payment_mps` folder with the one from the latest version (on the [Odoo Apps Store](https://apps.odoo.com/apps/modules/20.0/payment_mps) or in the download above), restart Odoo, and click **Upgrade** on the MPS app in **Apps**. ## Not supported yet - Currencies other than EUR. The provider is not offered when the order's currency is not EUR. - Saving cards for later payments. ## For your host or developer [#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 provider 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 Odoo is reachable on a public HTTPS address (its **web.base.url**). MPS cannot reach an Odoo on `localhost` or a private network; - the **webhook signing secret** of your key is pasted in the provider. The provider ignores every webhook while the field is empty. When either is missing, a payment 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](/payment-lifecycle#a-late-anna-payment), while the shopper does not come back, is confirmed only by a webhook. Set up webhooks for a live shop. ### 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 provider checks the signature and that the webhook is less than five minutes old, and refuses anything that does not match with `401`. A webhook for a payment this Odoo database does not know is answered `200` and ignored, unchecked. | | | |---|---| | 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 | The MPS provider › **Configuration** › **Advanced** › **Webhook Signing Secret** | | When it matters | Only when your Odoo is on a public HTTPS address: without the signing secret pasted, the provider ignores webhooks | Without the signing secret pasted, the provider ignores webhooks and confirms payments by its scheduled reads and the shopper's return. Paste it to get orders confirmed the moment the payment arrives. Even a checked webhook only tells the provider to read the payment from MPS, and the Odoo transaction is moved on what MPS answers, so a forged webhook cannot mark an order paid. 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 [#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 [#connect-an-older-setup] The MPS add-on 20.0.2.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 takes a provider without an API key offline, so MPS is not offered at checkout until you paste the API key from the MPS platform (**Online › API keys**) on the provider and enable it again. API keys need addon version 20.0.1.1.0 or later. ### How the key check works [#how-the-key-check-works] For your developer or host. To check a key on save, the provider 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 [#errors] | What you see | Cause | What to do | |---|---|---| | MPS is not offered at checkout | The provider is not published, the order is not in EUR, or the MPS payment method is disabled on the **Payment Methods** tab. | Click **Publish**, enable the MPS payment method, and use EUR. | | *MPS did not accept these credentials* on save | A wrong or revoked 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](/authentication#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](/authentication#api-key-errors). | | *Fill in the API key from the MPS platform (Online › API keys) before enabling or publishing MPS.* on save | The provider is enabled or published without an API key. | Paste an API key. | | *Success URL must be an absolute HTTPS URL* in the log | Odoo runs behind a reverse proxy that ends HTTPS, without `proxy_mode = True` in its configuration, so it sends MPS `http://` return addresses. | Turn on proxy mode and make the proxy pass `X-Forwarded-Proto` and `X-Forwarded-Host`. | | The checkout shows an error instead of sending the shopper to MPS | Opening the payment at MPS failed. | Read the Odoo server log, logger `odoo.addons.payment_mps`: every call to MPS is logged with its answer. | | *Notification refused: signature or timestamp does not match* in the log | 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](#webhook-signing-secret). | | An Odoo transaction stays *Pending* after paying | No webhook was acted on (Odoo is not on a public HTTPS address, or the webhook signing secret is not pasted in the provider), and Odoo could not reach MPS when the shopper returned. | Wait for the next scheduled read: 10 minutes, 30 minutes, 1 hour or 6 hours after the payment was opened. Paid after the 6-hour read, it is confirmed only by a webhook: set up [Webhooks](#webhooks), and contact MPS with the MPS payment reference. | ## Related - [Connect your webshop](/connect-your-webshop): the other shop systems, and the steps from test order to live - [Switch to live payments](/take-live-payments#a-shop-plugin): from the test key to the live key - For your developer: [Webhooks](/webhooks), [Payment lifecycle](/payment-lifecycle), [Refunds](/refunds) and [Test mode and test cards](/online-payments#test-mode)