银联商务天满服务平台
Java PHP Python



import com.chinaums.open.api.OpenApiCache;
import com.chinaums.open.api.OpenApiContext;
import com.chinaums.open.api.constants.ConfigBean;
import com.chinaums.open.api.internal.util.http.HttpTransport;
import java.util.UUID;

public class OpenApiSdkTest {
    public static void main(String[] args) throws Exception{
        String url = "https://api-mop.chinaums.com/v1/netpay/bills/query";
        //开发者ID
        String appId = "平台分配";
        //开发者秘钥
        String appKey = "平台分配";
        //实例化客户端
        ConfigBean configBean = new ConfigBean();
        OpenApiContext context = new OpenApiContext();
        String request = "{\"requestTimestamp\":\"2020-02-26 13:55:37\",
                    \"mid\":\"898340149000005\",
                    \"tid\":\"00000001\",
                    \"instMid\":\"QRPAYDEFAULT\",
                    \"billNo\":\"31942002269255200133896901\",
                    \"billDate\":\"2020-02-26\",
                    \"msgId\":\"800000000010\",
                    \"srcReserve\":\"test\",
                    \"refundOrderId\":\"31942002269255200133896901\",
                    \"authedOrderId\":\"31942002269255200133896901\"}";
        context.setStartTime(System.currentTimeMillis());
        context.setRequestId(UUID.randomUUID().toString().replace("-", ""));
        context.setOpenServUrl(url.split("/v")[0].concat("/"));
        context.setApiServiceUrl(url);
        context.setVersion(url.split("/")[3]);
        context.setAppId(appId);
        context.setAppKey(appKey);
        context.setConfigBean(configBean);
        context.setServiceCode(url.split("/v")[1].substring(1));
        OpenApiCache.getCurrentToken(context);
        System.out.println(HttpTransport.getInstance().doPost(context, request));
    }
}
<?php
require_once "../utils/Log.php";
require_once "../utils/Tools.php";
require_once "../DefaultOpenApiClient.php";
class DataRequest

{
    public $url = "";
    public $serviceCode = "";
    public $apiVersion ="";
    public $needToken = true;
    public $needDataTag = false;
    public $data;

    function __construct($data, $url)
    {
        $this->data = $data;
        $apiVersion = preg_split("/[/]+/s",$url)[2];
        $this->apiVersion = $apiVersion;
        $serviceCode = strstr($url,$apiVersion);
        $this->url = strstr($url,"/".$apiVersion,true);
        $this->serviceCode = preg_replace("/^" . preg_quote($apiVersion, "/") . "/", "", $serviceCode);
    }
}

class DataDemo{
    public function main(){
        $appid = "平台分配";
        $appkey = "平台分配";
        $url = "https://api-mop.chinaums.com/v1/netpay/bills/query";
        $data = json_encode(array("requestTimestamp"=>"2020-02-26 13=>55=>37",
                    "mid"=>"898340149000005",
                    "tid"=>"00000001",
                    "instMid"=>"QRPAYDEFAULT",
                    "billNo"=>"31942002269255200133896901",
                    "billDate"=>"2020-02-26",
                    "msgId"=>"800000000010",
                    "srcReserve"=>"test",
                    "refundOrderId"=>"31942002269255200133896901",
                    "authedOrderId"=>"31942002269255200133896901"));
        $reqiest = new DataRequest($data,$url);
        $client = new DefaultOpenApiClient();
        $content = $client->execute($reqiest,$appid,$appkey);
        $obj = json_decode($content);
        print_r($obj->errCode);
        print_r($obj->errInfo);
    }
}
$p = new DataDemo();
$p->main();
?>
# -*- coding: utf-8 -*-
from webapi.DefaultOpenApiClient import DefaultOpenApiClient

url = "https://api-mop.chinaums.com/v1/netpay/bills/query"

class DataRequest(object):
    def __init__(self, data: dict) -> dict:
        self.data = data
        self.serviceCode = url[len(url.split("/v")[0])+len(url.split("/")[3])+1: len(url)]
        self.apiVersion = url.split("/")[3]
        self.needToken = True
        self.needDataTag = True

