Jump to content

integrating a rave pay payment gateway


Ponel
 Share

Recommended Posts

Good afternoon everyone, Please I’m trying to integrate a rave pay payment gateway and i’m getting this below error on making payment

Error:
Cannot POST /hosted/redirect

 

My redirect page code (redirect.php)

<?php

//session_start();

include 'includes/global/login_handler.php';

include 'includes/global/randStrGen.php';



if (isset($_GET['txref']) && isset($_SESSION["amount_to_pay"]) && isset($_SESSION["txtrefno"]) && isset($_SESSION["transact_no"]) && isset($_SESSION["buyer_email"]) && isset($_SESSION["buyer_name"]) && isset($_SESSION["seller_email"]) && isset($_SESSION["seller_name"])) {

//my own variable declaration


$buyer_t_pay_ =$_SESSION["amount_to_pay"];

$txtrefno =$_SESSION["txtrefno"];

$transact_no =$_SESSION['transact_no'];

$buyer_email =$_SESSION['buyer_email'];

$buyer_name =$_SESSION['buyer_name'];

$seller_email =$_SESSION['seller_email'];

$seller_name =$_SESSION['seller_name'];


$category=$_SESSION['category'];

$description=$_SESSION['description'];


//end of my variable declaration

$ref = $_GET['txref'];

$amount = $_SESSION["amount_to_pay"]; //Correct Amount from Server

$currency = "NGN"; //Correct Currency from Server


$query = array(

"SECKEY" => "2fsghddjk",

"txref" => $ref

);


$data_string = json_encode($query);

$ch = curl_init('https://api.ravepay.co/flwv3-pug/getpaidx/api/v2/verify');

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));


$response = curl_exec($ch);


$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);

$header = substr($response, 0, $header_size);

$body = substr($response, $header_size);


curl_close($ch);


$resp = json_decode($response, true);


$paymentStatus = $resp['data']['status'];

$chargeResponsecode = $resp['data']['chargecode'];

$chargeAmount = $resp['data']['amount'];

$chargeCurrency = $resp['data']['currency'];


if (($chargeResponsecode == "00" || $chargeResponsecode == "0") && ($chargeAmount == $amount) && ($chargeCurrency == $currency)) {

// transaction was successful...

// please check other things like whether you already gave value for this ref

// if the email matches the customer who owns the product etc

//Give Value and return to Success page

//header( "refresh:4;url=./success.php" );

$sql_payment ="insert into payment_history (transactID,amountPaid,transMode,refno) values('$transact_no','$buyer_t_pay_','1','$txtrefno')";

$payment_query = mysqli_query($con,$sql_payment);

$payment_id = mysqli_insert_id($con);


$sql_trans ="update trans_tbl set amt_pay='$buyer_t_pay_', payment_status='1', refno='$txtrefno' where transact_no='$transact_no'";

$transact_query = mysqli_query($con,$sql_trans);

if ($transact_query && $payment_query){

$year = date('Y');

//send email to the buyer

$to = $buyer_email;

$from = "info@safetranzact.com";

$subject = "Payment Successful";

$message ='<div class="email-background" style="background: #eee;padding: 10px;">

<a href="https://www.safetranzact.com"><center><img src="https://www.safetranzact.com/assets/images/fav.png" style="padding-top:30px;padding-bottom:30px;max-width:100px;margin: 0 auto;"></center><a>

<div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;">

<p style="margin: 20px;font-size: 20px;font-weight: bold;color: #002b49;line-height: 20px;text-align:center;word-break: normal;font-family: Helvetica,Arial,sans-serif;margin-left: 10px;margin-right: 10px;">Your payment to the item with transaction No: '. $transact_no .' of '.$category. ' has been confirmed<br/></p><hr>

<p style="font-size: 14px;font-weight: bold;color: #002b49;text-align:left;margin-left: 10px;margin-right: 10px;line-height: 12px;"> Dear ' . $buyer_name. ',</p><br>

<p style="font-size: 14px;font-weight: normal;color: #002b49;text-align:left;margin-left: 10px;margin-right: 10px;line-height: 20px;">Thanks for choosing Safetranzact. Your payment of transaction No <b>'. $transact_no . ' </b> of category <b> '. $category . '</b> with description <b>'.$description.'</b> is being processed. <br> If you have any comments about this transaction, please reach out to us at info@safetranzact.com</p>

</div>

</div>

<div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;">

Copyright &copy; Safetranzact Limited '. $year .' All Rights Reserved

</div>

</div>';

$headers = "From:$from\n";

$headers.="MINE-version:1.0\n";

$headers.="content-type:text/html; charset=iso-8859-1\n";

                        $mailing = mail($to,$subject,$message,$headers);

                        

                        

                        //send email to the seller

$to = $sender_email;

$from = "info@safetranzact.com";

$subject = "Payment Successful";

$message ='<div class="email-background" style="background: #eee;padding: 10px;">

<a href="https://www.safetranzact.com"><center><img src="https://www.safetranzact.com/assets/images/fav.png" style="padding-top:30px;padding-bottom:30px;max-width:100px;margin: 0 auto;"></center><a>

<div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;">

<p style="margin: 20px;font-size: 20px;font-weight: bold;color: #002b49;line-height: 20px;text-align:center;word-break: normal;font-family: Helvetica,Arial,sans-serif;margin-left: 10px;margin-right: 10px;">Your payment to the item with transaction No: '. $transact_no .' of '.$category. ' has been confirmed<br/></p><hr>

<p style="font-size: 14px;font-weight: bold;color: #002b49;text-align:left;margin-left: 10px;margin-right: 10px;line-height: 12px;"> Dear ' . $sender_name. ',</p><br>

<p style="font-size: 14px;font-weight: normal;color: #002b49;text-align:left;margin-left: 10px;margin-right: 10px;line-height: 20px;">Thanks for choosing Safetranzact. We got a payment of transaction No <b>'. $transact_no . ' </b> of category <b> '. $category . '</b> with description <b>'.$description.'</b> from buyer <b>('.$buyer_name.')</b> .<br> Please ship the item now and log in to your dashboard to upload the shippment proof. <br>If you have any comments about this transaction, please reach out to us at info@safetranzact.com</p>

</div>

</div>

<div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;">

Copyright &copy; Safetranzact Limited '. $year .' All Rights Reserved

</div>

</div>';

$headers = "From:$from\n";

$headers.="MINE-version:1.0\n";

$headers.="content-type:text/html; charset=iso-8859-1\n";

                        $mailing = mail($to,$subject,$message,$headers);

header( "refresh:3;url=./success" );

}else{

}

} else {

//Dont Give Value and return to Failure page

header( "refresh:3;url=./failure" );

}

}

else {

die('No reference supplied');

}


?>

 

 


Please any help on this

Edited by Barand
code tags added
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.