这篇文章对我很有帮助,因为它向我展示了一些最初不可见的字段。如果您不想使用 SecureNet 的 CodeIgniter 类,我整理了一个简单的基于 PHP/SOAP 的示例来执行退款/捕获/无效。将其适应其他任何东西应该不会太困难。
//Certifying?
$certify = 1;
//Build Array
$arg = array(
"MERCHANT_KEY" => array(
"GROUPID" => 0,
"SECUREKEY" => "XXXXXXXXX",
"SECURENETID" => "XXXXXXXXX",
),
"CARD" => array(
"CARDNUMBER" => $card_number,
),
"REF_TRANSID" => $processor_transaction_id,
"AMOUNT" => $amount,
"METHOD" => "CC",
"DCI" => 0,
"INSTALLMENT_SEQUENCENUM" => 0,
"GROUPID" => 0,
"OVERRIDE_FROM" => 0,
"RETAIL_LANENUM" => 0,
"TOTAL_INSTALLMENTCOUNT" => 0,
"TRANSACTION_SERVICE" => 0,
"TEST" => $testing ? "FALSE" : "TRUE",
);
//Refund
if ($action == "refund") {
$arg['CODE'] = "0500";
//Capture
} elseif ($action == "capture") {
$arg['CODE'] = "0200";
//Partial Void
} elseif ($action == "void") {
$arg['CODE'] = "0401";
}
//Certify or Production URL's
$base_url = "http://gateway.securenet.com/api/gateway.svc?wsdl"; //not for sure on these urls
$soap_url = "https://gateway.securenet.com/api/gateway.svc/soap"; //not for sure on these urls
if ($certify) {
$base_url = "http://certify.securenet.com/api/gateway.svc?wsdl";
$soap_url = "https://certify.securenet.com/api/gateway.svc/soap";
}
//Connect
$client = new \SoapClient($base_url, array('trace' => 1, 'exceptions' => true));
$client->__setLocation($soap_url);
//Successful!
try {
$result = $client->ProcessTransaction(array("TRANSACTION" => $arg));
if ($certify) {
echo 'REQUEST: ' . htmlentities($client->__getLastRequest()) . "<br><br>";
echo 'RESPONSE: ' . htmlentities($client->__getLastResponse());
}
//1 = approve, 2 = declined, 3 = error
$response_code = $result->ProcessTransactionResult->TRANSACTIONRESPONSE->RESPONSE_CODE;
$response_text = $result->ProcessTransactionResult->TRANSACTIONRESPONSE->RESPONSE_REASON_TEXT;
//There Was An Error
} catch (\Exception $e) {
if ($certify) {
echo 'REQUEST: ' . htmlentities($client->__getLastRequest()) . "<br><br>";
echo 'RESPONSE: ' . htmlentities($client->__getLastResponse());
}
echo "ERROR: " . $e->getMessage() . "<br><br>";
die;
}
其他有用的是这些文档,这些文档在 SecureNet 上似乎不再可用。http://www.scribd.com/doc/202100111/SecureNet-Docs