blackhungry / alipayopenapicpp Goto Github PK
View Code? Open in Web Editor NEWThis project forked from arthasmodern/alipayopenapicpp
支付宝开放平台的C\C++版接入示例代码,包含加签验签\网络请求\参数组装\报文解析等等;仅供商户或开发者参考使用;
This project forked from arthasmodern/alipayopenapicpp
支付宝开放平台的C\C++版接入示例代码,包含加签验签\网络请求\参数组装\报文解析等等;仅供商户或开发者参考使用;
该项目为C++项目,包含访问支付宝开放平台(Openapi)网关的源码; /** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ **/ 工程中有两个项目文件: Openapi.pro为QtCreater项目文件,可用QtCreater打开; Openapi.sln为VS(2008版)项目文件,可用VS打开; 使用哪种项目文件,由开发者使用的IDE环境决定,并不一定局限于以上两种; 注:该项目源码依赖C\C++标准库(STL)以及几个开源的第三方库(libcurl,openssl); 示例Demo中第三方库(libcurl,openssl)是已经编译成windows平台下的静态库; 开发者可以在其它支持C\C++的平台(linux等)使用源码自行编译第三方库(libcurl,openssl); 开发者亦可自行决定使用静态\动态链接库; /** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ **/ 项目的目录结构: (主要源码包含在目录“/openapi”中) 1)主工具类 -- ./openapi/openapi_client ---- 访问支付宝开放平台(openapi)网关的工具类; ---- 外部主要依赖该类访问支付宝网关; ---- 具体使用示例可参见main.cpp中的源码及注释; 2)其它依赖的工具类: HttpClient -- ./openapi/http/http_client ---- 该工具类提供Http(Https)网络通信的功能; ---- 该工具类依赖第三方库libcurl JsonUtil -- ./openapi/json/json_util ---- 该工具类提供Json串与C++对象之间的转换功能; ---- 该工具类依赖第三方库cJSON; openssl & libcurl -- ./libs/ ---- 这两个第三方库已经编译成静态库(windows平台); ---- 其它平台的静态库,开发者可自行下载源码进行编译; /** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ **/ 集成/调试之前的准备工作: 1)入住支付宝开放平台,申请应用并获得应用ID(appId); 2)本地生成rsa密钥对,并上传公钥到支付宝开放平台相应的应用下, 并保存好自己的私钥(privateKey -- 严格保密); rsa密钥生成方式参看支付宝开放平台官方文档; 注:C++使用的是标准格式的rsa私钥,不是pkcs8格式的; 3)各个具体业务接口参数组装模式具体参看Openapi官方文档; 4)支付宝开放平台文档中心:https://doc.open.alipay.com/ /** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ **/ 免责声明: 1)DEMO仅供参考,实际开发中需要结合具体业务场景修改使用。 2)如果使用了支付接口中的异步通知,则需要严格按照如下描述校验通知数据的正确性(如果没有使用异步通知,可忽略): 2.1)商户需要验证该通知数据中的out_trade_no是否为商户系统中创建的订单号; 2.2)判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额); 2.3)校验通知中的seller_id(或者seller_email) 是否为out_trade_no这笔单据的对应的操作方(有的时候,一个商户可能有多个seller_id/seller_email); 2.4)验证app_id是否为该商户本身; 3)该DEMO所运行的环境: 3.1)所提供的示例为windows平台下可运行; 3.2)开发者亦可以在其它支持C\C++的平台(如linux)适配运行;(只需要将依赖的第三方开源库(libcurl,openssl)编译适配好即可)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.