#Unionpay PHP API

##Introduction

Unionpay PHP API is a simple and easy-to-use interface to implement web-based Unionpay online payment modules written in PHP. This project includes PHP logics and front-end JavaScript API.

Author: Chion82 sdspeedonion@gmail.com

##Feature

Say good-bye to the fucking super-complex Unionpay documentation which also contains errors.

Many bugs in the official Unionpay online payment SDK have been fixed.

All sensitive data from the client such as bank card number and password will be RSA-encrypted by JS API in case http packages are captured by hackers.

##Usage

Generate RSA keys by running: (Those keys are used for AJAX encryption.)

$ openssl genrsa -out rsa_4096_priv.pem 4096 $ openssl rsa -pubout -in rsa_4096_priv.pem -out rsa_4096_pub.pem

Copy rsa_4096_pub.pem to api/unionpay/pubkey/rsa_4096_pub.pem .

Follow the comments and implement functions at api/unionpay/custom_func.php .

Configurate the Unionpay online payment parameters by modifying the constants located at api/unionpay/func/SDKConfig.php .

Upload all files to the root directory of your web project and test your configurations by browsing /test.php .

Checkout the commented out JavaScript demo code at /test.php and test those demo API calls using your browser console. The callback data of each JS API will be alerted.

By now you have knowledges of how the callback data of the JS APIs located at js/unionpay_lib.js looks like, just import this JS lib and write your own front-end payment code. All input parameters of those JS APIs can be found at js/unionpay_lib.js as comments.

##Changelog

Change all constants at api/unionpay/func/SDKConfig.php to global variables in case the PHP version on the server is too low.

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。