# Repeat Flag and Idempotency
source: https://developer.mastercard.com/mastercard-send-disbursements/documentation/tutorials-and-guides/repeat-flag/index.md

> **At a Glance:**
>
> * Use Repeat Flag POST requests when there are timeouts, server errors, and bad format responses.
> * Use Idempotency as extra protection for high-volume or critical payment flows.

## Repeat Flag {#repeat-flag}

During typical processing, you send a POST request with a unique Disbursement Reference ID for each transaction request. However, in the following exception situations, you may be uncertain whether a transaction request (the 'original POST request') was received and processed by Mastercard Send and approved by the Receiving Institution (RI):

* [Issue between the client and Mastercard Send](https://developer.mastercard.com/mastercard-send-disbursements/documentation/tutorials-and-guides/exception-management/index.md#issue-between-the-client-and-mastercard-send)
* [Bad format response](https://developer.mastercard.com/mastercard-send-disbursements/documentation/tutorials-and-guides/exception-management/index.md#bad-format-response)

For these situations, Mastercard Send provides functionality that enables you to resend the same transaction request as a 'Repeat Flag POST request', which is a request conforming to the [Repeat Flag requirements](https://developer.mastercard.com/mastercard-send-disbursements/documentation/tutorials-and-guides/repeat-flag/index.md#repeat-flag-requirements) below. When Mastercard Send receives a properly formatted Repeat Flag POST request, it will either respond with the current transaction status (if it already processed the transaction request) or process this transaction request and return a 'PENDING' status.

Any API user can use the Repeat Flag feature. You do not need to request enablement of this feature.
Note: Repeat Flag POST requests must only be used as per the guidance in the following sections or when otherwise advised by Mastercard:

* [Procedure When Timeout or Server Error Response](https://developer.mastercard.com/mastercard-send-disbursements/documentation/tutorials-and-guides/exception-management/index.md#procedure-when-timeout-or-server-error-response)
* [Procedure When Bad Format Response](https://developer.mastercard.com/mastercard-send-disbursements/documentation/tutorials-and-guides/exception-management/index.md#procedure-when-bad-format-response)

Do not use Repeat Flag POST requests in typical non-exception scenarios.

### Repeat Flag Requirements {#repeat-flag-requirements}

To use the Repeat Flag functionality properly, the Repeat Flag POST request must:

* Have the `repeat-flag` header set to 'true'.

* Duplicate the payload fields and values from the original POST request exactly, especially:

  * Disbursement Reference
  * Amount
  * Currency
  * Recipient Account URI = Account Number and Expiration Date (Expiration Date is optional)
  * Recipient First name
  * Recipient Last name
  * Recipient Address Line1
  * Recipient Address Line2
  * Recipient Address City
  * Recipient Address Country Subdivision
  * Recipient Address Postal Code
  * Recipient Address Country
  * Card Acceptor ID, if provided
* Be submitted at least 40 seconds after, and within 24 hours of, the original POST request.

The `repeat-flag` header is not a standard HTTP header.

## Idempotency {#idempotency}

Idempotency is an extra opt-in feature supported by the Disbursement API that allows you to make the same POST request multiple times (without the `repeat-flag` header set to 'true') without worrying about the transaction being processed multiple times. If Mastercard Send detects that a request matches a previous transaction request processed within the preceding 24-hour period, it will return the current status of the transaction. Otherwise, it will process the request and provide the response.

The Idempotency feature is recommended for high-volume or critical payment flows. To make use of this feature, you must request enablement for Idempotency, during onboarding or later, by contacting your Mastercard representative.

### Idempotency Matching {#idempotency-matching}

A transaction is idempotent only when all the following fields match the values in an original transaction that was submitted during the preceding 24-hour period:

* Disbursement Reference
* Amount
* Currency
* Recipient Account URI = Account Number and Expiration Date (Expiration Date is optional)
* Recipient First name
* Recipient Last name
* Recipient Address Line1
* Recipient Address Line2
* Recipient Address City
* Recipient Address Country Subdivision
* Recipient Address Postal Code
* Recipient Address Country

Wait at least 40 seconds before resubmitting the same transaction request. We strongly recommend setting the subsequent transaction's `repeat-flag` header to 'true'.

## Which Do I Use? {#which-do-i-use}

The Repeat Flag feature and Idempotency use similar processing logic and field matching.

We advise that you:

* Use the Repeat Flag feature for exception situations as per the guidance in this API documentation set, even if you are already Idempotency-enabled.

* Consider Idempotency enablement if your disbursement solution involves high-volume or critical payment flows. Idempotency gives added protection when your API requests omit the `repeat-flag`='true' header.

