我是cscart支付网关的新手。我需要在我的网站上实施pesapal支付网关。
我在pesapal.php中有以下代码
$pesapal_data['oauth_consumer_key']=$consumer_key;
$pesapal_data['oauth_nonce']='+7BADF195E1-54E0-F881-CC6B-83AF5C68F368+7';
$pesapal_data['oauth_timestamp']='1421737062';
$pesapal_data['oauth_version']='1.0';
$pesapal_data['oauth_callback']=$callback_url;
$pesapal_data['pesapal_request_data']=$post_xml;
$pesapal_data['oauth_signature_method']='HMAC-SHA1';
fn_create_payment_form('http://demo.pesapal.com/api/PostPesapalDirectOrderV4', $pesapal_data, 'Pesapal');
但是我得到了以下错误
http://demo.pesapal.com/api/home/notfound/。怎么做 ?请帮帮我。
答案 0 :(得分:0)
你可以,用这个
if ($_REQUEST['gtpay_tranx_status_code'] == 'Z6') {
$pp_response["order_status"] = 'I';
$pp_response["reason_text"] = "Cancelled";
} elseif ($_REQUEST['gtpay_tranx_status_code'] != '00') {
$pp_response["reason_text"] = "Error";
}
if (isset($_REQUEST['gtpay_tranx_status_msg'])) {
$pp_response["reason_text"].= ": " . $_REQUEST['gtpay_tranx_status_msg'];
}
if (isset($_REQUEST['gtpay_tranx_id'])) {
$pp_response["transaction_id"] = $_REQUEST['gtpay_tranx_id'];
}
$order_id = $_REQUEST['gtpay_echo_data'];
if (fn_check_payment_script('gtpay_payment_script.php', $order_id)) {
fn_finish_payment($order_id, $pp_response, false);
fn_order_placement_routines('route', $order_id);
}
}
} else { //send payment to gateway
//get payment total amount
$amount = $order_info["total"]; //str_replace('.', ',', $order_info["total"]);
// transaction id
$_order_id = $order_id.'_'.mt_rand(11111,99999);
//specify the url
$submit_url = 'GATEWAY URL GOES HERE';
//build parameters
$post_data = array(
'gtpay_cust_id' =>'X',
'gtpay_mert_id' =>'XXX',
'gtpay_tranx_id' => $_order_id, //gtpay tranx id
'gtpay_item_name_1' => 'Numartng: Goods Purchased',
'gtpay_tranx_amt' =>$amount*100, // amount converted to gtpay kobo format
'gtpay_tranx_noti_url' => 'MY-SITE-URL/app/payments/gtpay_payment_script.php', //THIS IS REALLY WHERE THE ISSUE IS, THIS IS WHERE CONTROL SHOULD BE RETURNED TO FROM THE GATEWAY
'gtpay_no_show_cust_id' => 'no',
'gtpay_tranx_memo' => 'Numartng: Goods Purchased',
'gtpay_gway_first' => 'yes',
'gtpay_gway_name' =>'webpay',
'gtpay_echo_data' => $order_id //order id again, included as echo data to be used when control is returned
);
//print_r($post_data); die;
fn_create_payment_form($submit_url, $post_data, 'GTPay Server');
exit;
}
答案 1 :(得分:0)
<?php
use Tygh\Registry;
if (!defined('AREA')) {die('Access denied'\);}
if (defined('PAYMENT_NOTIFICATION')) {
//get order id
$order_id = $_GET['order_id'];
//get pyment info...
$payment_id = db_get_field("SELECT payment_id FROM ?:orders WHERE order_id = ?i", $order_id);
$processor_data = fn_get_payment_method_data($payment_id);
$confirm = ===> pay is ok
if (failed) {
//failed
fn_change_order_status($order_id, 'F', '', false);
fn_finish_payment($order_id, $_POST, false);
fn_order_placement_routines('route', $order_id, false);
echo implode(", ", $webservice->errors);
} else {
//success
fn_change_order_status($order_id, 'P', '', false);
fn_finish_payment($order_id, $_POST, false);
fn_order_placement_routines('route', $order_id, false);
}
} else {
$terminalId = $processor_data['processor_params']['merchant_id'];
$userName = $processor_data['processor_params']['user_name'];
$password = $processor_data['processor_params']['password'];
$current_location = Registry::get('config.http_location');
$url = $current_location . "/$index_script?dispatch=payment_notification.notify&payment=paynem&order_id=$order_id&pid=";
$webservice = new BankMellat($terminalId, $userName, $password);
$action = $webservice->PayAction($order_info['total'], $url, true);
if ($webservice->errors) {
echo implode(", ", $webservice->errors);
} else {
echo ('<html><head></head><body>
。 。 。 。 “);}
}
//这段代码对我有用