Recently I am working on a small project, one of which is to realize the function of mobile phone bill recharge. I searched for a long time on the Internet, and finally found the mobile phone bill recharge API on the aggregated data. I will share it below, hoping to help friends who need it.
Aggregate Data is an API aggregation platform that provides many types of APIs , and its mobile phone bill recharge interface is also good.
Mobile phone bill recharge API
1.1 Check whether the mobile phone number can be recharged
Interface address: http://op.juhe.cn/ofpay/mobile/telcheck
Supported formats: json
Request method: http post/get
Request example: http://op.juhe.cn/ofpay/mobile/telcheck?cardnum=100&phoneno=13429667914&key=the KEY you applied for
Interface Note: Check whether the mobile phone number and amount can be recharged
Description of request parameters:
name |
Types of |
Required |
illustrate |
phoneno |
string |
Yes |
cellphone number |
cardnum |
string |
Yes |
Recharge amount , currently available: 10 , 20 , 30 , 50 , 100 , 300 |
key |
string |
Yes |
Application APPKEY ( application detail page query ) |
Return parameter description:
name |
Types of |
illustrate |
error_code |
int |
return code |
reason |
string |
Back to Instructions |
result |
string |
return result set |
JSON return example:
{ "reason": "Mobile number and amount allowed to recharge", "result": null, "error_code": 0 }
1.2 Query merchants based on mobile phone number and face value
Interface address: http://op.juhe.cn/ofpay/mobile/telquery
Supported formats: json
Request method: http get/post
Request example: http://op.juhe.cn/ofpay/mobile/telquery?cardnum=30&phoneno=18913515635&key=KEY you applied for
Interface Note: Query product information according to mobile phone number and face value
Description of request parameters:
name |
Types of |
Required |
illustrate |
phoneno |
string |
Yes |
cellphone number |
cardnum |
string |
Yes |
Recharge amount , currently available: 10 , 20 , 30 , 50 , 100 , 300 |
key |
string |
Yes |
Application APPKEY ( application detail page query ) |
Return parameter description:
name |
Types of |
illustrate |
error_code |
int |
return code |
reason |
string |
Back to Instructions |
result |
string |
return result set |
JSON return example:
{ "reason": "成功", "result": { "cardid": "191404", /*卡类ID*/ "cardname": "江苏电信话费100元直充", /*卡类名称*/ "inprice": 98.4, /*购买价格*/ "game_area": "江苏苏州电信" /*手机号码归属地*/ }, "error_code": 0 }
1.3手机直充接口
接口地址:http://op.juhe.cn/ofpay/mobile/onlineorder
支持格式:json
请求方式:http get/post
请求示例:http://op.juhe.cn/ofpay/mobile/onlineorder?key=KEY&phoneno=18913513535&cardnum=100&orderid=2014111111113&sign=fb1ed32a9540c24b03cc0c06aabbb642
接口备注:依据用户提供的请求为指定手机直接充值,***如果充值过程中,遇到http网络状态异常或错误码返回系统异常100014,请务必通过订单查询接口检测订单或联系客服,不要直接做失败处理,避免照成不必要的损失!!!
请求参数说明:
名称 |
类型 |
必填 |
说明 |
phoneno |
string |
是 |
手机号码 |
cardnum |
string |
是 |
充值金额,目前可选:10、20、30、50、100、300 |
orderid |
string |
是 |
商家订单号,8-32位字母数字组合,由您自己生成 |
key |
string |
是 |
应用APPKEY(应用详细页查询) |
sign |
string |
是 |
校验值,md5(OpenID+key+phoneno+cardnum+orderid),OpenID在个人中心查询 |
返回参数说明:
名称 |
类型 |
说明 |
error_code |
int |
返回码 |
reason |
string |
返回说明 |
result |
string |
返回结果集 |
JSON返回示例:
{ "reason": "订单提交成功,等待充值", "result": { "cardid": "1900212", /*充值的卡类ID*/ "cardnum": "1", /*数量*/ "ordercash": 49.25, /*进货价格*/ "cardname": "江苏电信话费50元直充", /*充值名称*/ "sporder_id": "20141120174602882", /*聚合订单号*/ "uorderid":"2014123115121",/*商户自定的订单号*/ "game_userid": "18913515122", /*充值的手机号码*/ "game_state": "0" /*充值状态:0充值中 1成功 9撤销,刚提交都返回0*/ }, "error_code": 0 }
1.4订单状态查询
接口地址:http://op.juhe.cn/ofpay/mobile/ordersta
支持格式:json
请求方式:http get/post
请求示例:http://op.juhe.cn/ofpay/mobile/ordersta?key=&orderid=a112244411a
接口备注:查询订单的最新状态,请确认订单成功提交后,再查询哦~
请求参数说明:
名称 |
类型 |
必填 |
说明 |
orderid |
string |
是 |
商家订单号,8-32位字母数字组合,请填写已经成功提交的订单号 |
key |
string |
是 |
应用APPKEY(应用详细页查询) |
返回参数说明:
名称 |
类型 |
说明 |
error_code |
int |
返回码 |
reason |
string |
返回说明 |
result |
string |
返回结果集 |
JSON返回示例:
{ "reason": "查询成功", "result": { "uordercash": "5.000", /*订单扣除金额*/ "sporder_id": "20150511163237508",/*聚合订单号*/ "game_state": "1" /*状态 1:成功 9:失败 0:充值中*/ }, "error_code": 0 }
1.5状态回调配置
充值接口测试完毕,需联系在线客服进行回调配置。
演示:
最后,附《手机话费充值》资费说明:
卡种 |
面额 |
价格 |
10元话费直冲 |
¥10.00 |
¥9.80~¥10.2 |
20元话费直冲 |
¥20.00 |
¥19.60~¥20.1 |
30元话费直冲 |
¥30.00 |
¥29.54~¥30 |
50元话费直冲 |
¥50.00 |
¥49.25~¥50 |
100元话费直冲 |
¥100.00 |
¥99.4~¥100 |
300元话费直冲 |
¥300.00 |
¥295.5~¥296.4 |