【问题标题】:Payeezy: How to make "pre-authorize" transaction to "tagged-completion" transaction in phpPayeezy:如何在 php 中对“标记完成”交易进行“预授权”交易
【发布时间】:2017-03-09 21:46:43
【问题描述】:

Payeezy 支付网关已成功与 php 集成。将交易类型保留为“AUTH_ONLY”。如屏幕截图所示,要完成交易,将进入管理面板并将其设为标记完成

现在我们要允许商家添加运费 费用,从我们的应用程序中计算总数,然后发送一个 要求向 Payeezy 提出要收取的总金额 较早收到并完成前一个的交易标签 预授权已完成。

这里是link怎么实现的,但是不明白怎么用ph​​p做。

提前致谢。

关于, 苏迪尔

【问题讨论】:

    标签: php payeezy


    【解决方案1】:

    我得到了正确的代码来执行此操作。这是 php 中的正确代码,并用正确的 payeezy 值填充所有变量。

    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\ntext/xml; charset=utf-8\n" . sha1($request) . "\n" . $hashtime . "\n" . 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 . "\r\nAuthorization: GGE4_API " . $keyid . ":" . $authstr . "\r\nx-gge4-date: " . $hashtime . "\r\nx-gge4-content-sha1: " . sha1($request));
          } 
       else {
        stream_context_set_option($context,array("http" => array("header" => "aut horization: GGE4_API " . $keyid . ":" . $authstr . "\r\nx-gge4-date: " . $hashtime . "\r\nx-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'>\n";
    echo " <TR><TD><B>Property</B></TD><TD><B>Value</B></TD></TR>\n";
    foreach($trxnProperties as $key=>$value){
        echo " <TR><TD>$key</TD><TD>:$value</TD></TR>\n";
    }
    echo "</TABLE>\n";
    
    echo "<H3><U>Transaction Properties AFTER Processing</U></H3>";
    echo "<TABLE border='0'>\n";
    echo " <TR><TD><B>Property</B></TD><TD><B>Value</B></TD></TR>\n";
    foreach($trxnResult as $key=>$value){
        $value = nl2br($value);
        echo " <TR><TD valign='top'>$key</TD><TD>:$value</TD></TR>\n";
    }
    echo "</TABLE>\n";
    
    
    // kill object
    unset($client); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-25
      • 1970-01-01
      • 2018-01-13
      • 1970-01-01
      • 1970-01-01
      • 2021-11-25
      • 2014-10-05
      相关资源
      最近更新 更多