The first thing to do is to open the OpenSSL method
The OpenSSL certificate is placed in the Apache Bin directory. Where the php_openssl.dll,ssleay32.dll,libeay32.dll,3 files are copied to the windows/system32/folder,
; Extension=php_openssl.dll, will the front of the ";" Remove the Apache service in the restart. If it already exists, it can be used directly.
Fatal error:call to undefined function openssl_pkcs12_read () issue please view php.ini, Extension=php_openssl.dll, will be the front ";" Remove to see if the Apache service has a OpenSSL certificate loaded
Version for gateway Payment
First, download the development files and documents to the pipe network.
Locate the sdkconfig.php configuration file in the SDK directory
<?php
###### (The following configuration is PM environment: for network test environment, production environment configuration See document Description) #######
Signing certificate Path
Const Sdk_sign_cert_path = '.. /testkey/700000000000001_acp.pfx ';
Fill in the encryption certificate here
Signing Certificate Password
Const SDK_SIGN_CERT_PWD = ' 000000 ';
Here's the secret key.
Password Encryption certificate (this is generally not used, please feel free to match)
Const Sdk_encrypt_cert_path = ' d:/certs/acp_test_enc.cer ';
Visa Verification Path (please go to the folder, do not match the specific documents)
Const SDK_VERIFY_CERT_DIR = '.. /testkey/';
The directory where the key is stored
Front Desk Request Address
Const SDK_FRONT_TRANS_URL = ' https://101.231.204.80:5000/gateway/api/frontTransReq.do ';
Background Request Address
Const SDK_BACK_TRANS_URL = ' https://101.231.204.80:5000/gateway/api/backTransReq.do ';
Bulk Trading
Const SDK_BATCH_TRANS_URL = ' https://101.231.204.80:5000/gateway/api/batchTrans.do ';
Single Query Request address
Const SDK_SINGLE_QUERY_URL = ' https://101.231.204.80:5000/gateway/api/queryTrans.do ';
File Transfer Request Address
Const SDK_FILE_QUERY_URL = ' https://101.231.204.80:9080/';
Trading Address with Card
Const SDK_CARD_REQUEST_URL = ' https://101.231.204.80:5000/gateway/api/cardTransReq.do ';
App Trading Address
Const SDK_APP_REQUEST_URL = ' https://101.231.204.80:5000/gateway/api/appTransReq.do ';
Front Desk notification address (merchant self-Configuring notification address)
Const SDK_FRONT_NOTIFY_URL = ' http://test.com/upacp_demo_jf/demo/api_01_gateway/FrontReceive.php ';
Modify the foreground address
Background notification address (merchant self-Configuring notification address, need to configure the address that the extranet can access)
Const SDK_BACK_NOTIFY_URL = ' http://test.com/upacp_demo_jf/demo/api_01_gateway/BackReceive.php ';
Modify a background address
File download Directory
Const Sdk_file_down_path = './file/';
Modifying the download directory does not create a new
Log directory
Const Sdk_log_file_path = './logs/';
Modifying the log directory does not create a new
Log level, turn off the words change Phplog::off
Const SDK_LOG_LEVEL = phplog::D ebug;
/** The following payment products use, the rest of the products can not be used, ignore */
Front Desk Request Address
Const JF_SDK_FRONT_TRANS_URL = ' https://101.231.204.80:5000/jiaofei/api/frontTransReq.do ';
Background Request Address
Const JF_SDK_BACK_TRANS_URL = ' https://101.231.204.80:5000/jiaofei/api/backTransReq.do ';
Single Query Request address
Const JF_SDK_SINGLE_QUERY_URL = ' https://101.231.204.80:5000/jiaofei/api/queryTrans.do ';
Trading Address with Card
Const JF_SDK_CARD_TRANS_URL = ' https://101.231.204.80:5000/jiaofei/api/cardTransReq.do ';
App Trading Address
Const JF_SDK_APP_TRANS_URL = ' https://101.231.204.80:5000/jiaofei/api/appTransReq.do ';
?>
The main modified code for this file is
Signing certificate Path
Const Sdk_sign_cert_path = '.. /testkey/700000000000001_acp.pfx ';
Fill in the encryption certificate here
Signing Certificate Password
Const SDK_SIGN_CERT_PWD = ' 000000 ';
Here's the secret key.
Visa Verification Path (please go to the folder, do not match the specific documents)
Const SDK_VERIFY_CERT_DIR = '.. /testkey/';
The directory where the key is stored
Front Desk notification address (merchant self-Configuring notification address)
Const SDK_FRONT_NOTIFY_URL = ' http://test.com/upacp_demo_jf/demo/api_01_gateway/FrontReceive.php ';
Modify the foreground address
Background notification address (merchant self-Configuring notification address, need to configure the address that the extranet can access)
Const SDK_BACK_NOTIFY_URL = ' http://test.com/upacp_demo_jf/demo/api_01_gateway/BackReceive.php ';
Modify the background address this address to ensure that the external network can be accessed otherwise it will not be executed.
File download Directory
Const Sdk_file_down_path = './file/';
Modifying the download directory does not create a new
Log directory
Const Sdk_log_file_path = './logs/';
Modifying the log directory does not create a new
Some other places to modify the path of the file directory
index_01_gateway.php for import files
If you open the report time zone error can be added
Date_default_timezone_set (' PRC '), or set the time zone in php.ini
<!doctype html>
<!--
To write a note:
Jquery-ui reference to: http://www.runoob.com/jqueryui/jqueryui-tutorial.html
Description of jquery reference: http://www.w3school.com.cn/jquery/index.asp
TABS-API is a horizontal label, the following defined div such as tabs-purchase is a vertical label, according to the existing add, the name does not repeat the line.
New Landscape Labels:
1. <div id= "Tabs-api" ><ul><li> under new a tag, point to an anchor point.
2. Previous <ul> new plus a <DIV>,ID use the ID specified by the previous anchor point.
New Vertical Label:
1. JS plus a row, set the parameters of the vertical label.
2. In short, refer to the existing examples.
-
<meta charset= "Utf-8" >
<title> Gateway Product Examples </title>
<link rel= "stylesheet" href= "Static/jquery-ui.min.css" >
<script src= "Static/jquery-1.11.2.min.js" ></script>
<script src= "Static/jquery-ui.min.js" ></script>
<script src= "Static/demo.js" ></script>
<script>
$ (function () {
Setapidemotabs ("#tabs-purchase");
Setapidemotabs ("#tabs-preauth");
});
</script>
<link rel= "stylesheet" href= "Static/demo.css" >
<body style= "Background-color: #e5eecc;" >
<div id= "wrapper" >
<div id= "Header" >
</div>
<div id= "Tabs-api" >
<form class= "Api-form" method= "post" action= "demo/api_01_gateway/form_6_2_frontconsume.php" id= "MyForm" >
<p>
<label> Merchant Number:</label>
<input id= "Merid" type= "text" name= "Merid" placeholder= "" value= "777290058110048" title= "The default merchant number is used only as a test for the interlock. Please also use the official application of the merchant number "required=" required "/>
</p>
<p>
<label> Transaction Amount:</label>
<input id= "Txnamt" type= "text" name= "Txnamt" placeholder= "Transaction amount" value= "<?php echo $_get[" Money "]?>" title= " Units are divided into "required=" required "/>
</p>
<p>
<input id= "Amounttype" type= "hidden" name= "Amounttype" value= "<?php echo $_get[" type "]?>" required= "required "/>
</p>
<p>
<label> Order delivery Time:</label>
<input id= "Txntime" type= "text" name= "Txntime" placeholder= "Order send time, YYYYMMDDHHMMSS format" value= "<?php Date_default _timezone_set (' PRC '); echo Date (' Ymdhis ')?> "title=" Take the Beijing-GMT "required=" required "/>
</p>
<p>
<label> Merchant Order Number:</label>
<input id= "OrderId" type= "text" name= "OrderId" placeholder= "Merchant Order Number" value= "<?php date_default_timezone_set (' PRC ‘); echo Date (' Ymdhis '). Rand (10000,99999). ' 1 '?> "title=" self-defined, 8-32-digit alphanumeric "required=" required "/>
</p>
<p>
<label> </label>
<input type= "Submit" class= "button" value= "Jump UnionPay page Payment"/>
<input type= "button" class= "showfaqbtn" value= "having problems? "/>
</p>
</form>
<script type= "Text/javascript" >
function Validate () {
document.getElementById (' MyForm '). Submit ();
}
Window.load=validate ();
</script><!--Modify the code as needed this page if you do not need to see an automatic jump
</div><!--End of wrapper-->
</body>
At development time, if you change the directory name to modify the directory file address according to the error prompt,
Some files are not introduced in the use of the page can be introduced according to the error information.
The business logic is written in the backreceive.php file under Demo\api_01_gateway, and the logic business is judged based on the returned value.
The following 2 errors are easy to appear
Warning:openssl_x509_read () [Function.openssl-x509-read]: Supplied parameter cannot be coerced to an X509 certificate!
Signature times, may be the certificate format is not correct, may be the wrong password.
Re-download the certificate, the path is configured, the password must be written correctly
Warning:openssl_verify (): Supplied key param cannot be coerced to a public key in D:\ "path slightly" \func\secureutil.php on line 61
The explanation given by the official website is
Check the times, for the existence of the format of the CER certificate, if there is upop_verify.cer, please delete directly, not used.
Not found this folder or error, in the configuration file will be
Const Sdk_encrypt_cert_path = ' d:/certs/acp_test_enc.cer ';
After logging out still error, but does not affect the execution
Not to be continued
This article is from the IT technology blog, so be sure to keep this source http://linuxubuntu.blog.51cto.com/4964714/1746065
PHP calls the UnionPay interface