文档控制台
文档首页/
Paynicorn 支付/
API 文档/
话费充值/

话费充值

更新时间:2024.06.25 09:52:42

话费充值

话费充值接口

接口说明

给指定手机号充值话费。

异步通知:

  • 成功的交易有异步通知,但失败/处理中的交易不会callback给商户,需要商户主动查询交易结果。

接口地址

https://api.paynicorn.com/trade/topup/api/topup

请求方式:post

请求参数

参数名参数类型填写要求描述
transIdstringM商户订单 ID
appKeystringM商户应用Appkey
countryCodestringM国家码
bizTypestringM业务类型 说明:固定是m_topup 话费
operatorCodestringM运营商编码(根据手机号查询运营商接口获取)
benefitNostringM要充值的号码(不需要国家码)
amountBigDecimalM充值金额(支持的金额以paynicorn 运营提供为准)
memostringO备注

响应参数

参数名参数类型填写要求备注
codeintM请求处理的标识。
msgstringM请求处理信息
resultJsonObjO返回结果
result对象参数
参数名参数类型填写要求描述
transIdstringM商户订单 ID
orderIdstringM话费充值订单号 ID
statusCodestringM交易状态,0: 充值处理中,1: 充值成功,2:充值失败
descriptionstringM描述

报文示例

Request Body

{
    "transId":"V3T1719295709739",
    "appKey": "T90B124766qU95d385O4",
    "countryCode": "NG",
    "bizType": "m_topup",
    "operatorCode": "NG_AIRTEL",
    "benefitNo": "9073542823",
    "amount": 1000,
    "memo": ""
}

Response

{
  "code": 1200,
  "msg": "success",
  "result": {
    "transId": "V3T1712672262694", //商户订单ID
    "statusCode": "0",
    "description": "transaction in process",
    "orderId": 12418046125113395 //话费充值订单号ID
  }
}

注意:

  1. 若同步响应返回下述错误码和错误消息,商户可以主动关单:
code 错误代码msg 错误消息
4001invalid signature
4002invalid appId
4003unsupported business
4004unsupported amount
4005invalid packageId
4006invalid benefitNo
4007invalid transId
4008transId is null
4009transId already exist
4010phone number is empty
4011unknown operator
4012no active wallet of this currency
4013Insufficient balance
4014Exceed the minute limit
4015Exceed the daily times limit
4016channel disable
4017channelCode is null
4018channelCode is error
4019sp product is null
4020appKey is null
4021callbackUrl is null
4022callback url error
4023secret key is null
4024unknown appKey
4025sp order mapping error
4027Pleas check product information
4027Please activate the product function
4028Paynicorn CP Insufficient balance
4030Recharge phone error
4031Recharge country error
4032Recharge operator error
4033Exceed operator the minute limit
  1. 若同步响应返回的结果如下,则可以结合业务逻辑进行判断或者查询此订单的状态来决定是否要关闭此订单:
code 错误代码msg 错误消息
4026merchant Overbooking

上述两种情况的示例报文响应:

{
  "code": 4028, "msg": "Paynicorn CP Insufficient balance"
}

充值交易查询接口

接口说明

查询交易状态及交易详情信息接口

接口地址

https://api.paynicorn.com/trade/topup/api/query

请求方法:post

请求参数

参数名参数类型填写要求描述
appKeystringM商户应用ID
transIdstringM商户交易号

响应参数

参数名参数类型填写要求描述
codeintM请求处理的标识
msgstringM请求处理信息
resultJsonObjO返回结果
result参数
参数名参数类型填写要求描述
transIdstringM交易ID
statusCodestringM交易状态
descriptionstringM描述
countryCodestringM国家码
bizTypestringO业务类型,冗余字段,兼容老版本
operatorCodestringM运营商编码
benefitNostringM要充值的号码
amountBigDecimalM充值金额
packageIdstringO流量套餐ID,冗余字段,兼容老版本
packageDescstringM流量套餐描述
memostringM备注
tokenDatastringO返回给用户的token数据(电费),冗余字段,兼容老版本

报文示例

