MPS Documentation
Build an integration

Refund a payment

Refund an online payment in full or in part, as many times as you need, without ever refunding more than was paid.

A refund gives the shopper money back for a payment you took. One endpoint serves every payment method, so you never need to know how the shopper paid. You can refund in full or in parts, as many times as you need, until the paid amount is used up.

Granted on request

Refunds move money out of your merchant's balance, so a live key does not hold payments:refund unless MPS granted it to that key. Ask MPS when you request the key. A test key always holds it, so you can build against refunds before you go live.

Paid back the way it was paid

Refunds are available for online payments, however the shopper paid on the checkout. The refund follows how they paid: a card payment goes back to the card, and a payment made with the ANNA QR code goes back by bank transfer.

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.

Before you start

  • An API key that holds the payments:refund scope, for refunding and for reading refunds. A test key (mps_test_…) always holds it.
  • The paymentReference of the payment, as the create call returned it

A refund normally starts pending and first waits 4 hours, until its cancelableUntil (if MPS cannot schedule it, the 201 instead carries status failed with failureReason unknown, and nothing was refunded: see Response). Money cannot be called back once it is paid out, so this is the window in which you can cancel it. Then MPS sends it. A card refund is decided shortly after. A refund by bank transfer is sent only once the shopper's original transfer appears on MPS's bank statement, and stays pending until then; it can no longer be canceled while it waits. A payment made with ANNA is paid back to the bank account it came from, never to any other.

Request the refund

# Refund EUR 5.00 of a payment
# Prerequisite: export MPS_API_KEY=mps_test_…
curl -sS --fail-with-body -X POST "https://gateway.mps-emi.com/api/payments/test-d3b07384-d9a0-4c9b-8f3e-2a1b5c6d7e8f/refunds" \
  -H "Authorization: Bearer $MPS_API_KEY" \
  -H "Idempotency-Key: order-1234-refund-1" \
  -H "Content-Type: application/json" \
  -d '{"amount": 500, "reason": "requested_by_customer"}'

The gateway answers 201 Created with the refund in data, normally with status pending. The Location header points at the refund: /api/payments/{paymentReference}/refunds/{refundId}. Store refundId with your order.

Decide on status, not on the 201. In rare cases the 201 already carries status failed with failureReason unknown: MPS could not schedule the refund. Nothing is refunded and the amount is free again, so you can refund it again with a new Idempotency-Key. Do not show such a refund as on its way.

Request body

The payment is the one the path names: its paymentReference, exactly as the create call returned it.

FieldTypeRequiredDescription
amountintegerNoAmount to refund, in cents. 500 = EUR 5.00. Greater than zero and at most what is still refundable. Omit it to refund everything still refundable.
reasonstringNoOne of duplicate, fraudulent, requested_by_customer.

There is no merchant or wallet field: the API key decides whose payment it may refund. The currency is the payment's own.

Headers

HeaderRequiredDescription
Idempotency-KeyNoRecommended. At most 255 characters: letters, digits and punctuation, no spaces, such as a UUID or order-1234-refund-1. See Retrying safely.

Get a refund

Let MPS tell you the outcome, or read it. When the payment was created with a callbackUrl, its refunds send a webhook once decided: refund.refunded, refund.failed or refund.canceled. To read a refund:

# Read one refund
curl -sS --fail-with-body "https://gateway.mps-emi.com/api/payments/test-d3b07384-d9a0-4c9b-8f3e-2a1b5c6d7e8f/refunds/0b7d9c41-7f0e-4b8a-9d3c-2a1e5f6b7c8d" \
  -H "Authorization: Bearer $MPS_API_KEY"

The gateway answers 200 with the same data object as the create call (see Response). Read a pending refund again later.

Cancel a refund

Every refund waits 4 hours before it is sent, until the cancelableUntil it carries, and you can cancel it until then. A canceled refund reads canceled, nothing is paid back, and you can refund its amount again.