appId="平台分配"
appKey="平台分配"
client = DefaultOpenApiClient(appId, appKey)
cls = DataRequest({\"requestTimestamp\":\"2020-02-26 13:55:37\",
                    \"mid\":\"898340149000005\",
                    \"tid\":\"00000001\",
                    \"instMid\":\"QRPAYDEFAULT\",
                    \"billNo\":\"31942002269255200133896901\",
                    \"billDate\":\"2020-02-26\",
                    \"msgId\":\"800000000010\",
                    \"srcReserve\":\"test\",
                    \"refundOrderId\":\"31942002269255200133896901\",
                    \"authedOrderId\":\"31942002269255200133896901\"})
response = client.execute(cls)
print(str(response.get("data")))
print(response.get("errCode"))
print(response.get("errInfo"))
print(response.get("resultCode"))
print(response.get("resultInfo"))

账单状态查询

URL

  • 生产环境: POST https://api-mop.chinaums.com/v1/netpay/bills/query
  • 测试环境: POST https://test-api-open.chinaums.com/v1/netpay/bills/query

描述:一个账单可能使用多种支付方式(某种支付方式支付失败,再使用第二种支付方式),这种情况下一个账单对应多个账单支付流水。本接口获取的是成功的那一笔流水的相关信息(仅可能有一笔支付成功)。若所有流水都支付失败,那么仅返回支付状态,而不返回支付目标系统及相关支付流水信息。

ContentType:HTTP(S) + JSON

请求头

名称 必填 描述 示例值
Authorization 认证内容 (认证参考天满开发者中心->接入指引->平台认证方式:开发者中心 OPEN-BODY-SIG AppId="****",Timestamp="20170606135700",Nonce="99930a147f5353dd8a8f29a5329f37e9",Signature="IPmdGHYCcfN+mto0/02zkwoUF1NT3YqPKaUykMaec1T="

请求参数

名称 类型 必填 最大长度 描述 示例值
requestTimestamp string - 报文请求时间 格式:yyyy-MM-dd HH:mm:ss 2020-02-26 13:55:37
mid string 15 商户号 898340149000005
tid string 8 终端号 00000001
instMid string - 业务类型 QRPAYDEFAULT QRPAYDEFAULT
billNo string 31 账单号 31942002269255200133896901
billDate string - 订单时间 格式:yyyy-MM-dd 2020-02-26
msgId string 64 消息ID 原样返回 800000000010
srcReserve string 255 请求系统预留字段 test
refundOrderId string 32 退款订单号 当需要当前帐单退货记录的时候上送 31942002269255200133896901
authedOrderId string 32 预授权完成订单号 只有银联聚合码预授权业务,在进行完成操作后,如果需要查看完成记录,才需要上送 31942002269255200133896901

响应示例

{
  "errCode":"SUCCESS",
  "errMsg":"",
  "responseTimeStamp":"2020-02-26 13:57:27",
  "mid":"898340149000005",
  "tid":"00000001",
  "instMid":"QRPAYDEFAULT",
  "billNo":"31942002269255200133896901",
  "billDate":"2020-02-26",
  "msgId":"800000000010",
  "srcReserve":"test",
  "createTime":"2020-02-26 13:52:00",
  "billStatus":"PAID",
  "billDesc":"test create qrCode",
  "totalAmount":"2",
  "billQRCode":"https://qr-test2.chinaums.com/bills/qrCode.do?id=31942002268195125132885377",
  "memberId":"20200226001",
  "counterNo":"02",
  "merName":"测试商户",
  "memo":"测试",
  "secureStatus":"UNCOMPLETED ",
  "completeAmount":"2",
  "billPayment":
  {
    "merOrderId":"319420022692552001338969010",
    "billBizType":"bills",
    "paySeqId":"00684900520N",
    "totalAmount":"2",
    "buyerPayAmount":"2",
    "invoiceAmount":"2",
    "discountAmount":"2",
    "buyerId":"o8wNP0Z0Hh4yE71YaJuQpQotAokA",
    "buyerUsername":"testBuy",
    "payDetail":"TEST",
    "payTime":"2020-02-26 13:52:09",
    "settleDate":"2020-02-26",
    "status":"TRADE_SUCCESS",
    "targetOrderId":"319420022692552001338969010",
    "targetSys":"WXPay",
    "activityIds":"34542355",
    "buyerCashPayAmt":"2",
    "couponAmount":"2"
  },
  "refundBillPayment":
  {
    "merOrderId":"319420022692552001338969010",
    "billBizType":"bills",
    "paySeqId":"00684900520N",
    "totalAmount":"2",
    "buyerPayAmount":"2",
    "invoiceAmount":"2",
    "discountAmount":"2",
    "buyerId":"o8wNP0Z0Hh4yE71YaJuQpQotAokA",
    "buyerUsername":"testBuy",
    "payTime":"2020-02-26 13:52:09",
    "settleDate":"2020-02-26",
    "status":"UNKNOWN",
    "targetOrderId":"4200000508202002267605541955",
    "targetSys":"WXPay"
  },
  "authedBillPayment":
  {
    "merOrderId":"4200000508202002267605541955",
    "billBizType":"bills",
    "paySeqId":"00684900520N",
    "totalAmount":"2",
    "buyerPayAmount":"2",
    "invoiceAmount":"2",
    "discountAmount":"2",
    "buyerId":"o8wNP0Z0Hh4yE71YaJuQpQotAokA",
    "buyerUsername":"testBuy",
    "payTime":"2020-02-26 13:52:09",
    "settleDate":"2020-02-26",
    "status":"UNKNOWN",
    "targetOrderId":"4200000508202002267605541955",
    "targetSys":"WXPay"
  },
  "cardAttr":"T",
  "installmentNumber":"10",
  "retCommParams":
  {
    "foodOrderType":"pre_order",
    "brandId":"45256734",
    "storeId":"45256734",
    "tableNo":"02"
  } 
}

响应参数

名称 类型 必填 最大长度 描述 示例值
errCode string - 错误代码
平台错误码
业务错误码
SUCCESS
errMsg string - 错误说明
responseTimeStamp string - 报文应答时间 格式:yyyy-MM-dd HH:mm:ss 2020-02-26 13:57:27
mid string 15 商户号,原样返回 898340149000005
tid string 8 终端号,原样返回 00000001
instMid string 32 业务类型,原样返回 QRPAYDEFAULT QRPAYDEFAULT
billNo string 32 账单号 31942002269255200133896901
billDate string - 订单时间 格式yyyy-MM-dd 2020-02-26
msgId string 64 消息ID,原样返回 800000000010
srcReserve string 255 请求系统预留字段 test
createTime string - 账单创建时间 格式yyyy-MM-dd HH:mm:ss 2020-02-26 13:52:00
billStatus string - 账单状态 PAID
billDesc string - 账单描述 test create qrCode
totalAmount number - 账单总金额 若涉及营销联盟优惠,则此为优惠前总金额。单位:分 2
billQRCode string - 账单二维码 https://qr-test2.chinaums.com/bills/qrCode.do?id=31942002268195125132885377
memberId string - 会员号 20200226001
counterNo string - 桌号 02
merName string - 商户名称 测试商户
memo string - 付款附言 测试
secureStatus string - 担保交易状态 UNCOMPLETED
completeAmount number - 担保完成金额,单位:分 2
billPayment object 账单支付信息 TEST
   merOrderId string - 商户订单号 319420022692552001338969010
   billBizType string - 账单业务类型 bills
   paySeqId string - 交易参考号 00684900520N
   totalAmount number - 账单流水总金额,若涉及联盟优惠,则此为优惠后的总金额。单位:分 2
   buyerPayAmount number - 实付金额,单位:分 2
   invoiceAmount number - 开票金额 ,单位:分 2
   discountAmount number - 折扣金额,单位:分 2
   buyerId string - 买家ID o8wNP0Z0Hh4yE71YaJuQpQotAokA
   buyerUsername string - 买家用户名 testBuy
   payDetail string - 支付详情 TEST
   payTime string - 支付时间 格式:yyyy-MM-dd HH:mm:ss 2020-02-26 13:52:09
   settleDate string - 结算时间 格式:yyyy-MM-dd 2020-02-26
   status string - 交易状态 TRADE_SUCCESS
   targetOrderId string - 目标平台单号 319420022692552001338969010
   targetSys string - 目标系统 WXPay
   activityIds string - 微信活动ID 34542355
   buyerCashPayAmt number 64 实付现金金额,单位:分 2
   couponAmount number 64 渠道优惠金额,单位:分 2
refundBillPayment object 账单退款信息 已执行退款 且 查询请求中上送了refundOrderId时 才会返回
   merOrderId string - 商户退款单号 319420022692552001338969010
   billBizType string - 账单业务类型 bills
   paySeqId string - 交易参考号 00684900520N
   totalAmount number - 账单流水总金额,为该笔退货的退货请求金额单位:分 2
   buyerPayAmount number - 实付金额,单位:分 2
   invoiceAmount number - 开票金额,单位:分 2
   discountAmount number - 折扣金额,单位:分 2
   buyerId string - 买家ID o8wNP0Z0Hh4yE71YaJuQpQotAokA
   buyerUsername string - 买家用户名 testBuy
   payTime string - 支付时间 格式yyyy-MM-dd HH:mm:ss 2020-02-26 13:52:09
   settleDate string - 结算时间 格式yyyy-MM-dd 2020-02-26
   status string - 交易状态 UNKNOWN
   targetOrderId string - 目标平台单号 4200000508202002267605541955
   targetSys string - 目标系统 WXPay
authedBillPayment object 预授权账单信息 已执行预授权完成操作且 查询请求中上送了authedOrderId时 才会返回
   merOrderId string - 商户退款单号 4200000508202002267605541955
   billBizType string - 账单业务类型 bills
   paySeqId string - 交易参考号 00684900520N
   totalAmount number - 账单流水总金额,若涉及联盟优惠,则此为优惠后的总金额单位:分 2
   buyerPayAmount number - 实付金额,单位:分 2
   invoiceAmount number - 开票金额,单位:分 2
   discountAmount number - 折扣金额,单位:分 2
   buyerId string - 买家ID o8wNP0Z0Hh4yE71YaJuQpQotAokA
   buyerUsername string - 买家用户名 testBuy
   payTime string - 支付时间 格式yyyy-MM-dd HH:mm:ss 2020-02-26 13:52:09
   settleDate string - 结算时间 格式yyyy-MM-dd 2020-02-26
   status string - 交易状态 UNKNOWN
   targetOrderId string - 目标平台单号 4200000508202002267605541955
   targetSys string - 目标系统 WXPay
cardAttr string - 借贷记标识
DEBIT_CARD(借记卡);
CREDIT_CARD(贷记卡)
T
installmentNumber number 3612 花呗分期数 花呗分期支付才返 10
retCommParams object 扫码点餐信息
扫码点餐信息,支付宝只需上送扫码foodOrderType字段,云闪付只需上送brandId、storeId、tableNo字段提醒:
1.请求报文中retCommParams字段示例如{"brandId":"MY_STYLE","storeId":"S001","tableNo":"T001"}(见文档请求示例报文)
2.二级字段foodOrderType最大长度为32位。
   foodOrderType string 32 扫码点餐字段
扫码点餐类型取值:
qr_order:店内扫码点餐
pre_order:预点到店自提
home_delivery:外送到家
direct_payment:直接付款
other:其他
pre_order
   brandId string 32 品牌标识 45256734
   storeId string 32 门店标识 45256734
   tableNo string 32 桌号 02

错误码