RequestBody

{
  "appKey": "p3k0Y312LzX6Dv87lVa1",
  "transId": "1234567890"
}

Response

{
  "code": 1200,
  "msg": "success",
  "result": {
    "transId": "1234567890",
    "statusCode":"1",
    "description":"transaction successful",
    "countryCode": "NG",
    "bizType": "m_topup",
    "operatorCode": "9mobile",
    "benefitNo": "08184123954",
    "packageId": "3199"
  }
}

若返回的响应如下,本订单可以被主动关闭:

{
  "code": 4007,
  "msg": "invalid transId"
}

{
  "code": 4008,
  "msg": "transId is null"
}

手机号查询充值运营商

接口说明

根据手机号查询手机号归属的运营商

接口地址

https://api.paynicorn.com/trade/topup/api/queryOperatorCode

请求方法:post

请求参数

参数名参数类型填写要求描述
nationalPhoneNostringM手机号
countryCodestringM国家码

响应参数

参数名参数类型填写要求描述
codeintM请求处理的标识
msgstringM请求处理信息
resultJsonObjM返回结果
result对象参数
参数名参数类型填写要求描述
countryCodestringM国家编码
currencystringM币种编码
areaCodestringM国家区号
operatorCodestringMPAYNICORN运营商编码
operatorNamestringM运营商全程

报文示例

Request

  {
  "countryCode": "NG",
  "nationalPhoneNo": "07012345678"
  }

Response

  {
  "code": 1200,
  "msg": "success",
      "result": {
        "countryCode": "NG",
        "currency": "NGN",
        "areaCode": "234",
        "operatorCode": "NG_AIRTEL",
        "operatorName": "Airtel Nigeria"
      }
  }

查询话费充值产品接口

接口说明

查询 Paynicorn 支持的话费充值产品

接口地址

https://api.paynicorn.com/trade/topup/api/queryGoods

方法: POST

描述: 查询话费产品

请求参数

参数位置参数名参数类型是否必须描述
BodyappKeystringY商户应用 Appkey
BodyproductCodestringY产品类型
BodycountryCodestringN国家码

响应参数

参数位置参数名参数类型描述
Bodycodeint请求处理的标识
Bodymsgstring请求处理信息
BodyresultJsonObj返回结果

result对象参数

参数位置参数名参数类型描述
resultproductCodestring产品类型
resultcountryCodestring国家
resultoperatorCodestring运营商编码
resultgoodsIdstring产品ID
resultrechargeAmountBigDecimal固定充值金额
resultrechargeMinAmountBigDecimal区间充值最小金额
resultrechargeMaxAmountBigDecimal区间充值最大金额
resultrechargeCurrencystring充值币种
resultbuyingTypestring购买方式(固定金额:FIXED, 区间金额:RANGE)

报文示例

Request Body

{
    "appKey": "T90B124766qU95d385O4",
    "countryCode": "NG",
    "productCode": "m_topup"
}

Response

