Singapay Home Page
Logo Icon
  1. Webhooks
  2. Webhook Retry Mechanism

⚙️ Retry Mechanism

Condition / HTTP StatusHandling Function$retryCount ValueMaximum RetriesDescription
500 (Internal Server Error)handleFailedHttpResponse()11 retry attemptThe merchant’s server is experiencing a problem.
503 (Service Unavailable)handleFailedHttpResponse()44 retry attemptsThe merchant is temporarily inaccessible.
400 / 404 (Bad Request / Not Found)handleFailedHttpResponse()22 retry attemptsThe endpoint might be incorrect or temporarily unavailable.
Redirect 307 / 308retryRedirect()-5 retry attempts (redirect)Redirects are followed up to 5 times.
Redirect 301 / 302 / 303handleFailedHttpResponse()-0 (no retry)Redirect is not followed (the endpoint needs to be updated).
Exception (including cURL error)catch(Exception $e)11 retry attemptFor example, a timeout, DNS error, or connection failure.
Other (default case)handleFailedHttpResponse()55 retry attemptsFor other statuses not covered by the conditions above.

⏱️ Interval Between Retries

  • Each retry is performed 1 minute after the previous attempt.
  • Retries are stopped once the maximum limit specified in the table above is reached.

🧾 Example Retry Flow (HTTP 503)

AttemptResponse StatusSystem ActionDelay Before Next Try
#15031st Retry1 minute
#25032nd Retry1 minute
#35033rd Retry1 minute
#45034th RetryDone (no more retries)

Total maximum retry time (if all attempts fail): approximately 4 minutes.


📩 Failure Notification

If the webhook still fails after the final retry attempt, our system will:

  • Log the failure in the database (accessible via the callback menu on the merchant dashboard).
  • Send a failure notification to the merchant’s email.

Merchants are advised to:

  1. Ensure the webhook endpoint returns an HTTP status of 200–299.
  2. Maintain server availability to receive callbacks from us.
  3. Avoid using redirects (301–308) on the webhook URL.

💡 Technical Notes

  • Retry counts are stored using a cache with a 15-minute TTL.
  • All callbacks and retries are logged in our database for auditing and debugging purposes.