3

Hello Guys I have a problem. I cant find good documentation on how to code a payment interface if i want to pay via mobile. Heres the scenario Customer adds goods to cart Customer selects Pay via Mobile option Customer follows instructions Sends cash to stores number Customer enters the code recieved as reciept on website Pay is confirmed

I have the PHP script done in but i cant convert it to cs cart structure

Heres the Script

<?php
set_include_path("../mall/include:" get_include_path());
require_once("PLUSPEOPLE/autoload.php");

$pesa=new PLUSPEOPLE\PesaPi\PesaPi();

if (isset($_POST["receipt"]){
$transactions=$pesa->locateByReceipt($_POST["receipt"]);
if(count($transactions)>0){
    echo"Pay Recieved";
?>
<?php }
else{
?>
    <html>
    <head></head>
    <body>
    Pay not recieved Re Enter the Transaction Receipt<br>
    <form method="post" action="buy.php">
    <input type="text" name="receipt" value="">
    <input type="submit" name="ok" value="Send Receipt">
    </form>
    </body>
    </html>
<?php   
} else{
?>
<html>
    <head></head>
    <body>
    Please Pay this Amount<br>
    <form method="post" action="buy.php">
    <input type="text" name="receipt" value="">
    <input type="submit" name="ok" value="Send Receipt">
    </form>
    </body>
    </html>
<?php
}
}
?>

Please Help

patrick
  • 83
  • 6

1 Answers1

0

You can find some limited docs here: http://kb.cs-cart.com/new-payment (but you're right, there's not a lot of info)

The best way would be to look at different integrations that already exist (there are lots in the app/payments folder) and find one that's similar (ie. uses a REST API or a SOAP API).

Looking at your example though it looks like it might work in a slightly different way - usually you'd have a hosted page which would do the work of validating the payment then would just tell your CS-Cart store that the payment is successful. Does your payment provider offer this? Or have examples for another store?

Harry
  • 329
  • 1
  • 10
  • I am using an opensource platform called pesapi - [link] www.pesapi.com [/link] the script above basically fetches data from the pesapi database confirms the code entered by the shopper matches the one in the database. The Layout is simple. Problem is implementing it. i had even thought if i could create the frontend then pass the variable(code) to the php script i might have the chance to do some good there but i failed. The frontend should look like [link]http://www.enetonlinesolutions.co.ke/images/kenpesa_4.png[link] – patrick Jan 05 '16 at 19:01
  • [link](www.enetonlinesolutions.co.ke/images/kenpesa_4.png) – patrick Jan 07 '16 at 10:48