{
        "code": 1200,
        "msg": "success",
        "result": [{
                "id": 111,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_9MOBILE",
                "goodsId": "NG75850224649",
                "rechargeAmount": 0.00,
                "rechargeMinAmount": 5.00,
                "rechargeMaxAmount": 50000.00,
                "rechargeCurrency": "NGN",
                "buyingType": "RANGE"
        }, {
                "id": 112,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_AIRTEL",
                "goodsId": "NG76268129842",
                "rechargeAmount": 0.00,
                "rechargeMinAmount": 50.00,
                "rechargeMaxAmount": 199999.00,
                "rechargeCurrency": "NGN",
                "buyingType": "RANGE"
        }, {
                "id": 113,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_GLOMOBILE",
                "goodsId": "NG76268155966",
                "rechargeAmount": 0.00,
                "rechargeMinAmount": 10.00,
                "rechargeMaxAmount": 50000.00,
                "rechargeCurrency": "NGN",
                "buyingType": "RANGE"
        }, {
                "id": 114,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_MTN",
                "goodsId": "NG76268187529",
                "rechargeAmount": 0.00,
                "rechargeMinAmount": 50.00,
                "rechargeMaxAmount": 200000.00,
                "rechargeCurrency": "NGN",
                "buyingType": "RANGE"
        }, {
                "id": 864,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_MTN",
                "goodsId": "NG86726385341",
                "rechargeAmount": 50.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 865,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_AIRTEL",
                "goodsId": "NG86726395639",
                "rechargeAmount": 50.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 866,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_GLOMOBILE",
                "goodsId": "NG86726402194",
                "rechargeAmount": 50.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 867,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_9MOBILE",
                "goodsId": "NG86726416039",
                "rechargeAmount": 50.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 868,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_MTN",
                "goodsId": "NG86726440785",
                "rechargeAmount": 100.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 869,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_AIRTEL",
                "goodsId": "NG86726447520",
                "rechargeAmount": 100.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 870,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_GLOMOBILE",
                "goodsId": "NG86726452919",
                "rechargeAmount": 100.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 871,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_9MOBILE",
                "goodsId": "NG86726459135",
                "rechargeAmount": 100.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 887,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_MTN",
                "goodsId": "NG90954544534",
                "rechargeAmount": 500.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 888,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_AIRTEL",
                "goodsId": "NG90954553494",
                "rechargeAmount": 500.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 889,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_9MOBILE",
                "goodsId": "NG90954558552",
                "rechargeAmount": 500.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 890,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_GLOMOBILE",
                "goodsId": "NG90954562643",
                "rechargeAmount": 500.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 934,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_9MOBILE",
                "goodsId": "NG10207839146",
                "rechargeAmount": 200.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 935,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_AIRTEL",
                "goodsId": "NG10207846781",
                "rechargeAmount": 200.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 936,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_GLOMOBILE",
                "goodsId": "NG10207855858",
                "rechargeAmount": 200.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 937,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_MTN",
                "goodsId": "NG10207861851",
                "rechargeAmount": 200.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 938,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_9MOBILE",
                "goodsId": "NG10207885019",
                "rechargeAmount": 1000.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 939,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_AIRTEL",
                "goodsId": "NG10207889471",
                "rechargeAmount": 1000.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 940,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_GLOMOBILE",
                "goodsId": "NG10207893411",
                "rechargeAmount": 1000.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }, {
                "id": 941,
                "productCode": "m_topup",
                "countryCode": "NG",
                "operatorCode": "NG_MTN",
                "goodsId": "NG10207897749",
                "rechargeAmount": 1000.00,
                "rechargeMinAmount": 0.00,
                "rechargeMaxAmount": 0.00,
                "rechargeCurrency": "NGN",
                "buyingType": "FIXED"
        }]
}

充值异步通知(recharge_callback)

接口说明

充值系统完成充值流程后,会回调商户在后台配置的商户回调接口,通知商户充值结果以及充值详情。

请注意:

  1. 回调接口URL须为外部可正常访问,且不带后缀参数的URL地址,接收请求类型为 POST 。
  2. 本接口只对成功的 话费充值 交易发起回调通知,其余状态的交易需要商户主动查询交易结果

接口地址

商户提供,通过商户平台配置,参见设置应用回调地址

请求参数

响应参数

参数名类型填写要求备注
orderNoStringM充值订单ID
originOrderNoStringM源订单ID(接入方订单ID)
statusIntegerM回调状态(0.充值中,1.成功,2.失败)
timestampIntegerM订单完成时间

充值完成后,充值后台会把充值相关信息发送给商户,商户需要接收处理该回调通知请求,并返回正确应答。 HttpsStatus=200代表接受到通知并返回字符串success,其他代表通知失败。

针对通知失败的订单,没有重试机制。商户可主动通过充值交易查询接口查询最终结果。

报文示例

{
        "deductionAmount": 0.2400,
        "deductionCurrency": "USD",
        "orderNo": "12428686363427123",
        "originOrderNo": "9242868607189027501",
        "status": 1, //0: 充值处理中,1: 充值成功,2:充值失败
        "timestamp": 1717745928,
        "verified": false
}