首页 > 解决方案 > React JS 中的 PayuMoney 集成问题

问题描述

我正在尝试将 PayuMoney 集成到我的反应应用程序中,它始终会出现以下 404 错误。我什至通过了正确的哈希序列仍然给出了同样的错误!

在 componentDidMount 方法中:

componentDidMount() { 
    var hashString_1 = 'KEY|ORD569|6.00|P01,P02|Raajni|asdf@xxxx.com|||||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"]();
  };

表单提交处理PaymentSubmit

   <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> 

在我的 index.html 文件中:

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 );
  }
});
}

在控制台中收到以下错误。

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

标签: reactjspayumoney

解决方案


推荐阅读