dongqixian8474 2016-10-27 09:16
浏览 97
已采纳

Payeezy:如何在php中对“标记完成”事务进行“预授权”事务

Payeezy payment gateway has been integrated successfully with php. Kept transaction type as "AUTH_ONLY". To make the complete transaction will go to the admin panel and make it as tagged completion as shown in screen shot.

enter image description here

Now we want to allow the merchant to add the shipping fee, compute the total from within our application, and then send a request back to Payeezy with the total amount to be charged against the transaction tag that was received earlier and complete the previous pre-authorization as completed.

Here is the link how to achieve it, but unable to understand how to do with php.

Thanks in advance.

With regards, Sudhir

  • 写回答

1条回答 默认 最新

  • dtjpnd7517 2016-11-08 07:20
    关注

    I got the proper code to do this. Here is the proper code in php and fill all the variables with proper payeezy values.

    class SoapClientHMAC extends SoapClient {
        public function __doRequest($request, $location, $action, $version, $one_way = NULL) {
    global $context;
    $hmackey = "********************"; // <-- Insert your HMAC key here
    $keyid = "******"; // <-- Insert the Key ID here
    $hashtime = date("c");
    $hashstr = "POST
    text/xml; charset=utf-8
    " . sha1($request) . "
    " . $hashtime . "
    " . parse_url($location,PHP_URL_PATH);
    $authstr = base64_encode(hash_hmac("sha1",$hashstr,$hmackey,TRUE));
    if (version_compare(PHP_VERSION, '5.3.11') == -1) {
        ini_set("user_agent", "PHP-SOAP/" . PHP_VERSION . "
    Authorization: GGE4_API " . $keyid . ":" . $authstr . "
    x-gge4-date: " . $hashtime . "
    x-gge4-content-sha1: " . sha1($request));
          } 
       else {
        stream_context_set_option($context,array("http" => array("header" => "aut horization: GGE4_API " . $keyid . ":" . $authstr . "
    x-gge4-date: " . $hashtime . "
    x-gge4-content-sha1: " . sha1($request))));
            }
    return parent::__doRequest($request, $location, $action, $version, $one_way);
         }
    
          public function SoapClientHMAC($wsdl, $options = NULL) {
    global $context;
    $context = stream_context_create();
    $options['stream_context'] = $context;
    return parent::SoapClient($wsdl, $options);
     }
       }
    
       $trxnProperties = array(
    "User_Name" => "*******",
    "Secure_AuthResult" => "",
    "Ecommerce_Flag" => "",
    "XID" => "",
    "ExactID" => "******-**", //Payment Gateway
    "CAVV" => "",
    "Password" => "**********************", //Gateway       Password
    "CAVV_Algorithm" => "",
    "Transaction_Type" => $txn_type, //Transaction Code I.E. Purchase="00" Pre-Authorization="01" etc.
    "Reference_No" => "",
    "Customer_Ref" => "",
    "Reference_3" => "",
    "Client_IP" => "", //This value is only used for fraud investigation.
    "Client_Email" => "", //This value is only used for fraud investigation.
    "Language" => "en", //English="en" French="fr"
    "Card_Number" => "4111111111111111", //For Testing, Use Test#s VISA="4111111111111111" MasterCard="5500000000000004" etc.
    "Expiry_Date" => "1121", //This value should be in the format MM/YY.
    "CardHoldersName" => "test",
    "Track1" => "",
    "Track2" => "",
    "Authorization_Num" => $_POST["auth_no"],
    "Transaction_Tag" => $_POST["txn_tag"],
    "DollarAmount" => $_POST["amt"] + $_POST["shippingfee"],
    "VerificationStr1" => "",
    "VerificationStr2" => "",
    "CVD_Presence_Ind" => "",
    "Secure_AuthRequired" => "",
    "Currency" => "",
    "PartialRedemption" => "",
    // Level 2 fields 
    "ZipCode" => "",
    "Tax1Amount" => "",
    "Tax1Number" => "",
    "Tax2Amount" => "",
    "Tax2Number" => "" );
    
    
    $client = new SoapClientHMAC("https://api.demo.globalgatewaye4.firstdata.com/transaction/v12/wsdl");
    $trxnResult = $client->SendAndCommit($trxnProperties);
    
    
    if(@$client->fault){
        // there was a fault, inform
        print "<B>FAULT:  Code: {$client->faultcode} <BR />";
        print "String: {$client->faultstring} </B>";
        $trxnResult["CTR"] = "There was an error while processing. No TRANSACTION DATA IN CTR!";
    }
    //Uncomment the following commented code to display the full results.
    
    echo "<H3><U>Transaction Properties BEFORE Processing</U></H3>";
    echo "<TABLE border='0'>
    ";
    echo " <TR><TD><B>Property</B></TD><TD><B>Value</B></TD></TR>
    ";
    foreach($trxnProperties as $key=>$value){
        echo " <TR><TD>$key</TD><TD>:$value</TD></TR>
    ";
    }
    echo "</TABLE>
    ";
    
    echo "<H3><U>Transaction Properties AFTER Processing</U></H3>";
    echo "<TABLE border='0'>
    ";
    echo " <TR><TD><B>Property</B></TD><TD><B>Value</B></TD></TR>
    ";
    foreach($trxnResult as $key=>$value){
        $value = nl2br($value);
        echo " <TR><TD valign='top'>$key</TD><TD>:$value</TD></TR>
    ";
    }
    echo "</TABLE>
    ";
    
    
    // kill object
    unset($client); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大