# Build with an AI coding assistant (/build-with-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. - 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.** The API cannot be called from a browser. The gateway answers no cross-origin (CORS) requests, and the API key must never reach a browser. Call it from your server. > **Warning.** Landing on 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`](/llms.txt): it follows the links to the pages it needs. One that cannot fetch needs [`/llms-full.txt`](/llms-full.txt) attached or added to the project. For a typed client, give it [`/openapi.json`](/openapi.json) as well. See [Ask a chat assistant](/build-with-ai/chat-assistant) for every file. ### Paste this prompt [#prompt] Replace the bracketed parts: ```text 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](#errors) below: each is a mistake assistants make often. ### Test every case Run the cases in [Test every case](/build-with-ai/vibe-coding#done-means) with the [test cards](/online-payments#test-mode) 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](/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](/build-with-ai/vibe-coding#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](/webhooks). | ## Related - [Build an app with a vibe-coding platform](/build-with-ai/vibe-coding): the same integration in Lovable, Bolt or v0 - [Integration examples](/integration-examples): one runnable server in C#, TypeScript, Python and PHP - [Payment lifecycle](/payment-lifecycle): every state and what to do with it