post https://api-staging.pluralonline.com/api/v1/upi/process/payment/1
Use the below endpoint to Process Payment UPI.
Request Parameters:
Parameter Name | Type | Description |
---|---|---|
vpa* | string | VPA or UPI ID of the customer. For example, 9722xxx334@ybl. |
is_upi_to_be_saved | string | If VPA or UPI ID is to be saved for the future transactions without providing VPA details again then the value in the filed is to be passed is "true". Else the value passed it "false". |
country_code | string (Length = 10 Characters) | The country code of the mobile number of the customer. Country code for India is 91. |
mobile_number | string (Length = 20 Characters) | Mobile number of the customer. |
email_id | string (Length = 100 Characters) | Email id of the cusotmer. |
Request Body payload:
{
"upi_data": {
"vpa": "test5@upi",
"is_upi_to_be_saved": true,
"upi_option": "UPI"
},
"customer_data": {
"country_code": "91",
"mobile_no": "9582492891",
"email_id": "[email protected]"
}
}
Response Payload:
{
"content": "<!DOCTYPE html>\n<html>\n<head>\n <title>Payment in progress • Razorpay</title>\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <style>\n @-webkit-keyframes spin {\n 0%{-webkit-transform:scale(0.5);opacity:0;border-width:8px}\n 20%{-webkit-transform:scale(0.6);opacity:0.8;border-width:4px}\n 90%{-webkit-transform: scale(1);opacity:0}\n }\n @-moz-keyframes spin {\n 0%{-moz-transform:scale(0.5);opacity:0;border-width:8px}\n 20%{-moz-transform:scale(0.6);opacity:0.8;border-width:4px}\n 90%{-moz-transform:scale(1);opacity:0}\n }\n @keyframes spin {\n 0% {transform:scale(0.5);opacity:0;border-width:8px}\n 20% {transform:scale(0.6);opacity:0.8;border-width:4px}\n 90% {transform:scale(1);opacity:0}\n }\n\n html,body {\n font-family:'lato', -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;\n background: #FBFBFB;\n text-align: center;\n }\n\n .spin {\n width: 60px;\n height: 60px;\n margin: 0 auto;\n }\n\n .spin div {\n width: 100%;\n height: 100%;\n vertical-align: middle;\n display: inline-block;\n border-radius: 50%;\n border: 4px solid #3395ff;\n -webkit-animation: spin 1.3s linear infinite;\n -moz-animation: spin 1.3s linear infinite;\n -ms-animation: spin 1.3s linear infinite;\n -o-animation: spin 1.3s linear infinite;\n animation: spin 1.3s linear infinite;\n box-sizing: border-box;\n opacity: 0;\n }\n\n .spin2 {\n margin: -60px auto 0;\n }\n\n .spin2 div {\n animation-delay: 0.65s;\n }\n\n #spinner {\n margin: 20px 0 60px;\n }\n\n #content {\n max-width: 400px;\n margin: 0 auto;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n }\n\n .card {\n background: white;\n border-radius: 2px;\n box-shadow: 0px 4px 20px rgba(0,0,0,0.10);\n padding-bottom: 1px;\n }\n\n #message-txt b {\n display: block;\n font-size: 20px;\n padding: 0 25px 25px;\n }\n\n #message-txt {\n line-height: 26px;\n padding: 50px 30px 30px;\n font-size: 16px;\n opacity: 0.8;\n }\n\n .banner {\n padding: 24px;\n }\n\n .buttons {\n margin-top: 18px;\n line-height: 56px;\n }\n\n #retry-btn {\n background: #3395ff;\n color: #fff;\n cursor: pointer;\n }\n\n #cancel-btn {\n color: #3395ff;\n border-top: 1px solid #ececec;\n cursor: pointer;\n }\n\n .hide {\n display: none !important;\n }\n\n form {\n visibility: hidden;\n }\n\n </style>\n</head>\n<body>\n <div id='content'>\n <div class="banner">\n \n </div>\n\n <div class="card">\n <div id='message-txt'>\n Please accept the collect request sent to your UPI app\n </div>\n\n <div id="spinner">\n <div class="spin"><div></div></div>\n <div class="spin spin2"><div></div></div>\n </div>\n\n <div class="buttons">\n <div id="cancel-btn"><b>Cancel Payment</b></div>\n <div class="hide" id="retry-btn" onclick="initUpiActivity()"><b>Retry Payment</b></div>\n </div>\n </div>\n\n <div class="banner">\n <img src="https://cdn.razorpay.com/logo.png" id="logo" height="28px" style="height: 28px; margin: 20px auto;display: block;">\n </div>\n \n <form id="form" method="post"></form>\n <form id="form2" name="form2">\n <input name="type" id="form2_type" value="async">\n <input name="gateway" id="form2_gateway" value="eyJpdiI6IndDUTZcL1wveFM2bnAraDZnM09rMHFmdz09IiwidmFsdWUiOiJUc1hWeTEwVEgzcmtUUVM5VWJMYyt5TzJvRjVwKzkyNTFmUGJlZEdNSjl3PSIsIm1hYyI6IjM3MTU0NjAzYjQ0MjFkMmY4YTBiNzNlM2RiY2U0MTkxYjg2MjVlNDFjOWY1NWE5NTRhMmY1MmYzZGY0N2M1NTQifQ==">\n </form>\n </div>\n\n <script type="text/javascript">\n // Async Payment data //\n var data = {"type":"async","method":"upi","provider":null,"version":1,"payment_id":"pay_I7HPYZHDf6Ctgi","gateway":"eyJpdiI6IndDUTZcL1wveFM2bnAraDZnM09rMHFmdz09IiwidmFsdWUiOiJUc1hWeTEwVEgzcmtUUVM5VWJMYyt5TzJvRjVwKzkyNTFmUGJlZEdNSjl3PSIsIm1hYyI6IjM3MTU0NjAzYjQ0MjFkMmY4YTBiNzNlM2RiY2U0MTkxYjg2MjVlNDFjOWY1NWE5NTRhMmY1MmYzZGY0N2M1NTQifQ==","data":null,"request":{"url":"https:\\/\\/api.razorpay.com\\/v1\\/payments\\/pay_I7HPYZHDf6Ctgi\\/status?key_id=rzp_test_i00i1DaqSdP1bj","method":"get"},"org_logo":"","org_name":"Razorpay Software Private Ltd","checkout_logo":"https:\\/\\/cdn.razorpay.com\\/logo.png","custom_branding":false,"language_code":"en","nobranding":false};\n // Async Payment data //\n\n try { CheckoutBridge.setPaymentID(data.payment_id) } catch(e){}\n\n var request_url = data.request.url;\n var key_id = 'rzp_test_i00i1DaqSdP1bj';\n var payment_base = 'https://api.razorpay.com/v1/payments/' + data.payment_id;\n var cancel_url = payment_base + '/cancel?key_id='+key_id;\n var callback_url = payment_base + '/redirect_callback?key_id='+key_id;\n\n var $ = function (id) {\n return document.getElementById(id);\n }\n\n if (!Date.now) {\n Date.now = function () { return +new Date(); };\n }\n\n var form = $('form');\n var CheckoutBridge = window.CheckoutBridge;\n var iosBridge = window.webkit && webkit.messageHandlers && webkit.messageHandlers.CheckoutBridge;\n var isIntentFlow = (CheckoutBridge || iosBridge) && data.type === 'intent';\n\n if (data.type === 'async' && data.method === 'app' && data.provider === 'cred') {\n $('message-txt').innerText = 'Please complete the payment on the CRED app';\n }\n\n var lastXhr, lastPollTS, lastPollUrl;\n var threshold = 1000 * 20;\n var pollRetriesOnError = 5;\n var pollRetriesSoFar = 0;\n\n onfocus = function(e) {\n if (lastPollTS) {\n \n var timeSince = Date.now() - lastPollTS;\n\n \n if (lastPollUrl === request_url && timeSince > threshold) {\n lastXhr.abort();\n fetch(request_url, 1);\n track('ajax_periodic_retry', {\n last: {\n status: lastXhr.status,\n url: lastXhr.url,\n text: lastXhr.responseText\n },\n focus: !!e,\n time: timeSince\n })\n }\n }\n }\n\n \n setInterval(onfocus, 1000);\n\n \n\n function track(name, properties, cb) {\n setTimeout(function() {\n properties.CheckoutBridge = !!CheckoutBridge;\n properties.pageData = {\n type: data.type,\n data: data.data,\n key: key_id,\n payment_id: data.payment_id\n }\n var payload = {\n context: {\n user_agent: null\n },\n events: [{\n event: name,\n properties: properties,\n timestamp: Date.now()\n }]\n };\n\n if (key_id.slice(0, 5) === 'rzp_t') return console.log(payload);\n var call = new XMLHttpRequest();\n call.open('post', 'https://lumberjack.razorpay.com/v1/track', true);\n call.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n\n \n if (cb) {\n call.onreadystatechange = function() { if (call.readyState === 2) { cb() } }\n setTimeout(cb, 4e3);\n }\n\n call.send('key=MC40OTMwNzgyMDM3MDgwNjI3Nw9YnGzW&data=' +\n encodeURIComponent(btoa(JSON.stringify(payload))));\n })\n }\n\n function paymentCallback(data) {\n if (window.CheckoutBridge) {\n CheckoutBridge.oncomplete(JSON.stringify(data));\n } else if (iosBridge) {\n iosBridge.postMessage({\n action: 'success',\n body: data\n });\n } else {\n try { window.opener.onComplete(data) } catch(e){}\n try { (window.opener || window.parent).postMessage(data, '*') } catch(e){}\n setTimeout(close, 999);\n }\n }\n\n function openIntentUrl(intentUrl, payment_id) {\n if (window.CheckoutBridge) {\n CheckoutBridge.callNativeIntent(intentUrl);\n } else if (iosBridge) {\n iosBridge.postMessage({\n action: 'callNativeIntent',\n body: {\n intent_url: intentUrl,\n payment_id: payment_id\n }\n });\n }\n }\n\n \n\n var submitted_count = 0;\n function submitForm(response) {\n \n setTimeout(function() {\n track('no_redirect', {\n count: ++submitted_count\n });\n if (submitted_count && !(submitted_count % 2) && submitted_count < 10) {\n submitForm(response);\n }\n }, 10000);\n if (isIntentFlow) {\n paymentCallback(response);\n } else {\n if (response && response.type === 'return') {\n var req = response.request;\n var content = req.content;\n form.action = req.url;\n form.method = req.method;\n form.innerHTML = Object.keys(content)\n .map(function (name) { return '<input name="' + name + '" value="' + content[name] + '">' })\n .join('')\n } else {\n form.action = callback_url;\n }\n form.submit();\n }\n }\n\n function fetch(url, immediate) {\n var totalCalls = 0;\n\n function fetchAgain(timeout) {\n totalCalls++;\n \n if (totalCalls > 50 && !(totalCalls % 10)) {\n track('call_count', {\n count: totalCalls,\n url: url\n });\n }\n\n if (totalCalls > 180) {\n return submitForm();\n }\n\n setTimeout(function() {\n // If polling, set timestamp.\n lastPollUrl = url;\n lastPollTS = Date.now();\n\n lastXhr = new XMLHttpRequest();\n lastXhr.open('get', url, true);\n\n lastXhr.onreadystatechange = function() {\n if (lastXhr.readyState === 4 && lastXhr.status) {\n var json;\n try {\n json = JSON.parse(lastXhr.responseText);\n if (!json || typeof json !== 'object') {\n throw 'non object:' + json;\n }\n } catch(e) {\n json = {\n message: e.message,\n error: {\n description: 'Parsing error'\n },\n xhr: {\n status: lastXhr.status,\n text: lastXhr.responseText,\n url: url\n }\n };\n }\n if (json.status === 'created') {\n return fetchAgain();\n } else {\n try {\n if (\n json.razorpay_payment_id ||\n json.error ||\n json.version === 1\n ) {\n return submitForm(json);\n }\n } catch(e) {\n return handleAjaxError(e);\n }\n }\n handleAjaxError();\n }\n }\n lastXhr.onerror = handleAjaxError;\n lastXhr.send(null);\n }, timeout || 4000);\n }\n\n fetchAgain(immediate);\n }\n\n if (isIntentFlow) {\n var intent_url = data.data.intent_url;\n var payment_id = data.payment_id;\n\n function initUpiActivity() {\n try {\n openIntentUrl(intent_url, payment_id);\n $('spinner').className = 'hide';\n $('retry-btn').className = 'hide';\n $('message-txt').innerHTML = iosBridge ? "Please accept the request from Razorpay's VPA on your UPI app" : '<b>Select UPI App</b>Payment will be made to Razorpay\\'s VPA';\n window.pollStatus = function(resp) {\n if (!Object.keys(resp).length ||\n /txnId=(undefined|null|)(&|$)/i.test(resp.response) ||\n \n (/txnId=YBL/i.test(resp.response) && Object.keys(resp).indexOf('bleTxId') < 0)\n ) {\n \n \n // if (resp.isWebviewVisible === false || key_id === 'rzp_live_5WqsyF9dNRzsmf') {\n fetchWait(cancel_url);\n // }\n // $('cancel-btn').className = '';\n // $('retry-btn').className = '';\n // $('message-txt').innerHTML = 'Payment did not complete';\n // $('spinner').className = 'hide';\n\n $('message-txt').innerHTML = 'Please wait..';\n $('spinner').className = '';\n } else {\n fetchWait(request_url);\n }\n }\n } catch(e) {\n track('android_error', {\n error: e.message\n }, submitForm)\n }\n }\n initUpiActivity();\n } else {\n fetch(request_url);\n }\n\n $('cancel-btn').onclick = function() {\n fetchWait(cancel_url);\n }\n\n function fetchWait(url) {\n $('spinner').className = '';\n $('cancel-btn').className = 'hide';\n $('retry-btn').className = 'hide';\n $('message-txt').innerHTML = "Please wait...";\n fetch(url, 1);\n }\n\n function handleAjaxError(e) {\n var props = {\n text: lastXhr.responseText,\n status: lastXhr.status,\n url: lastPollUrl\n }\n if (e) {\n props.message = e.message;\n }\n\n \n track('ajax_error', props, !e && submitForm);\n\n \n if (e && pollRetriesSoFar < pollRetriesOnError) {\n pollRetriesSoFar++;\n fetch(lastPollUrl);\n }\n }\n </script>\n",
"payment_id": 433424,
"order_id": 106057,
"amount_in_paise": 1000000,
"merchant_name": null,
"merchant_logo": null,
"response_handler_url": "http://pluraldev.pinepg.in/api/v1/upi/razorpay/responsehandler",
"timer_page_time_out_in_seconds": 180,
"response_code": 1,
"response_message": "SUCCESS"
}
{
"response_code": 11001,
"response_message": "Sorry, your transaction has failed."
}
Response Parameters
Parameter Name | Type | Description |
---|---|---|
content | string | Html content to load the output data. |
payment_id | long | Unique payment id. |
order_id | long | Unique order id. |
amount_in_paise | long | Amount paid in paise. |
merchant_name | string | Merchant name. |
merchant_logo | string | Merchant logo. |
response_handler_url | string | Response handler url. |
timer_page_time _out_in_seconds | string | Timer count. |
response_code | string | Response code. |
response_message | string | Short message about code. |