Closed jrsarath closed 6 years ago
Hi @jrsarath
This seems to be something that is related to your code and not because of this library. Please check your code.
here is the the files.. index.php
<?php
use CodeZero\PayUMoney\PayUMoney;
require 'vendor/autoload.php';
$payumoney = new PayUMoney([
'merchantId' => 'uz7qF2fx',
'secretKey' => 'TwRub9M3oR',
'testMode' => true
]);
$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
$params = [
'txnid' => $txnid,
'amount' => 10.50,
'productinfo' => 'A book',
'firstname' => 'Peter',
'email' => 'abc@example.com',
'phone' => '8697487237',
'surl' => 'http://jrsarath.cf/alpha/return.php',
'furl' => 'http://jrsarath.cf/alpha/return.php',
];
// Redirects to PayUMoney
$payumoney->initializePurchase($params)->send();
?>
return.php
<?php
use CodeZero\PayUMoney\PayUMoney;
require 'vendor/autoload.php';
$payumoney = new PayUMoney([
'merchantId' => 'uz7qF2fx',
'secretKey' => 'TwRub9M3oR',
'testMode' => true
]);
$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
$params = [
'txnid' => $txnid,
'amount' => 10.50,
'productinfo' => 'A book',
'firstname' => 'Peter',
'email' => 'abc@example.com',
'phone' => '8697487237',
'surl' => 'http://jrsarath.cf/alpha/return.php',
'furl' => 'http://jrsarath.cf/alpha/return.php',
];
if(isset($_POST['submit'])){ //check if form was submitted
// Redirects to PayUMoney
$payumoney->initializePurchase($params)->send();
}
?>
what im doing wrong here ?
You're index.php & return.php seems to be identical. I think you pasted the wrong content here.
<?php
// return.php
use CodeZero\PayUMoney\PayUMoney;
require 'vendor/autoload.php';
$payumoney = new PayUMoney([
'merchantId' => 'uz7qF2fx',
'secretKey' => 'TwRub9M3oR',
'testMode' => true
]);
$result = $payumoney->completePurchase($_POST);
if ($result->checksumIsValid() && $result->getStatus() === PayUMoney::STATUS_COMPLETED) {
print 'Payment was successful. Transaction ID :'.$result->getTransactionId();
} else {
print 'Payment was not successful.Transaction ID :'.$result->getTransactionId();
}
here - return.php
@niranjan94 help please
Use PurchaseResult::STATUS_COMPLETED
. Looks like a documentation error. I'll update the readme/
Class 'PurchaseResult' not found in /home/jrsarath/public_html/alpha/return.php here is what i got after your update
im using
if ($result->checksumIsValid() && $result->getStatus() === "Completed")
instead
im getting this error after getting redirected after a successful payment