Process Payment Card

When order creation is successful and successful response received by the merchant then the merchant needs to call second consecutive server to server call which would process the payment to create unique transction id. In this API call merchant need to pass Card/UPI/GPAY/Netbanking transaction related data.

Request Parameters:

Parameter NameTypeDescription
card_number*string
(Length=19 Characters)
Card number
cvv*string
(Length=6 Characters)
CVV
card_holder
_name*
string
(Length=150 Characters)
Name on the card.
card_expiry
_year*
string
(Length=2 Characters)
The year of card expiry. For example: "2025"
card_expiry
_month
string
(Length=4 Characters)
Card expiry month. For example if the card expiry month is March then the value to be sent is "03"
iscard_to
be_saved
Boolsaved card details ofr future use.
customer_data()
mobile_nostring
(Length = 20 Characters)
Vaild mobile number
country_codestring
(Length = 10 Characters)
Vaild country code.
email_idstring
(Length = 105 Characters)
Email of the user.
customer_token*stringGenerated customer token.

Request Body payload:

{
  "card_data": {
    "card_number": "4012001037141112",
    "cvv": "123",
    "card_holder_name": "BALWANT",
    "card_expiry_year": "2024",
    "card_expiry_month": "05",
    "is_card_to_be_saved": false
  },
  "customer_data": {
    "mobile_no": "xxx",
    "country_code": "91",//Optional If send then okay otherwise we are assigning default value
    "email_id": "[email protected]",
    "customer_token": "vQ7ssVqGlcfEUpGdzycwnQ=="
  }
}

Response Payload:

