再获取订单信息后,6行代码就可以实现支付宝即时到帐功能~
详细地址:http://git.oschina.net/yansongda/AlipayDirect_BasedOnTP_OR_Alone
以前也看了很多关于 支付宝集成的相关代码,但都不那么满意,感觉很复杂,于是自己就搞了一个。使用方法很简单!
一、说明
0、项目经过完整测试!可放心使用!
1、基于最新 Thinkphp3.2.2 开发而成。
2、虽然基于TP开发而成,但是代码里面的支付宝类可以单独出来使用。
3、本人学生一枚,如果代码有不好的地方,希望您指出。
二、使用方法
0、使用非常简单!
1、在 config.php 中写上自己的支付宝PID 、KEY、和邮箱账号;
2、在 Controller/AlipayController 中重写相关订单业务逻辑(比如订单状态更新啊什么的)就行了。具体可以看里面的注释。
这里提供获取订单信息后(订单ID、订单金额、订单商品主题、订单描述等)的支付方法代码:public function alipay()<br>
{<br>
/**<br>
* 需要修改!<br>
* 写自己的业务逻辑(获取POST过来的订单数据、或数据库中读取订单数据)~或把此方法集成到其他控制器(比如说Buycontroller)中。<br>
*/<br>
$alipayp['total_fee'] = '0.01';//订单总金额<br>
$alipayp['out_trade_no'] = $order_id;//商户订单ID<br>
$alipayp['subject'] = 'XXXX';//订单商品标题<br>
$alipayp['body'] = 'XXX';//订单商品描述<br>
$alipayp['show_url'] = '';//订单商品地址<br>
$alipay = new \Common\Lib\Alipay\Alipay();/*不用更改*/<br>
$alipay->toAlipay($alipayp);<br>
}
三、如果有什么问题,可以在OSCHINA 中 ISSUES出来。
感谢您的使用!请务必保留版权信息
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Atom editor mac version download
The most popular open source editor