给大家分享一个自用的把自己微信和支付宝收款信息回调到服务器的安卓app
app界面就这么这么多东西,只需要设置一下回调地址就搞定了,傻瓜式操作!!!
下边上代码:
<?php
namespace app\zfb\controller;
use app\BaseController;
use think\facade\Db;
class Order extends BaseController
{
public function index(){
$str="个人手机收款回调接口服务";
$str=htmlentities($str);
//$str=html_entity_decode($str);
//$str=str_ireplace("<script>","<script>",$str);
//$str=str_ireplace("<script","<script",$str);
return $str;
}
//接受自己微信或支付宝的收款数据
public function new_order(){
$input=input();
foreach ($input as $key=>$vo) {
$input[$key]=mgths($vo);
}
if (isset($input["token"])&&$input["token"]==="您的token") {
$data["content"]=json_encode($input,JSON_UNESCAPED_UNICODE);
$data["tm"]=date("Y-m-d H:i:s");
$isin=Db::name("nty")->insert($data);
return $isin;
}else{
return "参数错误";
}
}
//获取支付宝付款金额
private function get_alipay_money($str){
//$str="你已成功收款0.01元";
$str=str_ireplace("你已成功收款","",$str);
$str=str_ireplace("元","",$str);
$money=$str*100;
return $money;
}
//获取微信付款金额
private function get_wxpay_money($str){
$pattern="/微信支付收款(.*)元/";
preg_match_all($pattern, $str, $matches);
return $matches[1][0]*100;
}
//修改订单状态为已支付(参数1:金额数,参数2:支付方式)
private function up_pay_order($money,$pay_type_id){
//您的业务逻辑
}
}
原生支付宝,微信支付只服务于有营业执照、个体工商户的商户。无法以个人身份(或以个人为主体)直接申请 API。不支持个人申请。所以,便有了个人的一些解决方案,手机安装一个 app,然后这个服务监听手机收到的通知,如果是收到收款的通知,就把信息推送到指定的 url 去。
转发宝app下载地址:http://lnmp-nty.niutianyu.com/zfb.apk
好像仅支持安卓