"content": "<!doctype html>\n<html>\n<head>\n  <title></title>\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <meta charset="utf-8" />\n  <meta name="viewport" content="width=device-width, initial-scale=1">\n  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>\n  <link href="https://fonts.googleapis.com/css?family=Muli:400,600,800" rel="stylesheet"/>\n</head>\n<script>\n  var events = {\n    page: 'gateway_otp_postform',\n    props: {\n          payment_id: 'pay_IpBZ16y9FkPLuJ',\n              merchant_id: 'DcIpvz549ymVaY',\n        },\n    load: true,\n    unload: true\n  }\n</script>\n<script>\n!function(e){e.track=Boolean;try{if(/razorpay\\.in$/.test(location.origin))return;if("object"!=typeof e.events)return;var n=e.events.props;if(0===Object.keys(n).length)return;var t,o=e.events,r=o.page,a=o.load,s=o.unload,i=o.error,c="https://lumberjack.razorpay.com/v1/track",u="MC40OTMwNzgyMDM3MDgwNjI3Nw9YnGzW",p="function"==typeof navigator.sendBeacon,d=Date.now(),f=[{name:"ua_parser",input_key:"user_agent",output_key:"user_agent_parsed"}];function l(e,o){(o=o||{}).beacon=p,o.time_since_render=Date.now()-d,o.url=location.href,function(e,n){if(e&&n)Object.keys(n).forEach(function(t){e[t]=n[t]})}(o,n);var a={addons:f,events:[{event:r+":"+e,properties:o,timestamp:Date.now()}]},s=encodeURIComponent(btoa(unescape(encodeURIComponent(JSON.stringify(a))))),i=JSON.stringify({key:u,data:s});p?navigator.sendBeacon(c,i):((t=new XMLHttpRequest).open("post",c,!0),t.send(i))}a&&l("load"),s&&e.addEventListener("unload",function(){l("unload")}),i&&e.addEventListener("error",function(e){l("error",{message:e.message,line:e.line,col:e.col,stack:e.error&&e.error.stack})})}catch(e){}e.track=l}(window);\n</script>\n\n<body>\n    <div id="preloading">\n        <style>\n            body {\n                background: #f4f4f4;\n            }\n        </style>\n        <style>\n@keyframes  lo{to{transform:rotate(360deg)}}@-webkit-keyframes lo{to{-webkit-transform:rotate(360deg)}}\n.loader{height:24px;width:24px;border-radius:50%;display:inline-block;\n  animation:lo .8s infinite linear;-webkit-animation:lo .8s infinite linear;\n  transition:0.3s;-webkit-transition:0.3s;\n  opacity:0;border:2px solid #3395FF;border-top-color:transparent}\n.vis{opacity:1}\n</style>\n<div class="loader vis" style="position:absolute;top:115px;left:50%;margin-left:-12px"></div>\n        <img src="https://cdn.razorpay.com/logo.svg" id="logo" height="35px" style="margin:30px auto 10px; display:block">\n    </div>\n  <script type="text/javascript">\n    // input data //\n    var data = {"type":"otp","request":{"url":"https:\/\/api.razorpay.com\/v1\/payments\/pay_IpBZ16y9FkPLuJ\/otp_submit\/4f3ae8d949e9be5ce4a0c70e08b7114bc8e06dc2?key_id=rzp_test_i00i1DaqSdP1bj","content":{"type":"otp","bank":"ICIC","next":["submit_otp","resend_otp"]},"method":"POST"},"version":1,"payment_id":"pay_IpBZ16y9FkPLuJ","gateway":"eyJpdiI6ImUrXC8zWktKRFFycUdnS04zU3pybTV3PT0iLCJ2YWx1ZSI6ImM1dlNmR2pGQ3czZlM2cnZVNEQ3bnh0NlFkUmY2STdpSmowXC9ETW9LV0dZPSIsIm1hYyI6IjlkNTVhNjU5Y2NiMzA5MTdhMTNmYjU0YmI4MjgwOGQ2NzY3OTFlYTVlOGNiZDA4NGIwMDU1NGEzZjAxMzgxZjUifQ==","contact":"+919050157978","amount":"5.00","formatted_amount":"₹ 5","wallet":null,"merchant":"Test","merchant_id":"DcIpvz549ymVaY","theme_color":"#3594E2","nobranding":false,"redirect":"https:\/\/api.razorpay.com\/v1\/payments\/pay_IpBZ16y9FkPLuJ\/authentication\/redirect?key_id=rzp_test_i00i1DaqSdP1bj","metadata":{"issuer":"HDFC","network":"VISA","last4":"1112","iin":"401200"}};\n    // input data //\n    try { CheckoutBridge.setPaymentID(data.payment_id) } catch(e){}\n  </script>\n  <div id="app"></div>\n  <script type="text/javascript" src="https://cdn.razorpay.com/static/otp/bundle.js" charset="utf-8"></script>\n  \n  <form class="card" id="otpform" name="otpform" action="https://api.razorpay.com/v1/payments/pay_IpBZ16y9FkPLuJ/otp_submit/4f3ae8d949e9be5ce4a0c70e08b7114bc8e06dc2?key_id=rzp_test_i00i1DaqSdP1bj" method="post">\n    <input id='otp' type="hidden" name="otp" maxlength="6">\n  </form>\n  <form id="form2" name="form2">\n    <input type="hidden" name="type" value="otp">\n    <input type="hidden" name="gateway" value="eyJpdiI6ImUrXC8zWktKRFFycUdnS04zU3pybTV3PT0iLCJ2YWx1ZSI6ImM1dlNmR2pGQ3czZlM2cnZVNEQ3bnh0NlFkUmY2STdpSmowXC9ETW9LV0dZPSIsIm1hYyI6IjlkNTVhNjU5Y2NiMzA5MTdhMTNmYjU0YmI4MjgwOGQ2NzY3OTFlYTVlOGNiZDA4NGIwMDU1NGEzZjAxMzgxZjUifQ==">\n  </form>\n</body>\n</html>\n",
    "payment_id": 1013174,
    "order_id": 33902,
    "amount_in_paise": 500,
    "response_code": 1,
    "response_message": "Payment Successful!"
}
{}

Response Parameters

Parameter NameTypeDescription
contentstringHtml content to load the output data.
payment_idlongUnique payment id.
order_idlongUnique order id.
amount_in_paiselongAmount paid in paise.
response_codestringResponse code.
response_messagestringShort message about code.
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!