PHP Marketplace website binds China UnionPay Online payment interface

Source: Internet
Author: User

PHP Mall website Binding China UnionPay online payment interface with more and more extensive, our company in the past few years to customers to establish a lot of mall website, today analysis how to for their own PHP mall website access to China UnionPay online payment terminal interface. Before use, we must first apply to become the China UnionPay online payment merchant.

The first step: Download China UnionPay official PHP Payment interface fileEnter the merchant service website of the official website of China UnionPay Online, download the technical data port file of PHP (https://online.unionpay.com/mer/pages/merser/index.jsp This is China UnionPay online payment merchant Service website), Click "Document Download" in the upper right corner to find the "D-4 PHP Interface Development Kit" click to download. If you can't find it, click here to download the "D-4 PHP Interface Development Kit. RAR" (originally downloaded from our company, the original file has not moved, including: Ut8 version, GBK version, Ecshop (the instance has been developed)) second: Familiar with China UnionPay payment interface program file1. After downloading the data, you will see 4 files, open the "Readme.txt" file to see instructions, we here in the "UTF8" format as an example, the file copied to the PHP environment platform, set up a folder (YL) and the payment interface file pasted in, access to local "localhost/yl /", click on" example/front.php "This file, you will find this is a default order sent to China UnionPay online payment platform above.  For this file is the use of sending data to the China UnionPay payment platform on the website of the document.  2. Using DW to open front.php edit file, we can see the default data: such as transaction amount, order number, etc., we simply pass the goods, the price and other attributes to this file, we can send this data to China UnionPay online payment platform up. 3. Change the merchant's secret key and ID. Use DW to open "quickpay_conf.php", here you can prepare the merchant's account key, open this file will have a default merchant account, which is used to test the payment process. If you need the merchant account key to control through the background, please "quickpay_conf.php" inside the "' Merid ' and '", static $security _key = ";" is set to empty, in the open "Quickpay_ Service.php "in" Require_once (DirName (__file__). '/quickpay_conf.php '); Add the following code: $sql = "SELECT * FROM table name WHERE condition"; $result = mysql_query ($sql, $con); /Merchant number $bargainor_id= $result [' Payuser ']; Key $key= $result [' Paykey ']; Quickpay_conf:: $pay _params[' Merid ']= $bargainor _id;quickpay_conf:: $security _key= $key; This can be through the background to the site management background to control the merchant's account key. Step three: Online test of China UnionPay payment interface 1. We have to understand the following parameters when doing the test (front.php)$param [' frontendurl '] = "front_notify.php";    Foreground callback url$param[' backendurl '] = "back_notify.php"; Background callback URL front_notify.php This file is the front desk data returned by China UnionPay to the merchant's website, allowing customers on the merchant's website to understand whether the transaction was successful. back_notify.php This file is also China UnionPay return to the merchant website of a data, is the background callback data, when the customer transaction success, through this piece can modify the database, modify order status. 2. China UnionPay Payment Interface test EnvironmentChina UnionPay Payment Interface test environment There are three (set in the quickpay_conf.php file), we understand the program after completion, is the test of the program, China UnionPay payment interface is very humane, a total of three environments: test environment, pre-launch environment, online environment; With three different stages to debug the program on-line, testing, online we just need to change the code before the comments on it. Test environment "back_notify.php" is not enforceable, only "front_notify.php" from the use, in the "Readme.txt" system has a default test account for payment transactions. Pre-launch environment "front_notify.php, back_notify.php" can be executed, this time as long as the payment transaction is successful we can modify the status of the order. In this environment, the system default test payment account number will be changed, this can be like China UnionPay pay docking personnel. Online environment is in front of you two links are not a problem, you can formally open the China UnionPay on-line payment interface. Here we have the configuration of "PHP Mall website binding China UnionPay Online Payment Interface", if you are not very clear on the above introduction, you can contact me online, exchange study together. Http://www.topzhong.com/210.html

PHP Marketplace website binds China UnionPay Online payment interface

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.