PayuMoney Integration Issues in React JS

907 Views Asked by At

I am trying to integrate PayuMoney in my react application, it gives following 404 error consistently. I even passing the right hash sequence still its giving the same error !

in componentDidMount Method:

componentDidMount() { 
    var hashString_1 = 'KEY|ORD569|6.00|P01,P02|Raajni|[email protected]|||||BOLT_KIT_NODE_JS||||||salt';                                              
    const shaObj = new jsSHA("SHA-512", "TEXT");
    shaObj.update(hashString_1);
    const hash = shaObj.getHash("HEX");

    this.setState ( {
      //Payu Fields Start
      surl:"http://localhost:3000/customer-payment-response",
      furl:"http://localhost:3000/customer-payment-response",
      hashCode : hash
      
      })
 }

handlePaymentSubmit = (event) => {
    event.preventDefault();
    console.log("Inside Pay Submit Function handle Submit  !!!!");
    window["launchBOLT"]();
  };

Form onsubmit handlePaymentSubmit

   <form id="payment_form" onSubmit={this.handlePaymentSubmit} class="php-email-form">
                
              <input type="hidden" value={this.state.key} name="udf5" id="key"/>
              <input type="hidden" value={this.state.salt} name="salt" id="salt"/>
              <input type="hidden" value={this.state.txnid} name="txnid" id="txnid"/>
              <input type="hidden" value={this.state.amount} name="amount" id="amount"/>
              <input type="hidden" value={this.state.pinfo} name="pinfo" id="pinfo"/>
              <input type="hidden" value={this.state.fname} name="fname" id="fname"/>
              <input type="hidden" value={this.state.email} name="email" id="email"/>
              <input type="hidden" value={this.state.mobile} name="mobile" id="mobile"/>
              <input type="hidden" value={this.state.udf5} name="udf5" id="udf5"/>
              <input type="hidden" value={this.state.surl} name="surl" id="surl"/>
              <input type="hidden" value={this.state.hashCode} name="hash" id="hash"/>
                  
   </form> 

in my index.html file:

function launchBOLT()
{

  console.log('inside...launch BOLT.....');
   
  bolt.launch({
    
  key: $('#key').val(),
  txnid: $('#txnid').val(), 
  hash: $('#hash').val(),
  amount: $('#amount').val(),
  firstname: $('#fname').val(),
  email: $('#email').val(),
  phone: $('#mobile').val(),
  productinfo: $('#pinfo').val(),
  udf5: $('#udf5').val(),
  surl : $('#surl').val(),
  furl: $('#surl').val()
},
  { responseHandler: function(BOLT){
  console.log( "BOLT.response.txnStatus : " );      
  console.log( BOLT.response.txnStatus );       
  if(BOLT.response.txnStatus != 'CANCEL')
  {
    // alert("....1.1...." );               
    //Salt is passd here for demo purpose only. For practical use keep salt at server side only.
    var fr = '<form action=\"'+$('#surl').val()+'\" method=\"post\">' +
    '<input type=\"hidden\" name=\"key\" value=\"'+BOLT.response.key+'\" />' +
    '<input type=\"hidden\" name=\"salt\" value=\"'+$('#salt').val()+'\" />' +
    '<input type=\"hidden\" name=\"txnid\" value=\"'+BOLT.response.txnid+'\" />' +
    '<input type=\"hidden\" name=\"amount\" value=\"'+BOLT.response.amount+'\" />' +
    '<input type=\"hidden\" name=\"productinfo\" value=\"'+BOLT.response.productinfo+'\" />' +
    '<input type=\"hidden\" name=\"firstname\" value=\"'+BOLT.response.firstname+'\" />' +
    '<input type=\"hidden\" name=\"email\" value=\"'+BOLT.response.email+'\" />' +
    '<input type=\"hidden\" name=\"udf5\" value=\"'+BOLT.response.udf5+'\" />' +
    '<input type=\"hidden\" name=\"mihpayid\" value=\"'+BOLT.response.mihpayid+'\" />' +
    '<input type=\"hidden\" name=\"status\" value=\"'+BOLT.response.status+'\" />' +
    '<input type=\"hidden\" name=\"hash\" value=\"'+BOLT.response.hash+'\" />' +
    '</form>';
    var form = jQuery(fr);
    jQuery('body').append(form);                
    alert("...1.2....."+ form );                
    form.submit();
  }
  }, 
  catchException: function(BOLT){
     alert("....1....."+ BOLT.message );
  }
});
}

Getting the following error in console.

GET https://sboxcheckout-static.citruspay.com/bolt/css/bolt_2_8.min.css net::ERR_ABORTED 404 (Not Found) catch block : Error in adding payment
0

There are 0 best solutions below