# Cancel a refund that was not sent yet
curl -sS --fail-with-body -X DELETE "https://gateway.mps-emi.com/api/payments/test-d3b07384-d9a0-4c9b-8f3e-2a1b5c6d7e8f/refunds/0b7d9c41-7f0e-4b8a-9d3c-2a1e5f6b7c8d" \
  -H "Authorization: Bearer $MPS_API_KEY"
StatusMeaning
204The refund is canceled. Canceling it again answers 204 too.
409 refund_not_cancelableIt can no longer be canceled: cancelableUntil has passed and it was sent, or it was already decided.
409 refund_in_progressOther refunds of the same payment were being changed at the same moment. Nothing changed; send the cancel again.
404No such refund of this payment for this merchant.

List a payment's refunds

# List the refunds of one payment
curl -sS --fail-with-body "https://gateway.mps-emi.com/api/payments/test-d3b07384-d9a0-4c9b-8f3e-2a1b5c6d7e8f/refunds" \
  -H "Authorization: Bearer $MPS_API_KEY"
200 OK
{
  "data": [
    {
      "refundId": "0b7d9c41-7f0e-4b8a-9d3c-2a1e5f6b7c8d",
      "paymentReference": "test-d3b07384-d9a0-4c9b-8f3e-2a1b5c6d7e8f",
      "status": "refunded",
      "amount": 500,
      "currency": "EUR",
      "reason": "requested_by_customer",
      "failureReason": null,
      "cancelableUntil": null,
      "createdAt": "2026-10-22T09:14:03Z"
    }
  ]
}

The list is oldest first. A payment with no refunds answers an empty list.

How much can be refunded

You can refund a payment as many times as you like, but never for more than was paid:

  • What is left = the executed amount, less every refund that is refunded or pending.
  • A failed or canceled refund does not count: you can refund its amount again.
  • Asking for more than is left answers 400 naming amount, with the amount still refundable in the message. Once nothing is left, every further refund answers 400 naming amount.

The payment's own read shows both figures. amountRefunded counts only refunds that are refunded; amountRemaining also subtracts the pending ones. Right after a refund of EUR 5.00 on a EUR 19.95 payment, while it waits its 4 hours:

# Read the payment
curl -sS --fail-with-body "https://gateway.mps-emi.com/api/payments/internet/test-d3b07384-d9a0-4c9b-8f3e-2a1b5c6d7e8f" \
  -H "Authorization: Bearer $MPS_API_KEY"
200 OK
{
  "data": {
    "paymentReference": "test-d3b07384-d9a0-4c9b-8f3e-2a1b5c6d7e8f",
    "state": "executed",
    "amount": 1995,
    "currency": "EUR",
    "amountRefunded": 0,
    "amountRemaining": 1495,
    "reference": "order-1234"
  }
}

Once the refund is paid out, amountRefunded is 500 and amountRemaining stays 1495.

Two refunds sent at the same moment cannot both pass when together they exceed the payment. MPS judges the second against the first one's reservation and refuses it.

Retrying safely

Send an Idempotency-Key with every refund, unique per refund you intend, for example order-1234-refund-1. If the response is lost and you send the same request again with the same key:

You resend…You get
The same body, after the first finishedThe first refund again, 201. Nothing is refunded twice.
The same body, while the first is still running409 with code idempotency_key_in_use. Wait a second and resend it unchanged.
A different body with the same key400 naming Idempotency-Key. Use a new key for a new refund.

A refund's key belongs to its payment and is kept as long as the refund: it does not expire, so the same key on the same payment always returns that refund. A request refused as invalid (400) does not use up its key.

Without a key, a resent request is a new refund, up to what is left of the payment.

A timeout is not a failure

