Answer the question
In order to leave comments, you need to log in
How to avoid being redirected to the bank's website to pay for goods on our side of the online store?
I need to install online payment on the online store, the payment system from epay, so that the payment goes through, I need to send the data https://testpay.kkb.kz/jsp/process/logon.jsp, an example of the data can be seen at the link , how you can avoid redirection , and immediately pay on our website, thought through AJAX
$('#form').submit(function(e) {
e.preventDefault()
// console.log($(this).serialize())
$.ajax({
url: 'https://testpay.kkb.kz/jsp/process/logon.jsp',
method: 'POST',
data: $(this).serialize(),
async: true,
success(data){
console.log('success')
console.log(data)
},
error(data){
console.log('error')
console.log(data)
}
})
})
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");
require_once("kkbcsign.class.php");
$kkb = new KKBSign();
$kkb->invert();
$kkb->load_private_key("cert.prv", "1q2w3e4r");
$merchant = '<merchant cert_id="%certificate%" name="%merchant_name%"><order order_id="%order_id%" amount="%amount%" currency="%currency%"><department merchant_id="%merchant_id%" amount="%amount%"/></order></merchant>';
$merchant = preg_replace('/\%certificate\%/', MERCHANT_CERT_ID , $merchant);
$merchant = preg_replace('/\%merchant_name\%/', MERCHANT_NAME , $merchant);
$merchant = preg_replace('/\%order_id\%/', ORDER_ID, $merchant);
$merchant = preg_replace('/\%currency\%/', CURRENCY, $merchant);
$merchant = preg_replace('/\%merchant_id\%/', MERCHANT_ID, $merchant);
$merchant = preg_replace('/\%amount\%/', AMOUNT, $merchant);
$merchant_sign = '<merchant_sign type="RSA">'.$kkb->sign64($merchant).'</merchant_sign>';
$xml = "<document>".$merchant.$merchant_sign."</document>";
$xml = base64_encode($xml);
$Signed_Order_B64 = $xml;
$email = '[email protected]';
$Language = "rus";
$BackLink = "https://testpay.kkb.kz/jsp/client/pay.jsp";
$PostLink = "http://pay.aida.market/postlink";
$FailureBackLink = "https://testpay.kkb.kz/jsp/client/pay.jsp";
$template = "default.xsl";
function request($url, $postdata = null, $cookiefile = 'tmp/cookie.txt'){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CERTINFO, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3");
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if($postdata){
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata );
}
$html = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo $code;
if(!$html ){
$error = curl_error($ch).'('.curl_errno($ch).')';
echo '---error----';
echo $error;
}
curl_close($ch);
return $html;
}
file_put_contents("tmp/cookie.txt",'');
request('https://testpay.kkb.kz/jsp/process/logon.jsp',"Signed_Order_B64=".$Signed_Order_B64."&[email protected]&Language=rus&BackLink=https://testpay.kkb.kz/jsp/client/pay.jsp&PostLink=http://pay.aida.market/postlink&FailureBackLink=https://testpay.kkb.kz/jsp/client/pay.jsp&template=default.xsl");
echo $html;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question