Idempotency

Overview

Idempotency allows you to safely retry API requests without creating duplicate operations. You can label an API request with an Idempotency-Key, and the system will cache the original request for 250 minutes. If the same request is sent again using the same Idempotency-Key within this period, the system will return the exact same response instead of processing the request again.

This feature helps to:

  • Prevent sending multiple duplicate requests.
  • Avoid completing the same payment or refund more than once

How It Works

To use idempotency, include the following header in your API request:

Idempotency-Key: <unique-value>

The Idempotency-Key should be a unique value for each operation.
If a request with the same key is received again within the cache duration, the previously cached response will be returned.

curl --location 'https://apitest.myfatoorah.com/v3/payments' \
--header 'Idempotency-Key: req1' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--header 'Cookie: X-Oracle-BMC-LBS-Route=56f55515c92256899687eb6a49595b2f10a5707c' \
--data '{
  "PaymentMethod": "CARD",
  "Order": {
    "Amount": "10"
  }
}
{
    "IsSuccess": true,
    "Message": "",
    "ValidationErrors": null,
    "Data": {
        "InvoiceId": "6489780",
        "PaymentId": null,
        "PaymentURL": "https://demo.MyFatoorah.com/KWT/ie/01072648978042-fd8b9630",
        "PaymentCompleted": false,
        "TransactionDetails": null,
        "Card": null
    }
}
curl --location 'https://apitest.myfatoorah.com/v3/payments' \
--header 'Idempotency-Key: req1' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--header 'Cookie: X-Oracle-BMC-LBS-Route=56f55515c92256899687eb6a49595b2f10a5707c' \
--data '{
  "PaymentMethod": "CARD",
  "Order": {
    "Amount": "22"
  }
}
{
    "IsSuccess": true,
    "Message": "",
    "ValidationErrors": null,
    "Data": {
        "InvoiceId": "6489780",
        "PaymentId": null,
        "PaymentURL": "https://demo.MyFatoorah.com/KWT/ie/01072648978042-fd8b9630",
        "PaymentCompleted": false,
        "TransactionDetails": null,
        "Card": null
    }
}

Endpoints That Support Idempotency