If a refund comes back pending, or your request timed out, do not send a new refund without the same Idempotency-Key. The money may already be on its way back. Read the refund (or the payment's amountRemaining) before you decide.

Only your own payments

An API key can refund, and read the refunds of, only payments created for its own merchant. A payment of another merchant, an unknown reference and a refund id that is not yours all answer the same 404, never 403, so nobody can probe references.

The checkout URL grants nothing here: holding it lets a shopper pay, never refund.

Test mode

With a test key, refunds of test payments (test-… references) are simulated: no card is refunded and nothing is booked. A test refund waits and can be canceled exactly like a live one, and reads refunded once its cancelableUntil has passed. The response and the limits on what can be refunded are exactly as in live mode. A test key cannot refund a live payment, and a live key cannot refund a test payment: either answers 404.

What happens to your balance

MPS books an approved refund against the merchant that received the payment. The refunded amount is taken back from its balance, together with the fee its contract sets for the payment method, calculated on the refunded amount. The balance may go below zero; the next payout settles it.

Response

The create call (201), Get a refund (200) and each item of the list carry the same refund object:

201 Created
{
  "data": {
    "refundId": "0b7d9c41-7f0e-4b8a-9d3c-2a1e5f6b7c8d",
    "paymentReference": "test-d3b07384-d9a0-4c9b-8f3e-2a1b5c6d7e8f",
    "status": "pending",
    "amount": 500,
    "currency": "EUR",
    "reason": "requested_by_customer",
    "failureReason": null,
    "cancelableUntil": "2026-10-22T13:14:03Z",
    "createdAt": "2026-10-22T09:14:03Z"
  }
}
FieldTypeRequiredDescription
refundIdstringYesThe MPS refund id. Store it with your order; it is the key the read endpoint takes.
paymentReferencestringYesThe payment refunded.
statusstringYesrefunded, failed, canceled or pending. See Statuses.
amountintegerYesRefunded amount, in cents. When you omitted amount, this is what was still refundable.
currencystringYesISO currency code of amount.
reasonstringYesThe reason you gave, or null.
failureReasonstringYesOnly on failed: declined or unknown. Null otherwise.
cancelableUntilstringYesOn a pending refund that was not sent yet: until when you can cancel it (UTC). Null once it was sent or decided.
createdAtstringYesWhen the refund was requested (UTC).

Timestamps are RFC 3339 in UTC and can carry up to seven fractional digits (2026-10-31T02:20:35.2357206Z). Parse them with a parser that accepts fractions of a second; do not expect whole seconds.

Statuses

statusMeaningFinal?
refundedIt was paid back: the shopper gets the money back on their card or bank account.Yes
failedIt was refused (declined) or could not be sent (unknown). Nothing was refunded; the amount is free to refund again.Yes
canceledYou canceled it before it was sent. Nothing was refunded; the amount is free to refund again.Yes
pendingThe outcome is not known yet. The amount stays reserved until it is. A refund by bank transfer stays pending until the original transfer appears on MPS's bank statement.No

Read a pending refund again later with Get a refund. Treat any status you do not recognise as pending.

Errors

StatusCodeCauseResolution
400—The body names the field: a malformed paymentReference in the path, amount zero or less or more than is left, nothing left to refund, or an unknown reason.Fix the named field. See How much can be refunded.
400—An Idempotency-Key reused for a different request, or one with spaces or other characters than letters, digits and punctuation.Use a new key for a new refund, of letters, digits and punctuation only. See Retrying safely.
401—No API key, or a wrong or revoked one.Send a valid key. See Authentication.
403—The API key lacks payments:refund, or names no single merchant wallet. Checked before the body.Ask MPS to grant payments:refund to the key. A partner key names the merchant with x-wallet-number: see Choosing the merchant.
404—No such payment for this merchant, no such refund under it, or a test key used on a live payment (or the reverse).Check the reference and the key's mode. See Only your own payments.
409payment_not_refundableThe payment is not executed.Do not retry. See Conflicts.
409idempotency_key_in_useThe first request with this key is still running.Retry after a second with the same key and body. See Retrying safely.
409refund_in_progressAnother refund of the same payment is being changed at the same moment.Retry after a second. See Conflicts.
409refund_not_cancelableOn cancel: the refund was sent or decided.Do not retry; read the refund.
429—Rate limited.Wait for Retry-After, then retry. See Errors and rate limits.

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