{"id":574,"date":"2026-11-05T12:00:00","date_gmt":"2026-11-05T12:00:00","guid":{"rendered":"https:\/\/paymentsetu.com\/blog\/?p=574"},"modified":"2026-11-05T12:00:00","modified_gmt":"2026-11-05T12:00:00","slug":"webhooks-vs-polling-payment-status","status":"publish","type":"post","link":"https:\/\/paymentsetu.com\/blog\/webhooks-vs-polling-payment-status\/","title":{"rendered":"Webhook vs Polling for Payment Status: Which Is Better?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Webhook vs polling is a key decision when your website must know whether a UPI order has been paid. Use a webhook as the primary server-to-server event, then use a status check as a controlled fallback for return pages and reconciliation.<\/p>\n\n\n\n<aside class=\"ap-card\" aria-label=\"PaymentSetu Pro\">\n<span class=\"ap-card__badge\">Recommended for API teams<\/span>\n<div class=\"ap-card__body\"><p class=\"ap-card__name\">PaymentSetu Pro<\/p><p class=\"ap-card__best\">Best for growing WooCommerce \/ WHMCS stores and service businesses with up to 1,000 UPI payments a month (most popular)<\/p><ul class=\"ap-card__features\"><li>1,000 credits (1 credit = 1 successful payment verified)<\/li><li>0% commission, direct-to-bank UPI settlement<\/li><li>Dynamic QR, webhooks and API access<\/li><li>WooCommerce and WHMCS plugins<\/li><li>Priority support<\/li><\/ul><\/div>\n<div class=\"ap-card__side\"><p class=\"ap-card__price\">\u20b9999 <small>Most popular \u00b7 \u20b9999 \/ 30 days \u00b7 1,000 verified payments<\/small><\/p><a class=\"ap-card__btn\" href=\"https:\/\/paymentsetu.com\/auth\/register\">Get Pro \u2192<\/a><\/div>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Polling vs webhooks<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Polling means your application repeatedly asks an API for the latest state. For example, your checkout might call <code>GET \/api\/order_status\/{client_txn_id}<\/code> every few seconds until the order becomes successful, pending for too long, or reaches another terminal state.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A webhook reverses the direction. You expose an HTTPS endpoint, and the payment verification service sends an HTTP request to your server when it has a payment event for that order. Your application verifies the signed request, matches it to a local order, and changes the order state once.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The difference is easiest to remember this way:<\/p>\n\n\n\n<figure class=\"wp-block-table ap-table\"><table><thead><tr><th>Method<\/th><th>Who starts the request?<\/th><th>Best use<\/th><th>Typical timing<\/th><\/tr><\/thead><tbody><tr><td>Polling<\/td><td>Your application<\/td><td>A deliberate status read or reconciliation job<\/td><td>At the interval you choose<\/td><\/tr><tr><td>Webhook<\/td><td>The service sending the event<\/td><td>Server-side notification of a state change<\/td><td>When the event is available<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">HTTP is fundamentally a client-server protocol in which a client sends a request and receives a response. That is why polling feels natural in a browser or backend. A webhook is an application pattern built on HTTP: the service makes a request to your endpoint when it has something useful to report.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a UPI checkout, PaymentSetu is a payment verification service, not a payment gateway. The customer pays directly into your own connected Paytm Business or PhonePe Business merchant account; PaymentSetu matches the UTR and amount to the order and sends your application the verification event.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Webhook vs polling: strengths and trade-offs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Both patterns are useful, but they solve different problems. The right comparison is not \u201cwhich one replaces the other?\u201d It is \u201cwhich path handles the normal event, and which path gives me a safe way to check again?\u201d<\/p>\n\n\n\n<figure class=\"wp-block-table ap-table\"><table><thead><tr><th>Concern<\/th><th>Webhook<\/th><th>Polling<\/th><\/tr><\/thead><tbody><tr><td>Normal event delivery<\/td><td>The service pushes an event to your HTTPS endpoint<\/td><td>Your code keeps asking for the current state<\/td><\/tr><tr><td>Request volume<\/td><td>Usually one delivery per event, plus any documented retries<\/td><td>Grows with the number of open orders and polling attempts<\/td><\/tr><tr><td>Customer return page<\/td><td>Does not depend on the customer staying on the page<\/td><td>Can update a waiting page while the customer is present<\/td><\/tr><tr><td>Server requirements<\/td><td>Needs a public endpoint, signature verification and idempotent handling<\/td><td>Needs a protected server-side API call and an interval policy<\/td><\/tr><tr><td>Recovery and reconciliation<\/td><td>Works with a status read when you need to investigate or repair state<\/td><td>Naturally provides a fresh read, but needs a stopping rule<\/td><\/tr><tr><td>Fulfilment trigger<\/td><td>Good for marking an order paid after validation<\/td><td>Better as a check; do not create a new payment side effect from it<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Polling is not automatically wrong. It is useful for a customer-facing \u201cchecking payment\u201d screen, for a scheduled job that reviews old pending orders, and for recovering from an event that your local system has not recorded. It becomes wasteful when every browser polls forever, or when the browser is treated as the authority for fulfilment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Webhooks also need engineering care. A webhook endpoint must be reachable, authenticate the request, handle duplicate deliveries safely and return a response promptly. GitHub\u2019s <a href=\"https:\/\/docs.github.com\/en\/webhooks\/using-webhooks\/best-practices-for-using-webhooks\" target=\"_blank\" rel=\"noopener\">webhook best-practices documentation<\/a> is a useful general reference for HTTPS, secrets, event checks and redelivery handling; apply the same principles to a payment event.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The recommended pattern: webhook first, status check second<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For payment status, use this sequence:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Create the order on your server with a unique local reference.<\/li>\n\n\n<li>Display the returned QR or hosted payment page to the customer.<\/li>\n\n\n<li>Keep the local order in <code>pending<\/code> until a trusted server-side result is accepted.<\/li>\n\n\n<li>Receive the PaymentSetu webhook at your HTTPS endpoint.<\/li>\n\n\n<li>Verify the timestamp and HMAC signature over the exact raw request body.<\/li>\n\n\n<li>Check the order reference, amount and successful state against your database.<\/li>\n\n\n<li>Apply the paid transition once, store the UTR, and return a 2xx response.<\/li>\n\n\n<li>Use <code>GET \/api\/order_status\/{client_txn_id}<\/code> from your server when the return page needs a read or when a reconciliation job reviews a pending order.<\/li>\n\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This gives each path a clear job. The webhook is the event path that can update fulfilment without relying on the customer\u2019s browser. Polling is the read path that helps your application display or reconcile the latest known state.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do not mark an order paid just because the customer reached a redirect URL, closed a QR page, or showed a screenshot. Those are customer-facing signals. Your backend should make the state transition only after the signed webhook or a trusted status response matches the local order.<\/p>\n\n\n\n<aside class=\"ap-note\"><p>Keep the API key and webhook secret on your server. The browser may display a payment page, but it should never receive credentials that can create orders or read private payment data.<\/p><\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Create an order, then wait for the webhook<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">PaymentSetu\u2019s custom integration starts with <code>POST \/api\/create_order<\/code>. Keep this call on your backend and send the amount as an integer number of paisa. For example, \u20b9249 is <code>24900<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -X POST 'https:\/\/paymentsetu.com\/api\/create_order' \\\n  -H 'Authorization: Bearer YOUR_PAYMENTSETU_API_KEY' \\\n  -H 'Content-Type: application\/json' \\\n  -d '{\n    \"order_id\": \"ORD-20261023-1042\",\n    \"amount\": 24900,\n    \"redirect_url\": \"https:\/\/example.com\/payment-return\"\n  }'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the local <code>order_id<\/code>, expected amount and pending state before redirecting the customer. Use the response\u2019s payment URL or the integration path configured for your account to show the order-specific QR checkout. Never calculate the payable amount only from a hidden browser field; load prices from trusted server-side order data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your webhook handler should be short and deliberate:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>receive raw body and PaymentSetu timestamp\/signature headers\nverify HMAC-SHA256(timestamp + \".\" + raw body, API key)\nreject the request if the signature or timestamp is invalid\nparse JSON only after signature verification succeeds\nload the local order by the received order reference\ncompare amount and successful payment state\nrecord the UTR\/event identifier with a uniqueness rule\nchange pending to paid once\nreturn HTTP 200 after the database transaction commits<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The signature proves that the request was signed with the shared secret and that the body was not changed in transit. It does not remove the need to validate your order ID, amount, payment state and fulfilment rules. For a language-specific implementation, see the guide to <a href=\"https:\/\/paymentsetu.com\/blog\/verify-hmac-webhook-signature-php-python-node\/\">verifying HMAC webhook signatures in PHP, Python and Node.js<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Use polling as a controlled fallback<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The fallback endpoint is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GET \/api\/order_status\/{client_txn_id}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Call it from your server with the same bearer API-key authentication. URL-encode the transaction identifier and keep the response private. A simple request looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl 'https:\/\/paymentsetu.com\/api\/order_status\/ORD-20261023-1042' \\\n  -H 'Accept: application\/json' \\\n  -H 'Authorization: Bearer YOUR_PAYMENTSETU_API_KEY'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For a return page, your backend can perform one status read immediately after the customer comes back. If the result is still pending, let the page ask your own backend for a short period rather than exposing the PaymentSetu key to JavaScript. Your backend can either read its local order state, which the webhook updates, or make a carefully limited status check when appropriate.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For reconciliation, run a scheduled server-side job over orders that are still pending. Use a backoff schedule and a maximum age, such as checking more frequently at first and less frequently later. The exact interval should match your order expiry and operations needs; do not build an unbounded loop.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Reference\/Methods\/GET\" target=\"_blank\" rel=\"noopener\">MDN reference for GET<\/a> describes GET as safe and idempotent for retrieving data. That makes a status read suitable for retrying, but it does not mean every response is fresh forever, nor does it make a client-side read a payment confirmation by itself. Always inspect the returned order reference and amount before changing local state.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Make both paths safe to retry<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A payment integration must assume that network calls can be repeated. Your webhook may be delivered again, a status request may time out after the remote server has already answered, and a worker may restart after writing part of a database transaction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use these safeguards:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Give every payment order a unique <code>client_txn_id<\/code> or local order reference.<\/li>\n\n\n<li>Store the expected amount before creating the QR order.<\/li>\n\n\n<li>Verify HMAC over the raw webhook body before parsing or processing it.<\/li>\n\n\n<li>Store the webhook event or UTR with a database uniqueness constraint.<\/li>\n\n\n<li>Make the paid transition atomic: update only an order that is still <code>pending<\/code>.<\/li>\n\n\n<li>Treat a repeated valid event as an acknowledgement, not as a second fulfilment.<\/li>\n\n\n<li>Keep status checks read-only; do not create a new order from a retry of a status request.<\/li>\n\n\n<li>Log request IDs, order references and outcomes without logging API keys or webhook secrets.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The HTTP concept of idempotency means that repeating an identical request has the same intended effect as making it once. MDN\u2019s <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Idempotent\" target=\"_blank\" rel=\"noopener\">idempotency reference<\/a> explains why idempotent operations are safer to retry. Your application still has to enforce idempotent fulfilment because sending an email, releasing a download or activating a service can otherwise happen twice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A practical state machine for payment status<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Keep payment state separate from page state. The customer may leave the page while the payment is being matched, and a webhook may arrive before or after the return request.<\/p>\n\n\n\n<figure class=\"wp-block-table ap-table\"><table><thead><tr><th>Local state<\/th><th>What your application may do<\/th><th>What it should not do<\/th><\/tr><\/thead><tbody><tr><td><code>pending<\/code><\/td><td>Show \u201cpayment being checked\u201d; accept a verified event or status read<\/td><td>Fulfil the order from a screenshot or redirect alone<\/td><\/tr><tr><td><code>paid<\/code><\/td><td>Fulfil once, show the receipt and retain the UTR<\/td><td>Create a second fulfilment for a duplicate event<\/td><\/tr><tr><td><code>failed<\/code> or expired<\/td><td>Show the next supported action and retain the audit record<\/td><td>Silently turn it into <code>paid<\/code> from an unverified browser message<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The webhook handler and reconciliation worker should both use the same state-transition function. That avoids one code path checking an amount while another updates the order without the same validation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For WooCommerce, the <a href=\"https:\/\/paymentsetu.com\/woocommerce-plugin\">PaymentSetu WooCommerce plugin<\/a> provides the ready-made order integration. For a custom application, use the API and webhook flow above. In both cases, the principle is the same: direct UPI payment into your own merchant account, verified order matching, then an idempotent order update.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to choose the right implementation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Choose webhook-first when a payment event must trigger a server action, such as marking a WooCommerce order paid, activating a SaaS account, or updating a WHMCS invoice. It is also the cleaner architecture when customers may close their browser before the payment is matched.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add a status fallback when your return page needs to show current progress, when support staff need a server-side lookup, or when a scheduled reconciliation process reviews pending orders. Keep it bounded and authenticated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Polling-only can be reasonable for a small internal tool or an API that offers no webhook, but it requires a clear interval, timeout, terminal-state rule and request budget. When a signed webhook is available, using it as the normal event path usually gives your order system a simpler source of state changes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PaymentSetu Pro is <strong>\u20b9999 per 30 days<\/strong> for <strong>1,000 credits<\/strong>, with one credit representing one successful payment verified. It includes dynamic QR, webhooks, API access, a unified dashboard, real-time notifications and the WooCommerce and WHMCS integrations. See the <a href=\"https:\/\/paymentsetu.com\/#pricing\">PaymentSetu plans<\/a> or <a href=\"https:\/\/paymentsetu.com\/auth\/register\">create an account<\/a> when you are ready to connect the flow.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Is a webhook better than polling for payment status?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For server-side payment updates, use the webhook as the primary path because your application receives the event without repeatedly asking. Keep polling as a bounded fallback for return-page checks and reconciliation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should the browser poll the payment API directly?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. Keep the API key on your server and let the browser call your own backend if it needs a progress update. Your backend should decide whether to read local state, make a limited status request, or show that the order is still pending.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can a webhook arrive more than once?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Your handler should be safe if the same event is delivered again. Verify the signature, store a unique event or UTR, and update the order only when its current state is <code>pending<\/code>; then acknowledge a duplicate without repeating fulfilment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does a payment return URL confirm payment?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. A return URL only tells your application where the customer went after the payment page. Confirm the order with a verified PaymentSetu webhook or a trusted status response that matches the local reference and amount.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is the PaymentSetu status endpoint?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>GET \/api\/order_status\/{client_txn_id}<\/code> with bearer API-key authentication from your server. It is useful as a status read and reconciliation fallback; the normal automatic update path should remain the signed webhook.<\/p>\n\n\n\n<aside class=\"ap-cta\" aria-label=\"Verify UPI payments automatically\"><div class=\"ap-cta__content\"><p class=\"ap-cta__eyebrow\">Build the safer flow<\/p><p class=\"ap-cta__title\">Verify UPI payments automatically<\/p><p class=\"ap-cta__text\">Connect your merchant account, receive signed webhooks and reconcile orders through the API.<\/p><\/div><a class=\"ap-cta__btn\" href=\"https:\/\/paymentsetu.com\/auth\/register\">Create your account<\/a><\/aside>\n\n\n\n<p class=\"wp-block-paragraph\">DONE webhooks-vs-polling-payment-status words=2026<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Is a webhook better than polling for payment status?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"For server-side payment updates, use the webhook as the primary path because your application receives the event without repeatedly asking. Keep polling as a bounded fallback for return-page checks and reconciliation.\"}}, {\"@type\": \"Question\", \"name\": \"Should the browser poll the payment API directly?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. Keep the API key on your server and let the browser call your own backend if it needs a progress update. Your backend should decide whether to read local state, make a limited status request, or show that the order is still pending.\"}}, {\"@type\": \"Question\", \"name\": \"Can a webhook arrive more than once?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Your handler should be safe if the same event is delivered again. Verify the signature, store a unique event or UTR, and update the order only when its current state is pending; then acknowledge a duplicate without repeating fulfilment.\"}}, {\"@type\": \"Question\", \"name\": \"Does a payment return URL confirm payment?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. A return URL only tells your application where the customer went after the payment page. Confirm the order with a verified PaymentSetu webhook or a trusted status response that matches the local reference and amount.\"}}, {\"@type\": \"Question\", \"name\": \"What is the PaymentSetu status endpoint?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Use GET \/api\/order_status\/{client_txn_id} with bearer API-key authentication from your server. It is useful as a status read and reconciliation fallback; the normal automatic update path should remain the signed webhook. DONE webhooks-vs-polling-payment-status words=2026\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Compare webhook vs polling for payment status, then build a reliable webhook-first flow with PaymentSetu&#8217;s order API, status fallback and secure retries.","protected":false},"author":1,"featured_media":573,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[29],"tags":[110,143,142,30,28],"class_list":["post-574","post","type-post","status-publish","format-standard","has-post-thumbnail","category-upi-payment-verification","tag-api-integration","tag-payment-status","tag-polling","tag-upi","tag-webhooks","cs-entry"],"_links":{"self":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/comments?post=574"}],"version-history":[{"count":1,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/574\/revisions"}],"predecessor-version":[{"id":781,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/574\/revisions\/781"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/media\/573"}],"wp:attachment":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/media?parent=574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/categories?post=574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/tags?post=574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}