Jump to content

Cpay payment module for prestashop


Recommended Posts

I need to create module for cpay payments

 

my website is https://e-print.mk/

 

i insert code in banka.php

 

https://e-print.mk/banka/banka.php

 

 

i have problem do conect shoping cart to $globalpay = 1

 

i try 

like 

$globalpay = $total_paid

$globalpay = ($ps_orders['total_paid']);

 

but no luck 

 

 

this is my code 

 

 
 
<?php
 
$globalpay = 1; // cena shto treba da se plati
$arr2 = "0001/0003/00010"; // unikatni redni broevi na narachkata so koi podocna ke vrshite detekcija dali e plateno ili ne
$mult = $globalpay * 100; // cenata shto treba da se plati pomnozena so 100
$customer_name = "Ime na korisnikot";
$customer_lastname = "Prezime na korisnikot";
$customer_address = "Adresa na korisnikot";
$customer_town = "Grad";
$customer_zip = "Postenski kod";
$customer_tel = "Telefonski broj";
$customer_email = "Email";
// CheckSum & CheckSumHeader
// step 1
$AmountToPay = $mult; // cenata shto treba da se plati pomnozena so 100
$PayToMerchant = "xxxxxxxxxxxxxx"; // ova ne treba da se menuva, vi go imaat dadeno od CaSys
$MerchantName = "xxxxxxxxxxxx"; // ova ne treba da se menuva, vi go imaat dadeno od CaSys
$AmountCurrency = "MKD"; // valuta vo koja se vrshi plakjanjeto
$Details1 = "Online prodavnica"; // Ovde mozete da napisete shto sakate
$Details2 = $arr2; // unikatnite redni broevi
$PaymentOKURL = "http://e-print.mk/banka/proverka.php?state=ok"; // strana kade formata kje prenasocuva koga plakjanjeto e uspeshno
$PaymentFailURL = "http://e-print.mk/banka/proverka.php?state=error"; // strana kade formata kje prenasocuva koga plakjanjeto e neuspeshno
$FirstName = $customer_name;
$LastName = $customer_lastname;
$Address = $customer_address;
$City = $customer_town;
$Zip = $customer_zip;
$Telephone = $customer_tel;
$Email = $customer_email;
$OriginalAmount = $globalpay; // cenata shto treba da se plati
$md5password = "TEST_PASS"; // za chudo ovde ne treba da ja napisete vashata lozinka tuku vaka treba da si ostane kaj sekogo
// step 2 - Vo ovie polinja se generira kolku karakteri sodrzi edno pole so zerofilled na 3 brojki, primer "Zdravo" sodrzi 6 bukvi i imate izgenerirano 006, ova kje vi bide potrebno podocna za generiranje na CheckSum i CheckSumHeader
$AmountToPay2 = sprintf("%03d", strlen($AmountToPay));
$PayToMerchant2 = sprintf("%03d", strlen($PayToMerchant));
$MerchantName2 = sprintf("%03d", strlen($MerchantName));
$AmountCurrency2 = sprintf("%03d", strlen($AmountCurrency));
$Details12 = sprintf("%03d", strlen($Details1));
$Details22 = sprintf("%03d", strlen($Details2));
$PaymentOKURL2 = sprintf("%03d", strlen($PaymentOKURL));
$PaymentFailURL2 = sprintf("%03d", strlen($PaymentFailURL));
$FirstName2 = sprintf("%03d", strlen($FirstName));
$LastName2 = sprintf("%03d", strlen($LastName));
$Address2 = sprintf("%03d", strlen($Address));
$City2 = sprintf("%03d", strlen($City));
$Zip2 = sprintf("%03d", strlen($Zip));
$Telephone2 = sprintf("%03d", strlen($Telephone));
$Email2 = sprintf("%03d", strlen($Email));
$OriginalAmount2 = sprintf("%03d", strlen($OriginalAmount));
// step 3
$CheckSumHeader = "16AmountToPay,PayToMerchant,MerchantName,AmountCurrency,Details1,Details2,PaymentOKURL,PaymentFailURL,FirstName,LastName,Address,City,Zip,Telephone,Email,OriginalAmount," . $AmountToPay2 . $PayToMerchant2 . $MerchantName2 . $AmountCurrency2 . $Details12 . $Details22 . $PaymentOKURL2 . $PaymentFailURL2 . $FirstName2 . $LastName2 . $Address2 . $City2 . $Zip2 . $Telephone2 . $Email2 . $OriginalAmount2;
$CheckSumHeader2 = $CheckSumHeader . $AmountToPay . $PayToMerchant . $MerchantName . $AmountCurrency . $Details1 . $Details2 . $PaymentOKURL . $PaymentFailURL . $FirstName . $LastName . $Address . $City . $Zip . $Telephone . $Email . $OriginalAmount . $md5password;
$CheckSum = md5($CheckSumHeader2);
// step 4 - jazik na formata za plakjanje dokolku imate prethodno cookie so koe odreduvate koj jazik go koristi kupuvachot, dokolku nemate avtomatski ke bide na Makedonski
if($_COOKIE['language'] == "mk"){
   $language = "mk-MK";
} else if($_COOKIE['language'] == "en"){
   $language = "en-US";
} else{
   $language = "mk-MK";
}
 
