Build with an AI coding assistant
Point Cursor, Claude Code, Copilot or Codex at the MPS documentation and a ready-made prompt, then check what it wrote before you go live.
A coding assistant in your own project writes the integration with you: the backend calls, the return page and the webhook route. Give it the exact contract and the prompt below, and check its work against the mistakes assistants make.
Before you start
- A test key (
mps_test_…) and its signing secret from Online › API keys on the MPS platform - Cursor, Claude Code, Copilot, Codex or another assistant that edits your project
Server only
Warning
successUrl is not proof of payment. Verify the webhook signature, read the payment, and check its state, amount, currency, and reference before marking an order paid.Give it the documentation
An assistant that fetches URLs only needs /llms.txt: it follows the links to the pages it needs.
One that cannot fetch needs /llms-full.txt attached or added to the project. For a typed
client, give it /openapi.json as well. See Ask a chat assistant
for every file.
Paste this prompt
Replace the bracketed parts:
You are helping me integrate the MPS payment gateway.
Read the MPS documentation at https://docs.mps-emi.com/llms.txt and follow it exactly;
do not invent endpoints, fields or headers that are not documented there.
My stack: [e.g. Node.js 22 + Express backend].
I have these scopes: [internet:create internet:read].
My API key covers [one wallet | several merchant wallets].
Build:
1. A backend module that sends my API key in the Authorization header as a Bearer key on
every call, keeping the key server-side.
2. A checkout endpoint that stores the order with a new Idempotency-Key, creates an online
payment sending that key (retrying a failed create with the same key and body), stores
paymentReference with the order, and redirects the shopper to checkoutUrl.
3. A return handler that reads the payment on the backend and marks the order paid only on
executed with the full amount, with an update that only succeeds once.
4. A webhook receiver that verifies the signature and timestamp, stores the webhook in a
database inbox keyed on X-Mps-Delivery-Id, and only then answers 2xx — no work started
after answering. A worker processes the inbox: reads the payment, checks state, amount,
currency and reference against the order, settles it once, retries temporary failures with
backoff and records permanent ones.
Include error handling for every status code in the docs.Check what it wrote
Go through the Errors below: each is a mistake assistants make often.
Test every case
Run the cases in Test every case with the test cards before you switch to a live key.
Errors
| What the assistant did | What happens | Fix |
|---|---|---|
| Added an OAuth exchange | An API key is sent as it is on every call; there is nothing to exchange it for. | Send the key in Authorization on every call. See Authentication. |
| Put the API key in a browser or an app | Anyone can read it and create payments for you. | Keep it on your backend only. |
| Called the API from the page | The gateway allows no CORS: the call fails. | Call it from a server function. |
Opened the checkout in a frame, or a tab after an await | A gray screen, or a blocked popup. | Open the tab in the click handler, then point it at checkoutUrl. See Open the checkout. |
| Sent a merchant header with a merchant key | A test or merchant key acts for its own wallet. | Only a partner key names the merchant, with x-wallet-number. |
| Sent amounts in euros | 19.95 is refused, 19 asks for 19 cents. | Every amount is an integer number of cents. |
| Invented a discount field | There are no discount fields: a payment takes one price. | Send the final price in amount. |
Retried a create without an Idempotency-Key | A retry opens a second payment. | Generate a key once per checkout attempt and retry with the same key and body. |
| Trusted the success URL | Anyone can open it: an order is marked paid that was not. | Confirm with the read endpoint first. |
| Answered the webhook, then worked in the background | Work after the 2xx is lost if the process stops, and the webhook is not sent again. | Store it first, then answer. See Webhooks. |
Related
- Build an app with a vibe-coding platform: the same integration in Lovable, Bolt or v0
- Integration examples: one runnable server in C#, TypeScript, Python and PHP
- Payment lifecycle: every state and what to do with it
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
Vibe coding
Paste one prompt into Lovable, Bolt, v0 or a similar platform and get a shop that creates, opens and confirms MPS payments from its server side.
Chat assistant
Give ChatGPT, Claude, Gemini or your own agent one MPS page or the whole documentation as Markdown, so its answers follow the real contract.