参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
mobile | string | 是 | 要充值的手机号 |
amount | string | 是 | 充值金额10,20,30,50,100,200,300,500面值可选 |
outorderno | string | 是 | 商家订单号 |
sign | string | 是 | 签名MD5加密 md5(amount+mobile+outorderno+appsecret) |
参数名称 | 类型 | 说明 |
---|---|---|
mobile | string | 要充值的手机号 |
amount | string | 充值金额 |
outorderno | string | 商家订单号 |
orderno | string | 订单号 |
totalfee | string | 总金额 重试订单金额略高一点,具体总金额以异步通知和订单详情为准 |
rechargestatus | int | 充值状态 0充值中 1充值成功 2充值失败 即时返回0,状态信息请从订单详情接口获取 |
<?php require_once 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $mobile = '15158825888';//手机号 $amount = '30';//充值金额 $outorderno = '66522311111';//外部订单号 $appsecret = 'ssssssssssss'; $sign = makeSign(array('mobile'=>$mobile, 'amount'=>$amount, 'outorderno'=>$outorderno), $appsecret);//签名 mobile amount outorderno为签名字段,参考下面的签名函数 $url = "https://api.jisuapi.com/mobilerecharge/recharge?appkey=$appkey&mobile=$mobile&amount=$amount&outorderno=$outorderno&sign=$sign"; $result = curlOpen($url, ['ssl'=>true]); $jsonarr = json_decode($result, true); //exit(var_dump($jsonarr)); if($jsonarr['status'] != 0) { echo $jsonarr['msg']; exit(); } $result = $jsonarr['result']; echo $result['mobile'].' '.$result['amount'].' '.$result['outorderno'].'
'; echo $result['orderno'].' '.$result['totalfee'].' '.$result['rechargestatus'].'
'; function makeSign($queryarr, $appsecret) { ksort($queryarr, SORT_STRING); $str = implode($queryarr); $str .= $appsecret; //exit($str); $str = md5($str); return $str; }
#!/usr/bin/python # encoding:utf-8 import urllib2, json, urllib, hashlib def md5(str): m = hashlib.md5() m.update(str) return m.hexdigest() def makeSign(queryarr, appsecret): queryarr = sorted(queryarr.items(),key=lambda e:e[0]) strs = "" for str in queryarr: strs += "%s" %str[1] return md5(strs + appsecret) # 1、手机充值 data = {} data["appkey"] = "your_appkey_here" data["mobile"] = "15158825888" # 充值账号 data["amount"] = 30 # 充值金额 data["outorderno"] = "66522311111" # 商家订单号 可选 data["appsecret"] = "sssssssssss" # 你的appsecret queryarr = {"mobile":data["mobile"],"amount":data["amount"],"outorderno":data["outorderno"]} sign = makeSign(queryarr , data["appsecret"]) data["sign"] = sign url_values = urllib.urlencode(data) url = "https://api.jisuapi.com/mobilerecharge/recharge" + "?" + url_values request = urllib2.Request(url) result = urllib2.urlopen(request) jsonarr = json.loads(result.read()) if jsonarr["status"] != u"0": print jsonarr["msg"] exit() result = jsonarr["result"] print result["mobile"],result["amount"],result["outorderno"] print result["orderno"],result["totalfee"],result["rechargestatus"]
package api.jisuapi.mobilerecharge; /** * 话费充值 */ import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import Decoder.BASE64Encoder; import api.util.HttpUtil; import net.sf.json.JSONObject; public class Recharge { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/mobilerecharge/recharge"; public static final String mobile = "15158825888";// 手机号 public static final String amount = "30";// 充值金额 public static final String outorderno = "66522311111";// 外部订单号 public static final String appsecret = "sssssssssss"; public static Mapqueryarr; public static void Get() throws NoSuchAlgorithmException, UnsupportedEncodingException { queryarr = new HashMap (); queryarr.put("amount", amount); queryarr.put(mobile, mobile); queryarr.put("outorderno", outorderno); String sign = makeSign(queryarr, appsecret);// 签名 mobile amount // outorderno为签名字段,参考下面的签名函数 String result = null; String url = URL + "?appkey=" + APPKEY + "&mobile=" + mobile + "&amount=" + amount + "&outorderno=" + outorderno + "&sign=" + sign; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = (JSONObject) json.opt("result"); String mobile = resultarr.getString("mobile"); String totalfee = resultarr.getString("totalfee"); String amount = resultarr.getString("amount"); String outorderno = resultarr.getString("outorderno"); String orderno = resultarr.getString("orderno"); String rechargestatus = resultarr.getString("rechargestatus"); System.out.println(mobile + " " + amount + " " + outorderno + " " + orderno + " " + totalfee + " " + rechargestatus); } } catch (Exception e) { e.printStackTrace(); } } public static String makeSign(Map queryarr, String appsecret) throws NoSuchAlgorithmException, UnsupportedEncodingException { TreeMap map = new TreeMap(queryarr); Iterator ir = map.keySet().iterator(); String str = new String(); while (ir.hasNext()) { Object key = ir.next(); str += map.get(key); } str += appsecret; return getMd5(str.getBytes()); } public static String getMd5(byte[] buffer) throws NoSuchAlgorithmException { String s = null; char hexDigist[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; MessageDigest md = MessageDigest.getInstance("MD5"); md.update(buffer); byte[] datas = md.digest(); // 16个字节的长整数 char[] str = new char[2 * 16]; int k = 0; for (int i = 0; i < 16; i++) { byte b = datas[i]; str[k++] = hexDigist[b >>> 4 & 0xf];// 高4位 str[k++] = hexDigist[b & 0xf];// 低4位 } s = new String(str); return s; } }
{ "status": 0, "msg": "ok", "result": { "mobile": "15158825888", "amount": "100", "outorderno": "", "orderno": "201604220431278398036", "totalfee": "99.8", "rechargestatus": "0" } }
参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
pagenum | int | 是 | 当前页 默认1 |
pagesize | int | 是 | 每页数量 默认20 最大40 |
参数名称 | 类型 | 说明 |
---|---|---|
orderno | string | 订单号 |
outorderno | string | 商家订单号 |
account | string | 充值账号 |
num | string | 数量 一般为1 |
status | int | 状态 一般为1,订单完成 |
rechargestatus | int | 充值状态 0充值中 1充值成功 2充值失败 即时返回0,状态信息请从订单详情接口获取 |
amount | string | 面值 |
totalfee | string | 总金额 |
addtime | int | 订单时间 |
name | string | 产品名称 |
areaid | int | 区域ID 参考全国城市规划API |
company | string | 运营商 |
<?php require 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $pagenum = 1;//当前页 $pagesize = 20;//每页数量,最大20 $url = "https://api.jisuapi.com/mobilerecharge/orderlist?appkey=$appkey&pagenum=$pagenum&pagesize=$pagesize"; $result = curlOpen($url, ['ssl'=>true]); $jsonarr = json_decode($result, true); //exit(var_dump($jsonarr)); if($jsonarr['status'] != 0) { echo $jsonarr['msg']; exit(); } $result = $jsonarr['result']; echo $result['total'].' '.$result['pagesize'].' '.$result['pagenum'].'
'; foreach($result['list'] as $val) { echo $val['orderno'].' '.$val['outorderno'].'
'; echo $val['account'].' '.$val['num'].'
'; echo $val['status'].' '.$val['rechargestatus'].'
'; echo $val['amount'].' '.$val['totalfee'].'
'; echo $val['addtime'].' '.$val['name'].'
'; echo $val['areaid'].' '.$val['company'].'
'; }
#!/usr/bin/python # encoding:utf-8 import urllib2, json, urllib, hashlib # 2、获取订单列表 data = {} data["appkey"] = "your_appkey_here" data["pagenum"] = 1 data["pagesize"] = 20 url_values = urllib.urlencode(data) url = "https://api.jisuapi.com/mobilerecharge/orderlist" + "?" + url_values request = urllib2.Request(url) result = urllib2.urlopen(request) jsonarr = json.loads(result.read()) if jsonarr["status"] != u"0": print jsonarr["msg"] exit() result = jsonarr["result"] print result["total"],result["pagesize"],result["pagenum"] for val in result["list"] : print val["orderno"],val["outorderno"] print val["account"],val["num"] print val["status"],val["rechargestatus"] print val["amount"],val["totalfee"] print val["addtime"],val["name"] print val["areaid"],val["company"]
package api.jisuapi.mobilerecharge; /** * 查询话费订单列表 */ import api.util.HttpUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; public class Orderlist { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/mobilerecharge/orderlist"; public static final int pagenum = 1;//当前页 public static final int pagesize = 20;//每页数量,最大20 public static void Get() { String result = null; String url = URL + "?appkey=" + APPKEY + "&pagenum=" + pagenum + "&pagesize=" + pagesize; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = (JSONObject) json.opt("result"); String total = resultarr.getString("total"); String pagenum = resultarr.getString("pagenum"); String pagesize = resultarr.getString("pagesize"); System.out.println(total + " " + pagenum + " " + pagesize); JSONArray list = resultarr.optJSONArray("list"); for (int i = 0; i < list.size(); i++) { JSONObject obj = (JSONObject) list.opt(i); String orderno = obj.getString("orderno"); String outorderno = obj.getString("outorderno"); String account = obj.getString("account"); String num = obj.getString("num"); String status = obj.getString("status"); String rechargestatus = obj.getString("rechargestatus"); String amount = obj.getString("amount"); String totalfee = obj.getString("totalfee"); String addtime = obj.getString("addtime"); String name = obj.getString("name"); String areaid = obj.getString("areaid"); String company = obj.getString("company"); System.out.println(orderno + " " + outorderno + " " + account + " " + num + " " + status + " " + rechargestatus + " " + amount + " " + totalfee + " " + addtime + " " + name + " " + areaid + " " + company); } } } catch (Exception e) { e.printStackTrace(); } } }
{ "status": 0, "msg": "ok", "result": { "total": "3", "pagenum": "1", "pagesize": "20", "list": [ { "orderno": "201604220714555074534", "outorderno": "", "account": "15158825888", "num": "1", "status": "1", "rechargestatus": "1", "amount": "10.00", "totalfee": "10.05", "addtime": "1461309295", "name": "浙江移动话费10元直充", "areaid": "30", "company": "移动", }, { "orderno": "201604220634197256659", "outorderno": "", "account": "15158825888", "num": "1", "status": "1", "rechargestatus": "1", "amount": "10.00", "totalfee": "10.05", "addtime": "1461306859", "name": "浙江移动话费10元直充", "areaid": "30", "company": "移动", }, { "orderno": "201604220431278398036", "outorderno": "", "account": "15158825888", "num": "1", "status": "1", "rechargestatus": "0", "amount": "10.00", "totalfee": "10.05", "addtime": "1461299487", "name": "浙江移动话费10元直充", "areaid": "30", "company": "移动", } ] } }
参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
orderno | string | 是 | 订单号 |
outorderno | string | 否 | 商家订单号 和订单号任选其一 如果商家订单号重复,只返回最新的一条详情 |
参数名称 | 类型 | 说明 |
---|---|---|
orderno | string | 订单号 |
outorderno | string | 商家订单号 |
account | string | 充值账号 |
num | int | 数量 一般为1 |
status | int | 状态 一般为1,订单完成 |
rechargestatus | string | 充值状态 0充值中 1充值成功 2充值失败 即时返回0,状态信息请从订单详情接口获取 |
amount | string | 面值 |
totalfee | string | 总金额 |
addtime | int | 订单时间 |
name | string | 产品名称 |
areaid | int | 区域ID 参考全国城市规划API |
company | string | 运营商 |
<?php require 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $orderno = '221601241155888';//订单号 $outorderno = '77888855888';//商家订单号,和订单号任选其一 $url = "https://api.jisuapi.com/mobilerecharge/orderdetail?appkey=$appkey&orderno=$orderno&outorderno=$outorderno"; $result = curlOpen($url, ['ssl'=>true]); $jsonarr = json_decode($result, true); //exit(var_dump($jsonarr)); if($jsonarr['status'] != 0) { echo $jsonarr['msg']; exit(); } $result = $jsonarr['result']; echo $result['total'].' '.$result['pagesize'].' '.$result['pagenum'].'
'; echo $result['orderno'].' '.$result['outorderno'].'
'; echo $result['account'].' '.$result['num'].'
'; echo $result['status'].' '.$result['rechargestatus'].'
'; echo $result['amount'].' '.$result['totalfee'].'
'; echo $result['addtime'].' '.$result['name'].'
'; echo $result['areaid'].' '.$result['company'].'
';
#!/usr/bin/python # encoding:utf-8 import urllib2, json, urllib, hashlib # 3、获取订单详情 data = {} data["appkey"] = "your_appkey_here" data["orderno"] = "221605250929585085725" data["outorderno"] = "77888855888" url_values = urllib.urlencode(data) url = "https://api.jisuapi.com/mobilerecharge/orderdetail" + "?" + url_values request = urllib2.Request(url) result = urllib2.urlopen(request) jsonarr = json.loads(result.read()) if jsonarr["status"] != u"0": print jsonarr["msg"] exit() result = jsonarr["result"] print result["total"],result["pagesize"],result["pagenum"], print result["orderno"],result["outorderno"], print result["account"],result["num"], print result["status"],result["rechargestatus"], print result["amount"],result["totalfee"], print result["addtime"],result["name"], print result["areaid"],result["company"],
package api.jisuapi.mobilerecharge; /** * 查询话费订单详情 */ import api.util.HttpUtil; import net.sf.json.JSONObject; public class Orderdetail { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/mobilerecharge/orderdetail"; public static final String orderno = "221601241155888";// 订单号 public static final String outorderno = "77888855888";// 商家订单号,和订单号任选其一 public static void Get() { String result = null; String url = URL + "?appkey=" + APPKEY + "&orderno=" + orderno + "&outorderno=" + outorderno; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = (JSONObject) json.opt("result"); String orderno = resultarr.getString("orderno"); String outorderno = resultarr.getString("outorderno"); String account = resultarr.getString("account"); String num = resultarr.getString("num"); String status = resultarr.getString("status"); String rechargestatus = resultarr.getString("rechargestatus"); String amount = resultarr.getString("amount"); String totalfee = resultarr.getString("totalfee"); String addtime = resultarr.getString("addtime"); String name = resultarr.getString("name"); String areaid = resultarr.getString("areaid"); String company = resultarr.getString("company"); System.out.println(orderno + " " + outorderno + " " + account + " " + num + " " + status + " " + rechargestatus + " " + amount + " " + totalfee + " " + addtime + " " + name + " " + areaid + " " + company); } } catch (Exception e) { e.printStackTrace(); } } }
{ "status": 0, "msg": "ok", "result": { "orderno": "201604220714555074534", "outorderno": "", "account": "15158825888", "num": "1", "status": "1", "rechargestatus": "1", "amount": "10.00", "totalfee": "10.05", "addtime": "1461309295", "name": "浙江移动话费10元直充", "areaid": "30", "company": "移动", } }
参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
mobile | string | 否 | 手机号 |
参数名称 | 类型 | 说明 |
---|---|---|
name | string | 产品名称 |
areaid | string | 区域ID 参考全国城市规划API |
company | string | 运营商 |
price | string | 单价 |
amount | string | 面值 |
<?php require 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $url = "https://api.jisuapi.com/mobilerecharge/goods?appkey=$appkey"; $result = curlOpen($url, ['ssl'=>true]); $jsonarr = json_decode($result, true); //exit(var_dump($jsonarr)); if($jsonarr['status'] != 0) { echo $jsonarr['msg']; exit(); } $result = $jsonarr['result']; foreach($result['list'] as $val) { echo $val['name'].' '.$val['areaid'].' '.$val['company'].' '.$val['price'].' '.$val['amount'].'
'; }
#!/usr/bin/python # encoding:utf-8 import urllib2, json, urllib, hashlib # 4、获取商品列表 data = {} data["appkey"] = "your_appkey_here" url_values = urllib.urlencode(data) url = "https://api.jisuapi.com/mobilerecharge/goods" + "?" + url_values request = urllib2.Request(url) result = urllib2.urlopen(request) jsonarr = json.loads(result.read()) if jsonarr["status"] != u"0": print jsonarr["msg"] exit() result = jsonarr["result"] for val in result["list"] : print val["name"],val["areaid"],val["company"],val["price"],val["amount"]
package api.jisuapi.mobilerecharge; /** * 获取商品列表 */ import api.util.HttpUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; public class Goods { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/mobilerecharge/goods"; public static void Get() { String result = null; String url = URL + "?appkey=" + APPKEY; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = (JSONObject) json.opt("result"); JSONArray list = resultarr.optJSONArray("list"); for (int i = 0; i < list.size(); i++) { JSONObject obj = (JSONObject) list.opt(i); String name = obj.getString("name"); String areaid = obj.getString("areaid"); String company = obj.getString("company"); String price = obj.getString("price"); String amount = obj.getString("amount"); System.out.println(name + " " + areaid + " " + company + " " + price + " " + amount); } } } catch (Exception e) { e.printStackTrace(); } } }
{ "status": 0, "msg": "ok", "result": { "list": [ { "name": "云南电信话费30元直充", "areaid": "29", "company": "电信", "province": "云南", "amount": "30", "adviceprice": "31.00", "price": "29.62", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "云南电信话费50元直充", "areaid": "29", "company": "电信", "province": "云南", "amount": "50", "adviceprice": "50.00", "price": "49.45", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "云南电信话费100元直充", "areaid": "29", "company": "电信", "province": "云南", "amount": "100", "adviceprice": "100.00", "price": "98.79", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "云南电信话费200元直充", "areaid": "29", "company": "电信", "province": "云南", "amount": "200", "adviceprice": "200.00", "price": "197.48", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "云南电信话费300元直充", "areaid": "29", "company": "电信", "province": "云南", "amount": "300", "adviceprice": "300.00", "price": "296.22", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "云南电信话费500元直充", "areaid": "29", "company": "电信", "province": "云南", "amount": "500", "adviceprice": "500.00", "price": "493.71", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "电信", "province": "浙江", "amount": "1", "adviceprice": "", "price": "1.00", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "电信", "province": "浙江", "amount": "2", "adviceprice": "", "price": "2.00", "limitprice": "", "sms": "", "rechargetime": "" } ] } }
参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
mobile | string | 是 | 手机号 |
amount | string | 否 | 面值 |
参数名称 | 类型 | 说明 |
---|---|---|
mobile | string | 手机号 |
amount | string | 面值 |
name | string | 名称 |
areaid | string | 区域ID |
company | string | 运营商 |
province | string | 省份 |
price | string | 价格 |
<?php require 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $mobile = '15158825888';//必填 $amount = '100';//选填,不选返回全部 $url = "https://api.jisuapi.com/mobilerecharge/query?appkey=$appkey&mobile=$mobile&amount=$amount"; $result = curlOpen($url, ['ssl'=>true]); $jsonarr = json_decode($result, true); //exit(var_dump($jsonarr)); if($jsonarr['status'] != 0) { echo $jsonarr['msg']; exit(); } $result = $jsonarr['result']; foreach($result['list'] as $val) { echo $val['mobile'].' '.$val['amount'].' '.$val['name'].' '.$val['areaid'].' '.$val['company'].'
'; echo $val['province'].' '.$val['adviceprice'].' '.$val['price'].' '.$val['limitprice'].'
'; echo $val['sms'].' '.$val['rechargetime'].'
'; }
#!/usr/bin/python # encoding:utf-8 import json import urllib.request import urllib.parse data = {} data["appkey"] = "your_appkey_here" data["mobile"] = "15158825888" # 必填 data["amount"] = "100" data = urllib.parse.urlencode(data).encode('utf-8') url = "https://api.jisuapi.com/mobilerecharge/query" result = urllib.request.urlopen(url, data) jsonarr = json.loads(result.read()) if jsonarr["status"] != 0: print(jsonarr["msg"]) exit() result = jsonarr["result"] print(result["mobile"], result["amount"]) for val in result["list"]: print(val["name"], val["areaid"], val["company"], val["province"], val["amount"], val["adviceprice"], val["price"], val["limitprice"], val["sms"], val["rechargetime"])
{ "status": 0, "msg": "ok", "result": { "mobile": "15158825888", "amount": "0", "list": [ { "name": "", "areaid": "30", "company": "移动", "province": "浙江", "amount": "1", "adviceprice": "", "price": "1.10", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "移动", "province": "浙江", "amount": "2", "adviceprice": "", "price": "2.20", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "移动", "province": "浙江", "amount": "3", "adviceprice": "", "price": "3.30", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "移动", "province": "浙江", "amount": "4", "adviceprice": "", "price": "4.40", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费5元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "5", "adviceprice": "6.00", "price": "5.23", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "移动", "province": "浙江", "amount": "6", "adviceprice": "", "price": "6.60", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "移动", "province": "浙江", "amount": "7", "adviceprice": "", "price": "7.70", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "移动", "province": "浙江", "amount": "8", "adviceprice": "", "price": "8.80", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "", "areaid": "30", "company": "移动", "province": "浙江", "amount": "9", "adviceprice": "", "price": "9.90", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费10元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "10", "adviceprice": "11.00", "price": "10.00", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费20元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "20", "adviceprice": "21.00", "price": "20.00", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费30元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "30", "adviceprice": "31.00", "price": "30.00", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费50元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "50", "adviceprice": "50.00", "price": "50.00", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费100元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "100", "adviceprice": "100.00", "price": "100.00", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费200元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "200", "adviceprice": "200.00", "price": "199.60", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费300元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "300", "adviceprice": "300.00", "price": "299.00", "limitprice": "", "sms": "", "rechargetime": "" }, { "name": "浙江移动话费500元直充", "areaid": "30", "company": "移动", "province": "浙江", "amount": "500", "adviceprice": "500.00", "price": "499.00", "limitprice": "", "sms": "", "rechargetime": "" } ] } }
参数名称 | 类型 | 必填 | 说明 |
---|
参数名称 | 类型 | 说明 |
---|---|---|
outorderno | string | 商家订单号 |
orderno | string | 订单号 |
mobile | string | 手机号 |
rechargestatus | int | 充值状态 0充值中 1充值完成 2充值失败 |
amount | string | 面值 |
totalfee | string | 实际金额 |
sign | string | 签名,签名规则参考代码 |
<?php /** * 异步回调 * */ $orderno = $_POST['orderno']; $rechargestatus = $_POST['rechargestatus']; $arr = array('orderno'=>$orderno,'outorderno'=>$_POST['outorderno'],'mobile'=>$_POST['mobile'],'rechargestatus'=>$_POST['rechargestatus'],'amount'=>$_POST['amount'],'totalfee'=>$_POST['totalfee']); $appsecret = '123456789';//用户appsecret if(checkSign($arr, $appsecret, $_POST['sign'])) { //1成功 2充值失败 0充值中 switch($rechargestatus) { case '1': { //充值成功 // break; } case '2': { //充值失败 break; } } if($rechargestatus != 0) echo 'success'; exit(); } /** * 验证签名 * */ function checkSign($queryarr, $appsecret, $signature) { $str = makeSign($queryarr, $appsecret); if($str == strtolower($signature)) return true; else return false; } /** * 生成签名 * */ function makeSign($queryarr, $appsecret) { ksort($queryarr, SORT_STRING); $str = implode($queryarr); $str .= $appsecret; //exit($str); $str = md5($str); return $str; }
代号 | 说明 |
---|---|
201 | 手机号为空 |
202 | 充值金额不正确 |
203 | 手机号不正确 |
204 | 签名为空 |
205 | 验签失败 |
206 | 账户余额不足 |
207 | 不支持的手机号 |
208 | 订单号为空 |
210 | 未知错误 |
211 | 商家订单号为空 |
212 | 商家订单号已存在 |
215 | 地区运营商维护 |
216 | 未找到该订单号 |
代号 | 说明 |
---|---|
101 | APPKEY为空或不存在 |
102 | APPKEY已过期 |
103 | APPKEY无请求此数据权限 |
104 | 请求超过次数限制 |
105 | IP被禁止 |
106 | IP请求超过限制 |
107 | 接口维护中 |
108 | 接口已停用 |
计次套餐 | 套餐规格 | 价格 | ||
---|---|---|---|---|
10元话费充值 | 10元次 | 10.00 - 10.10 元 | - | |
20元话费充值 | 20元次 | 19.96 - 20.20 元 | - | |
30元话费充值 | 30元次 | 29.94 - 30.30 元 | - | |
50元话费充值 | 50元次 | 49.90 - 50.50 元 | - | |
100元话费充值 | 100元次 | 99.60 - 101.00 元 | - | |
200元话费充值 | 200元次 | 199.59 - 202.00 元 | - | |
300元话费充值 | 300元次 | 299.39 - 303.00 元 | - | |
500元话费充值 | 500元次 | 498.98 - 505.00 元 | - |