Jump to content

Integration with bank payments


elGringo

Recommended Posts

Hello everyone, need an advice, having code from bank - script + html form

 

 

I want to open new window from UniGUI APP with script

<html>

<head>
<meta charset="utf-8">

 
<script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> 
<script type="text/javascript"> 
function makePayment(amount, orderId, description, name, email, phone) { 
var params = { 
//Код терминала (обязательный параметр), выдается банком. 
TerminalKey: "1491989692671DEMO", 
//Сумма заказа в копейках (обязательный параметр) 
Amount: amount, 
//Номер заказа (если не передан, принудительно устанавливается timestamp) 
OrderId: orderId, 
//Описание заказа (не обязательный параметр) 
Description: description, 
//Дополнительные параметры платежа 
DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, 
//Флаг открытия платежной формы во фрейме 
Frame: false
}; 
doPay(params); 
} 


makePayment('123', '123', '123', '123', '123', '123');
</script>

</html>

and give to this window params in spite of '123' - how to do that

 

 

full code example

<html> 
<head> 
<script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> 
<script type="text/javascript"> 
function makePayment(amount, orderId, description, name, email, phone) { 
var params = { 
//Код терминала (обязательный параметр), выдается банком. 
TerminalKey: "1491989692671DEMO", 
//Сумма заказа в копейках (обязательный параметр) 
Amount: amount, 
//Номер заказа (если не передан, принудительно устанавливается timestamp) 
OrderId: orderId, 
//Описание заказа (не обязательный параметр) 
Description: description, 
//Дополнительные параметры платежа 
DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, 
//Флаг открытия платежной формы во фрейме 
Frame: false
}; 
doPay(params); 
} 

</script> 
<style> .tinkoffPayRow { display: block; margin: 1%; width: 160px; } </style> 
</head> 
<body> 
<form name="TinkoffPayForm"> 
<input class="tinkoffPayRow" type="text" placeholder="Сумма заказа" name="paySum"> 
<input class="tinkoffPayRow" type="hidden" placeholder="Номер заказа" name="payOrder"> 
<textarea class="tinkoffPayRow" type="text" placeholder="Описание заказа" 
name="payDesc"></textarea> 
<input class="tinkoffPayRow" type="text" placeholder="ФИО плательщика" name="payName"> 
<input class="tinkoffPayRow" type="text" placeholder="E-mail" name="payEmail"> 
<input class="tinkoffPayRow" type="text" placeholder="Контактный телефон" 
name="payPhone"> 
<input class="tinkoffPayRow" type="button" 
onclick="makePayment(document.TinkoffPayForm.paySum.value.replace(/,/ig,'.') * 100, document.TinkoffPayForm.payOrder.value, 
document.TinkoffPayForm.payDesc.value, document.TinkoffPayForm.payName.value, 
document.TinkoffPayForm.payEmail.value, document.TinkoffPayForm.payPhone.value)" 
value="Оплатить"> 
</form> 
</body> 

</html>
Link to comment
Share on other sites

doing like this but doesn't work - just need open new window and transfer params there

<html>

<head>
<meta charset="utf-8">



<script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> 

<script type="text/javascript"> 
function makePayment(amount, orderId, description, name, email, phone) { 
var params = { 
//Код терминала (обязательный параметр), выдается банком. 
TerminalKey: "1491989692671DEMO", 
//Сумма заказа в копейках (обязательный параметр) 
Amount: amount, 
//Номер заказа (если не передан, принудительно устанавливается timestamp) 
OrderId: orderId, 
//Описание заказа (не обязательный параметр) 
Description: description, 
//Дополнительные параметры платежа 
DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, 
//Флаг открытия платежной формы во фрейме 
Frame: false
}; 
doPay(params); 
} 


function GetParam(search, name){ 
 
name=name+"="; 
var gp=""; 
if (search!='') { 
if (search.indexOf (name, 0)!=-1){ 
var startpos=search.indexOf(name, 0)+name.length; 
var endpos=search.indexOf("&",startpos); 
if (endpos<startpos) {endpos=search.length;} 
var gp=p.substring(startpos,endpos); 
} else { 
gp=""; } 
} 
else { 
gp=""; 
} 
return gp; 
} 



var p=window.location.search; 
var myAmount=GetParam(p, "amount"); 

makePayment(myAmount, '123', '123', '123', '123', '123');
</script>







</html>
Link to comment
Share on other sites

Not yet but i think it will work better then my)))

 

For the moment my approach works if to set ampersand to the end

UniSession.AddJS('window.open("/tinkoff.html?amount=123&")');

Now I will test your approach - don't want to give params in the URL!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...