Last active
September 8, 2021 20:34
-
-
Save angebagui/bb7fa4d68665d27ba28ba88340e1874d to your computer and use it in GitHub Desktop.
Test CinetPay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<style> | |
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) { | |
body { | |
width: 100%; | |
} | |
} | |
</style> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script charset="utf-8" src="https://www.cinetpay.com/cdn/seamless_sdk/latest/cinetpay.prod.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
function onSuccess(){ | |
} | |
function onError(){ | |
} | |
function init() { | |
console.log("++++ INIT FUNCTION ++++"); | |
CinetPay.setConfig({ | |
apikey: document.getElementById('api_key').value, | |
site_id: parseInt(document.getElementById('site_id').value), | |
notify_url: document.getElementById('notification_url').value | |
}); | |
//-------------Gestion des evenements | |
//error | |
CinetPay.on('error', function (e) { | |
console.log('error found '+e); | |
console.log('error found '+JSON.stringify(e)); | |
// console.log('apikey '+api_key); | |
// console.log('site_id '+site_id); | |
// console.log('notification_url '+notify_url); | |
}); | |
//ajax | |
CinetPay.on('ajaxStart', function () { | |
console.log('ajaxStart'); | |
}); | |
CinetPay.on('ajaxStop', function () { | |
console.log('ajaxStop'); | |
}); | |
//Lorsque la signature est généré | |
CinetPay.on('signatureCreated', function (token) { | |
console.log('Tocken généré: ' + token); | |
}); | |
CinetPay.on('paymentPending', function (e) { | |
}); | |
CinetPay.on('paymentSuccessfull', function (paymentInfo) { | |
if(paymentInfo.cpm_result == '00'){ | |
onSuccess(); | |
}else{ | |
onError(); | |
} | |
}); | |
//Application des méthodes | |
CinetPay.setSignatureData({ | |
amount: parseInt(document.getElementById('amount').value), | |
trans_id: document.getElementById('trans_id').value, | |
currency: document.getElementById('currency').value, | |
designation: document.getElementById('designation').value, | |
custom: document.getElementById('cpm_custom').value | |
}); | |
CinetPay.getSignature(); | |
} | |
</script> | |
</head> | |
<body onload="init()"> | |
<!--body--> | |
<form id="info_paiement"> | |
<input type="hidden" id="api_key" value="18122291995d9845221e7d53.99745292"> | |
<input type="hidden" id="site_id" value="182538"> | |
<input type="hidden" id="notification_url" value="https://api.adjem.in/v3/invoice_payments/cinetpay/notify"> | |
<input type="hidden" id="amount" value="106"> | |
<input type="hidden" id="currency" value="CFA"> | |
<input type="hidden" id="trans_id" value="uyjItKt9RiSaaIQR2Gfr"> | |
<input type="hidden" id="cpm_custom" value=""> | |
<input type="hidden" id="designation" value="Paiement une commande"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment