Answer the question
In order to leave comments, you need to log in
How to connect unitpay widget?
Good evening, I wanted to try unitpay as a payment system on the site.
I took everything from the site, signature generation
function getFormSignature($account, $currency, $desc, $sum, $secretKey) {
$hashStr = $account.'{up}'.$currency.'{up}'.$desc.'{up}'.$sum.'{up}'.$secretKey;
return hash('sha256', $hashStr);
}
<script type="text/javascript">
this.pay = function() {
var payment = new UnitPay();
payment.createWidget({
publicKey: "А тут публичный ключ",
sum: 1,
account: "demo",
domainName: "unitpay.money",
signature: "<?=getFormSignature(2, 'RUB', 'Пробник', 1, 'Ну тут мой ключ приватный'); ?>",
desc: "Описание платежа",
locale: "ru",
});
payment.success(function (params) {
console.log('Успешный платеж');
});
payment.error(function (message, params) {
console.log(message);
});
return false;
};
</script>
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