Le module payement ViralPay, vous permet d'integrer rapidement le module de payement dans votre appplication web, avec le coude source ci contre.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
window['url']='https://payment.viralpay.cm/';
</script>
<script src="https://payment.viralpay.cm/assets/js/payment/main.js"></script>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<script>
function checkout() {
ViralPay.setConfig({
merchant_id: 'CODE_MERCHANT',// YOUR ACCOUNT ID
site_id: 'Web site ID',//YOUR_SITE_ID
notify_url: '',//http://mondomaine.com/notify/
mode: 'production'// production or test
});
ViralPay.getCheckout({
transaction_id: Math.floor(Math.random() * 100000000).toString(), // YOUR TRANSACTION ID
amount: 120,
tva: 0.1925,
currency: 'XAF',
channels: 'ALL',//ALL is for all avaibles methods of payment (CARD,MOMO,WALLET,PAYPAL)
description: 'Description',
//Provide these variables for credit card payments
customer_name:"CUSTOMER NAME",//Customer name
customer_surname:"CUSTOMER SURNAME",//The customer's first name
customer_email: "name@domain.tld",//the customer's email
customer_phone_number: "23767XXXXXXXX",//the customer's phone number
customer_address: "BP 007",//customer address
customer_city: "Douala",// The customer's city
customer_country: "CM",// the ISO code of the country
customer_state: "CM",// the ISO state code
customer_zip_code: "05632", // postcode
});
}
function getResponse(data)
{
alert(data.status);
if (data.status == "success") {
if (alert("Your payment has been made successfully")) {
window.location.reload();
}
} else if (data.status == "failed" || data.status == "cancelled") {
for(var i in data)
{
alert("data['"+i+"']="+data[i]);
}
if (alert("Your payment failed")) {
window.location.reload();
}
}
}
</script>
<link href="https://payment.viralpay.cm/assets/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div style="padding:20px;">
<button onclick="checkout()">Payer maintenant</button>
</div>
</body>
</html>