?>
 
 
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Naslov na stranata</title>
<link rel="icon" type="image/x-icon" href="images/favicon.png" />
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.png" />
</head>
<body>
<form name="aspnetForm" method="post" action="https://www.cpay.com.mk/client/Page/default.aspx?xml_id=/<?php echo $language; ?>/.loginToPay/.simple/" id="aspnetForm" target="cPayFrame">
<input id='AmountToPay' name='AmountToPay' value='<?php echo $AmountToPay; ?>' type='hidden' />
<input id='PayToMerchant' name='PayToMerchant' value='<?php echo $PayToMerchant; ?>' type='hidden' />
<input id='MerchantName' name='MerchantName' value='<?php echo $MerchantName; ?>' type='hidden' />
<input id='AmountCurrency' name='AmountCurrency' value='<?php echo $AmountCurrency; ?>' type='hidden' />
<input id='Details1' name='Details1' value='<?php echo $Details1; ?>' type='hidden' />
<input id='Details2' name='Details2' value='<?php echo $Details2; ?>' type='hidden' />
<input id='PaymentOKURL' size='10' name='PaymentOKURL' value='<?php echo $PaymentOKURL; ?>' type='hidden' />
<input id='PaymentFailURL' size='10' name='PaymentFailURL' value='<?php echo $PaymentFailURL; ?>' type='hidden' />
<input id='CheckSumHeader' name='CheckSumHeader' value='<?php echo $CheckSumHeader; ?>' type='hidden' />
<input id='CheckSum' name='CheckSum' value='<?php echo $CheckSum; ?>' type='hidden' />
<input id='FirstName' size='10' name='FirstName' value='<?php echo $FirstName; ?>' type='hidden' />
<input id='LastName' size='10' name='LastName' value='<?php echo $LastName; ?>' type='hidden' />
<input id='Address' size='10' name='Address' value='<?php echo $Address; ?>' type='hidden' />
<input id='City' size='10' name='City' value='<?php echo $City; ?>' type='hidden' />
<input id='Zip' size='10' name='Zip' value='<?php echo $Zip; ?>' type='hidden' />
<input id='Telephone' size='10' name='Telephone' value='<?php echo $Telephone; ?>' type='hidden' />
<input id='Email' size='10' name='Email' value='<?php echo $Email; ?>' type='hidden' />
<input id='OriginalAmount' name='OriginalAmount' value='<?php echo $OriginalAmount; ?>' type='hidden' />
<input class='button' value='Плати' type='submit'/>
</form>
<iframe src="simple.html" style="width:521px;height:500px;border:medium none;" name="cPayFrame" id="cPayFrame" frameborder="0" scrolling="auto"></iframe>
 
 
 
 
 
</body>
</html>
 
 
 
 
 
 
 

cPay_Testing Procedures And Production Implementation_v1.0.1_CaSys_MK.pdf

cPay_Merchant_integration_specification (One Step Integration)_v2.5.3_CaSys_MK.pdf

cPay_Testing Procedures And Production Implementation_v1.0.1_CaSys_MK (3).pdf

post-1166841-0-68977300-1489491796_thumb.jpg

post-1166841-0-71946000-1489491803_thumb.jpg

post-1166841-0-47773300-1489491812_thumb.jpg

Share this post


Link to post
Share on other sites

you need to create a payment module that adheres to the Prestashop PaymentModule specification.

 

You can read the developers documentation and learn how to develop a module, and then review other existing payment modules for some guidance.

 

Alternatively, you can post in the job offers forum if you wish to hire someone to create the module for you

Share this post


Link to post
Share on other sites

How to conect to database  

 

$globalpay = 1; to get data from shoping cart
$arr2 = "TtwK73814"; get data from shoping cart
$customer_name = "igor"; get data from shoping cart
$customer_lastname = "karagunov"; get data from shoping cart
$customer_address = "kiril i metodi br 20"; get data from shoping cart
$customer_town = "stip"; get data from shoping cart
$customer_zip = "2000"; get data from shoping cart
$customer_tel = "078584782"; get data from shoping cart
$customer_email = "ikaragunov@gmail.com"; get data from shoping cart

 

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More