【发布时间】:2015-11-07 16:32:14
【问题描述】:
我在 cscart 中创建了一个新的支付网关。从支付网关获取成功结果后,cs购物车将其重定向到结帐页面并显示结帐不完整。请帮我解决这个问题。
【问题讨论】:
-
请将您的问题缩小到您使用的支付网关。
标签: php e-commerce payment-gateway checkout cs-cart
我在 cscart 中创建了一个新的支付网关。从支付网关获取成功结果后,cs购物车将其重定向到结帐页面并显示结帐不完整。请帮我解决这个问题。
【问题讨论】:
标签: php e-commerce payment-gateway checkout cs-cart
因为你没有提供任何代码,所以我做了一个处理响应的示例代码:
if ($mode == 'return') {
// this means, that the payment processor returned from 3rd party checkout page
$order_info = fn_get_order_info($_REQUEST['order_id'], true);
// you should have a response code (this section depends on your payment gateway)
if ($_REQUEST['response_code'] == "S") {
// the transaction was successful!
$pp_response['order_status'] = 'P';
$pp_response['transaction_id'] = $_REQUEST['transaction_id'];
$pp_response["reason_text"] = $_REQUEST['response_code'] . ": " . $_REQUEST['transaction_id']);
fn_finish_payment($_REQUEST['order_id'], $pp_response, false);
fn_order_placement_routines('route', $_REQUEST['order_id']);
} else {
// the transaction was NOT successful!
$pp_response['order_status'] = 'N';
$pp_response['transaction_id'] = $_REQUEST['transaction_id'];
$pp_response["reason_text"] = $_REQUEST['response_code'] . ": " . $_REQUEST['transaction_id']);
fn_order_placement_routines('route', $_REQUEST['order_id'], false);
}
}
关键的“功能”是:fn_finish_payment() 和 fn_order_placement_routines()。如果您没有完成付款,您将被重定向到结帐页面,因为这意味着出了点问题。
【讨论】: