{"id":739,"date":"2026-11-22T12:00:00","date_gmt":"2026-11-22T12:00:00","guid":{"rendered":"https:\/\/paymentsetu.com\/blog\/?p=739"},"modified":"2026-11-22T12:00:00","modified_gmt":"2026-11-22T12:00:00","slug":"upi-payment-integration-flutter","status":"publish","type":"post","link":"https:\/\/paymentsetu.com\/blog\/upi-payment-integration-flutter\/","title":{"rendered":"UPI Payment Integration in Flutter: Order, Intent and Webhook"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">upi payment integration in flutter is safest when Flutter starts the payment but your server owns the order and confirmation. This guide connects a Flutter checkout to PaymentSetu with a server-created order, a <code>upi:\/\/pay<\/code> Intent, a status check when the customer returns and an HMAC-verified webhook.<\/p>\n\n\n\n<aside class=\"ap-card\" aria-label=\"PaymentSetu Pro\">\n<span class=\"ap-card__badge\">Recommended for apps<\/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\">Architecture: app, your server, PaymentSetu<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The mobile app should never decide that an order is paid. It can open a UPI app and display the current state, but only your backend should create the order, receive the verification event and fulfil the purchase.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The flow is:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Flutter sends your own cart or booking ID to your backend.<\/li>\n\n\n<li>Your backend validates the cart, creates a unique <code>client_txn_id<\/code> and calls <code>POST \/api\/create_order<\/code> with the exact amount.<\/li>\n\n\n<li>Your backend returns only the payment details needed by Flutter. The API key stays on the server.<\/li>\n\n\n<li>Flutter opens the returned UPI Intent with <code>url_launcher<\/code>.<\/li>\n\n\n<li>The customer reviews the payee and amount in a UPI app and authorises the payment.<\/li>\n\n\n<li>PaymentSetu matches the payment in your connected Paytm Business or PhonePe Business merchant account and sends your backend an HMAC-signed webhook.<\/li>\n\n\n<li>Your backend marks the order paid once. Flutter checks your backend when the app becomes active again.<\/li>\n\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This is a verification flow, not a payment gateway flow. The customer pays directly into your own connected merchant account; PaymentSetu matches the payment to the order and notifies your system. NPCI lists Intent as one of the UPI merchant integration modes in its <a href=\"https:\/\/www.npci.org.in\/what-we-do\/upi\/faqs\" target=\"_blank\" rel=\"noopener\">UPI FAQ<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What you need before coding<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: keeping ownership of the order, amount and secrets clear prevents a client-side callback from becoming a false payment confirmation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Prepare these items:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>A Flutter app with a checkout screen and a server-side API you control.<\/li>\n\n\n<li>A database order with a unique reference, expected amount and <code>pending<\/code>\/<code>paid<\/code> status.<\/li>\n\n\n<li>A PaymentSetu account, API key, webhook secret and connected Paytm Business or PhonePe Business merchant account.<\/li>\n\n\n<li>A public HTTPS webhook URL, such as <code>https:\/\/api.example.com\/webhooks\/paymentsetu<\/code>.<\/li>\n\n\n<li>The <code>url_launcher<\/code> package. The current package page documents Android and iOS support and the <code>launchUrl(Uri)<\/code> API; check its <a href=\"https:\/\/pub.dev\/packages\/url_launcher\" target=\"_blank\" rel=\"noopener\">latest setup notes<\/a> when you add it.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Add the package:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>flutter pub add url_launcher<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keep the API key and webhook secret in server environment variables. A Flutter release can be inspected or reverse-engineered, so a secret embedded in Dart code is not a secret.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Create the order server-side<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: the server must calculate the amount and create the reference before Flutter opens a payment app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Flutter should send a cart ID, not a price. Your backend loads the cart from its database, checks that it is still payable, saves a pending order and calls PaymentSetu. The endpoint is API-key authenticated:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Example Express-style server code. Keep this route on your backend.\napp.post('\/checkout\/create-upi-order', async (req, res) =&gt; {\n  const cart = await carts.findPayable(req.body.cartId);\n  if (!cart) return res.status(404).json({ error: 'Cart not found' });\n\n  const clientTxnId = `ORDER-${crypto.randomUUID()}`;\n  await orders.insertPending({\n    clientTxnId,\n    cartId: cart.id,\n    amount: cart.total,\n  });\n\n  const response = await fetch(\n    `${process.env.PAYMENTSETU_API_BASE}\/api\/create_order`,\n    {\n      method: 'POST',\n      headers: {\n        Accept: 'application\/json',\n        'Content-Type': 'application\/json',\n        \/\/ Use the API-key header format shown in your PaymentSetu account.\n        Authorization: `Bearer ${process.env.PAYMENTSETU_API_KEY}`,\n      },\n      body: JSON.stringify({\n        client_txn_id: clientTxnId,\n        amount: cart.total.toFixed(2),\n        webhook_url: 'https:\/\/api.example.com\/webhooks\/paymentsetu',\n      }),\n    },\n  );\n\n  if (!response.ok) {\n    return res.status(502).json({ error: 'Could not create payment order' });\n  }\n\n  const payment = await response.json();\n  \/\/ Map the response to your own stable mobile contract. Do not expose the API key.\n  return res.json({\n    clientTxnId,\n    amount: cart.total.toFixed(2),\n    upiUri: mapPaymentResponseToUpiUri(payment),\n  });\n});<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The function <code>mapPaymentResponseToUpiUri<\/code> is deliberately an application boundary: use the payment details returned by the PaymentSetu API instructions for your account. If the response gives you a hosted payment URL or QR data instead of a UPI URI, return that value and render or open it according to the documented response. Do not guess response keys or put the PaymentSetu credential in Flutter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use a server-generated reference and save it before the network call. If the request times out, your retry logic must reuse the same reference or reconcile it before creating another order. A duplicate reference is easier to reason about than two pending orders for one cart.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like this: your database has one pending order, the server has a unique <code>client_txn_id<\/code>, and Flutter receives an opaque <code>upiUri<\/code> plus the same reference and amount.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Build and open the UPI Intent in Flutter<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: the Intent should pre-fill the merchant, amount and order note, while the customer still confirms the payment inside their chosen UPI app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If your backend returns a complete URI, parse it and launch it. If it returns separate fields, construct the URI with a query string that encodes every value. <code>url_launcher<\/code> specifically recommends a custom encoding approach for non-HTTP schemes because the generic <code>queryParameters<\/code> constructor can encode spaces as <code>+<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:flutter\/material.dart';\nimport 'package:url_launcher\/url_launcher.dart';\n\nString encodeQueryParameters(Map&lt;String, String&gt; params) {\n  return params.entries\n      .map((entry) =&gt;\n          '${Uri.encodeComponent(entry.key)}=${Uri.encodeComponent(entry.value)}')\n      .join('&amp;');\n}\n\nUri buildUpiUri({\n  required String payeeVpa,\n  required String payeeName,\n  required String amount,\n  required String orderReference,\n}) {\n  return Uri(\n    scheme: 'upi',\n    host: 'pay',\n    query: encodeQueryParameters({\n      'pa': payeeVpa,\n      'pn': payeeName,\n      'am': amount,\n      'cu': 'INR',\n      'tn': orderReference,\n      'tr': orderReference,\n    }),\n  );\n}\n\nFuture&lt;bool&gt; openUpiPayment(Uri upiUri) {\n  return launchUrl(upiUri);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In a real app, <code>payeeVpa<\/code> and <code>payeeName<\/code> should come from the trusted order response or your configured merchant details, not from editable checkout text. Display the same amount and a recognisable order reference on your payment screen before the customer taps <strong>Pay by UPI<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Call the method from a user action and handle <code>false<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Future&lt;void&gt; startPayment(BuildContext context, Uri upiUri) async {\n  final opened = await openUpiPayment(upiUri);\n  if (!context.mounted) return;\n\n  if (!opened) {\n    ScaffoldMessenger.of(context).showSnackBar(\n      const SnackBar(content: Text('Could not open a UPI app. Try the QR option.')),\n    );\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Android 11 and later can require package-visibility entries when you call <code>canLaunchUrl<\/code>. The <code>url_launcher<\/code> documentation also notes that <code>canLaunchUrl<\/code> can return false even when a launch may work, so this example attempts <code>launchUrl<\/code> and handles failure rather than disabling the button after a possibly unreliable pre-check. Keep a QR and UPI ID fallback for devices where no installed app claims the <code>upi<\/code> scheme. On iOS, the hand-off likewise depends on an installed app and its URL-scheme support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like this: a tap opens a compatible UPI app with the intended payee and amount visible, and a failed hand-off leaves the order pending while offering a QR or manual fallback.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Poll <code>order_status<\/code> while the user returns<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: returning from a UPI app is only a navigation event. It is not proof that the customer completed, cancelled or even reached the final payment screen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Flutter can observe the <code>resumed<\/code> lifecycle state through <code>WidgetsBindingObserver<\/code>. The <a href=\"https:\/\/docs.flutter.dev\/flutter-for\/android-devs\" target=\"_blank\" rel=\"noopener\">Flutter lifecycle documentation<\/a> describes <code>didChangeAppLifecycleState<\/code>; use it to ask your own backend for the order state.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class PaymentPageState extends State&lt;PaymentPage&gt;\n    with WidgetsBindingObserver {\n  bool checking = false;\n  String orderState = 'pending';\n\n  @override\n  void initState() {\n    super.initState();\n    WidgetsBinding.instance.addObserver(this);\n  }\n\n  @override\n  void dispose() {\n    WidgetsBinding.instance.removeObserver(this);\n    super.dispose();\n  }\n\n  @override\n  void didChangeAppLifecycleState(AppLifecycleState state) {\n    if (state == AppLifecycleState.resumed) {\n      checkOrderOnServer();\n    }\n  }\n\n  Future&lt;void&gt; checkOrderOnServer() async {\n    if (checking) return;\n    setState(() =&gt; checking = true);\n    try {\n      final result = await api.getOrderStatus(widget.clientTxnId);\n      if (!mounted) return;\n      setState(() =&gt; orderState = result.status);\n    } finally {\n      if (mounted) setState(() =&gt; checking = false);\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>api.getOrderStatus<\/code> should call your backend. Your backend then calls <code>GET \/api\/order_status\/{client_txn_id}<\/code> with the API key and returns a small, safe response such as <code>pending<\/code>, <code>paid<\/code> or <code>failed<\/code>. Never call PaymentSetu directly from the app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use a modest retry schedule while the payment screen is visible\u2014for example, immediately on resume and then after a few seconds if the order is still pending. Stop after a bounded number of checks and let the customer tap <strong>Check again<\/strong>. The webhook remains the primary confirmation path; polling is a reconciliation fallback.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like this: reopening the app refreshes the order from your backend, but the app never changes a pending order to paid merely because the UPI app returned.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Handle the webhook on your backend<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: the signed webhook is the server-side event that lets you confirm the payment without trusting a mobile callback or screenshot.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your webhook handler should process the raw request body in this order:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Accept only the expected HTTP method and content type.<\/li>\n\n\n<li>Read the raw bytes and verify the HMAC signature with your webhook secret. Use the header name, algorithm, digest format and any timestamp rule specified in your PaymentSetu account.<\/li>\n\n\n<li>Parse JSON only after the signature passes.<\/li>\n\n\n<li>Find the local order by <code>client_txn_id<\/code> and compare the received amount with the amount saved before checkout.<\/li>\n\n\n<li>Record the UTR or transaction reference when present. See the <a href=\"https:\/\/paymentsetu.com\/blog\/what-is-utr-number-in-upi\/\">UTR number guide<\/a> if your support team needs a plain-language reference.<\/li>\n\n\n<li>Make the paid transition idempotent. A repeated event must not deliver the product twice.<\/li>\n\n\n<li>Return a 2xx response after the event is safely recorded.<\/li>\n\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The signature check has to use the exact raw bytes. A typical HMAC-SHA256 comparison has this shape, but treat it as a pattern\u2014not a replacement for the signature contract in your account:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const expected = crypto\n  .createHmac('sha256', process.env.PAYMENTSETU_WEBHOOK_SECRET)\n  .update(rawBody)\n  .digest('hex');\n\nconst valid =\n  receivedSignature &amp;&amp;\n  expected.length === receivedSignature.length &amp;&amp;\n  crypto.timingSafeEqual(\n    Buffer.from(expected),\n    Buffer.from(receivedSignature),\n  );\n\nif (!valid) return res.status(401).json({ error: 'Invalid signature' });<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not fulfil from a <code>success<\/code> string supplied by Flutter. The trusted transition is a transaction in your database that matches the signed event to the pending order, checks the amount and ignores an order already marked paid.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like this: a valid webhook updates one matching order exactly once, an invalid signature is rejected, and a duplicate delivery returns safely without duplicate fulfilment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Verify the complete Flutter flow<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: mobile app switching, server callbacks and database updates happen at different times, so test the sequence rather than only the button.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run this checklist in a test environment:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Start a checkout and confirm that the server\u2014not the app\u2014chooses the amount and creates the pending row.<\/li>\n\n\n<li>Confirm the response to Flutter contains no API key or webhook secret.<\/li>\n\n\n<li>Tap the Intent and check the payee name and amount before confirming in the UPI app.<\/li>\n\n\n<li>Return to Flutter and confirm the screen remains pending until your backend reports a verified state.<\/li>\n\n\n<li>Inspect your webhook logs for the <code>client_txn_id<\/code>, amount and UTR, without logging secrets or unnecessary personal data.<\/li>\n\n\n<li>Deliver the same signed webhook twice and confirm that fulfilment runs once.<\/li>\n\n\n<li>Change the amount in a test payload and confirm that the handler rejects the mismatch.<\/li>\n\n\n<li>Test the QR or UPI ID fallback on a device without a suitable Intent handler.<\/li>\n\n\n<li>Monitor verification credits with <code>GET \/api\/check_credits<\/code> so a production app can show an operational warning to staff before credits run out.<\/li>\n\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">For a custom Flutter checkout, PaymentSetu Pro is \u20b9999 per 30 days with 1,000 credits; one credit represents one successful payment verified. The plan also includes Dynamic QR, webhooks, REST API access, a unified dashboard, real-time notifications and the WooCommerce\/WHMCS plugins for businesses that use those platforms. PaymentSetu charges 0% commission on the payment, and the money goes directly to your own connected merchant account. See the <a href=\"https:\/\/paymentsetu.com\/#pricing\">current plans<\/a> before choosing a plan.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are comparing this custom route with a server-rendered implementation, the <a href=\"https:\/\/paymentsetu.com\/blog\/upi-payment-integration-php\/\">UPI payment integration in PHP guide<\/a> covers the same order, webhook and status concepts in PHP. The key rule is unchanged: verify the payment on the server before you deliver anything.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the wider server-side pattern behind a custom checkout, see <a href=\"https:\/\/paymentsetu.com\/blog\/accept-upi-payments-on-website-without-gateway\/\">how to accept UPI payments on a website without a gateway<\/a>. The Flutter version uses the same order reference and verification boundary, with a mobile Intent in place of a browser payment screen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors and fixes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The UPI app does not open.<\/strong> The device may not have an app registered for the <code>upi<\/code> scheme, or the URI may contain an unencoded space or special character. Build the query with component encoding, handle the <code>launchUrl<\/code> result and show a QR or UPI ID fallback.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><code>canLaunchUrl<\/code> says false on Android.<\/strong> Package visibility rules can affect <code>canLaunchUrl<\/code>, especially on Android 11 and later. Follow the <code>url_launcher<\/code> manifest guidance if you need the pre-check, but still handle the actual <code>launchUrl<\/code> result.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The app says paid after returning, but the order is pending.<\/strong> That is expected until your server receives and accepts the webhook or confirms the status through <code>order_status<\/code>. Do not treat the app-resume event or a UPI app result as the payment authority.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The webhook signature never matches.<\/strong> Hash the raw request bytes, not a parsed and re-serialised JSON object. Check the secret, header name, algorithm, digest encoding and timestamp construction against the account instructions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>One payment fulfils twice.<\/strong> Add a unique constraint on your internal order reference or event\/UTR reference and update the order inside a database transaction. Return success for a safely handled duplicate instead of running fulfilment again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The order amount is wrong.<\/strong> Calculate the amount from server-side product data and compare the webhook amount with the saved value. Never trust a price sent by the mobile client.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Can Flutter integrate UPI without putting a payment key in the app?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. Flutter can call your backend, receive the order-specific payment details and open the UPI Intent. Keep order creation, API-key authentication, status calls and webhook verification on your server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is returning from the UPI app a successful payment callback?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. It only tells you that control returned to your app. Ask your backend for the current order state and wait for the verified webhook or a trusted server-side status response before fulfilling the order.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does this work on Android and iOS?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Flutter <code>url_launcher<\/code> API supports both platforms, but the actual <code>upi:\/\/pay<\/code> hand-off depends on a compatible installed UPI app and its URL-scheme support. Provide a QR and readable UPI ID fallback, and test on the device types your customers use.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should the app poll PaymentSetu directly?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. The app should poll your own backend with <code>client_txn_id<\/code>. Your backend can call <code>GET \/api\/order_status\/{client_txn_id}<\/code> using the protected API key, while the webhook remains the normal confirmation path.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is the difference between this and a payment gateway integration?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In this flow, the customer pays directly to your own connected Paytm Business or PhonePe Business merchant account. PaymentSetu verifies the payment and sends a webhook; it is not a payment gateway and does not hold the funds.<\/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 your Flutter flow<\/p><p class=\"ap-cta__title\">Verify UPI payments automatically<\/p><p class=\"ap-cta__text\">Create server-side orders and confirm them with secure webhooks.<\/p><\/div><a class=\"ap-cta__btn\" href=\"https:\/\/paymentsetu.com\/auth\/register\">Start with PaymentSetu<\/a><\/aside>\n\n\n\n<p class=\"wp-block-paragraph\">The essential pattern is small: create the order on your server, open the Intent from Flutter, check status on resume and trust only the verified webhook or server-side status. That separation gives your mobile checkout a clear recovery path when the customer changes apps or the network returns at a different time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">DONE upi-payment-integration-flutter words=2115<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Can Flutter integrate UPI without putting a payment key in the app?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Yes. Flutter can call your backend, receive the order-specific payment details and open the UPI Intent. Keep order creation, API-key authentication, status calls and webhook verification on your server.\"}}, {\"@type\": \"Question\", \"name\": \"Is returning from the UPI app a successful payment callback?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. It only tells you that control returned to your app. Ask your backend for the current order state and wait for the verified webhook or a trusted server-side status response before fulfilling the order.\"}}, {\"@type\": \"Question\", \"name\": \"Does this work on Android and iOS?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"The Flutter url_launcher API supports both platforms, but the actual upi:\/\/pay hand-off depends on a compatible installed UPI app and its URL-scheme support. Provide a QR and readable UPI ID fallback, and test on the device types your customers use.\"}}, {\"@type\": \"Question\", \"name\": \"Should the app poll PaymentSetu directly?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. The app should poll your own backend with client_txn_id. Your backend can call GET \/api\/order_status\/{client_txn_id} using the protected API key, while the webhook remains the normal confirmation path.\"}}, {\"@type\": \"Question\", \"name\": \"What is the difference between this and a payment gateway integration?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"In this flow, the customer pays directly to your own connected Paytm Business or PhonePe Business merchant account. PaymentSetu verifies the payment and sends a webhook; it is not a payment gateway and does not hold the funds. The essential pattern is small: create the order on your server, open the Intent from Flutter, check status on resume and trust only the verified webhook or server-side status. That separation gives your mobile checkout a clear recovery path when the customer changes apps or the network returns at a different time. DONE upi-payment-integration-flutter words=2115\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Learn upi payment integration in flutter with server-side orders, UPI Intent, app-resume status checks and HMAC webhook confirmation for secure checkout.","protected":false},"author":1,"featured_media":738,"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":[244,242,243,30,28],"class_list":["post-739","post","type-post","status-publish","format-standard","has-post-thumbnail","category-upi-payment-verification","tag-api-integration-2","tag-flutter","tag-mobile-payments","tag-upi","tag-webhooks","cs-entry"],"_links":{"self":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/739","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=739"}],"version-history":[{"count":1,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/739\/revisions"}],"predecessor-version":[{"id":963,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/739\/revisions\/963"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/media\/738"}],"wp:attachment":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/media?parent=739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/categories?post=739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/tags?post=739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}