银联商务天满服务平台
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/query";
        //开发者ID
        String appId = "平台分配";
        //开发者秘钥
        String appKey = "平台分配";
        //实例化客户端
        ConfigBean configBean = new ConfigBean();
        OpenApiContext context = new OpenApiContext();
        String request = "{\"requestTimestamp\":\"2022-04-14 17:29:10\",
                    \"mid\":\"898340149000005\",
                    \"tid\":\"00000001\",
                    \"msgId\":\"0DUNOje1Bwtue6XinEs7DWhKS2NmUCVg\",
                    \"srcReserve\":\"保留字段\",
                    \"instMid\":\"MINIDEFAULT\",
                    \"merOrderId\":\"327M1000220413916204214422\",
                    \"targetOrderId\":\"327M1000220413916204214422\"}";
        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/query";
        $data = json_encode(array("requestTimestamp"=>"2022-04-14 17=>29=>10",
                    "mid"=>"898340149000005",
                    "tid"=>"00000001",
                    "msgId"=>"0DUNOje1Bwtue6XinEs7DWhKS2NmUCVg",
                    "srcReserve"=>"保留字段",
                    "instMid"=>"MINIDEFAULT",
                    "merOrderId"=>"327M1000220413916204214422",
                    "targetOrderId"=>"327M1000220413916204214422"));
        $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/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\":\"2022-04-14 17:29:10\",
                    \"mid\":\"898340149000005\",
                    \"tid\":\"00000001\",
                    \"msgId\":\"0DUNOje1Bwtue6XinEs7DWhKS2NmUCVg\",
                    \"srcReserve\":\"保留字段\",
                    \"instMid\":\"MINIDEFAULT\",
                    \"merOrderId\":\"327M1000220413916204214422\",
                    \"targetOrderId\":\"327M1000220413916204214422\"})
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/query
  • 测试环境: POST https://test-api-open.chinaums.com/v1/netpay/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 2022-04-14 17:29:10
mid string 15 商户号 898340149000005
tid string 8 终端号 00000001
msgId string <=64 消息ID 原样返回 0DUNOje1Bwtue6XinEs7DWhKS2NmUCVg
srcReserve string <=255 请求系统预留字段 保留字段
instMid string 8..32 业务类型 MINIDEFAULT MINIDEFAULT
merOrderId string 6..64 商户订单号 327M1000220413916204214422
targetOrderId string 6..64 支付订单号 327M1000220413916204214422

响应示例

{
  "errCode":"SUCCESS",
  "errMsg":"",
  "responseTimeStamp":"2022-04-14 17:29:10",
  "mid":"898340149000005",
  "tid":"00000001",
  "instMid":"YUEDANDEFAULT",
  "billFunds":"",
  "billFundsDesc":"",
  "payTime":"2022-04-14 17:29:10",
  "couponMerchantContribute":"60",
  "couponOtherContribute":"60",
  "msgId":"0DUNOje1Bwtue6XinEs7DWhKS2NmUCVg",
  "srcReserve":"保留字段",
  "seqId":"34171290422N",
  "settleRefId":"34171290422N",
  "refId":"34171290422N",
  "status":"WAIT_BUYER_PAY",
  "totalAmount":"560",
  "merName":"测试商户",
  "merOrderId":"13DA002023071900000000003327",
  "targetOrderId":"317K202305220753441321190",
  "targetSys":"",
  "targetStatus":"",
  "buyerId":"86833140",
  "targetMid":"523693523",
  "bankCardNo":"",
  "bankInfo":"",
  "buyerPayAmount":"300",
  "buyerUsername":"测试用户",
  "couponAmount":"200",
  "invoiceAmount":"100",
  "receiptAmount":"200",
  "settleDate":"2022-04-14",
  "subBuyerId":"86833143",
  "activityIds":"",
  "yxlmAmount":"60",
  "cardAttr":"",
  "mCardAmt":"",
  "totalPromotionAmt":"0",
  "orderPromotionStatus":"0",
  "promotionList":
  {
    "chnlName":"",
    "promotionId":"",
    "eventNo":"",
    "eventName":"",
    "promotionRange":"",
    "promotionType":"",
    "eventPromotionAmt":"0",
    "platPromotionAmt":"0",
    "mchntPromotionAmt":"0",
    "thirdPartyPromotionAmt":"0",
    "thirdPartyPromotionDetail":"",
    "goodsList":
    {
      "goodsId":"",
      "promotionAmt":"0",
      "goodsNum":"0",
      "goodsPrice":"0",
      "goodsRemark":""
    } 
  },
  "oriPromotionList":
  {

  } 
}

响应参数

名称 类型 必填 最大长度 描述 示例值
errCode string 错误代码
平台错误码
业务错误码
SUCCESS
errMsg string 错误说明
responseTimeStamp string 报文应答时间 格式yyyy-MM-dd HH:mm:ss 2022-04-14 17:29:10
mid string 15 商户号,原样返回 898340149000005
tid string 8 终端号,原样返回 00000001
instMid string 8..32 业务类型,原样返回 YUEDANDEFAULT YUEDANDEFAULT
billFunds string 支付渠道列表 格式为:方式:金额(单位:分)\
billFundsDesc string 支付渠道描述
payTime string 支付时间 格式yyyy-MM-dd HH:mm:ss 2022-04-14 17:29:10
couponMerchantContribute number - 商户出资优惠金额,目前支持微信返回,其他渠道产品规划中 60
couponOtherContribute number - 其他出资优惠金额,目前支持微信返回,其他渠道产品规划中 60
msgId string <=64 消息ID,原样返回 0DUNOje1Bwtue6XinEs7DWhKS2NmUCVg
srcReserve string <=255 请求系统预留字段 保留字段
seqId string 平台流水号 34171290422N
settleRefId string 清分ID 如果来源方传了bankRefId就等于bankRefId,否则等于seqId 34171290422N
refId string 检索参考号 用在银联体系交易中 34171290422N
status string 交易状态 WAIT_BUYER_PAY
totalAmount number 支付总金额 560
merName string 商户名称 测试商户
merOrderId string 商户订单号 13DA002023071900000000003327
targetOrderId string 目标平台单号 317K202305220753441321190
targetSys string 目标平台代码
targetStatus string 目标平台的状态
buyerId string 买家ID 86833140
targetMid string 支付渠道商户号 各渠道情况不同,酌情转换 523693523
bankCardNo string 银行卡号
bankInfo string 银行信息
buyerPayAmount number 买家付款的金额 支付宝会有 300
buyerUsername string 买家用户名 测试用户
couponAmount number 网付计算的优惠金额 200
invoiceAmount number 交易中可给用户开具发票的金额 100
receiptAmount number 商户实收金额 支付宝会有 200
settleDate string 结算日期 格式yyyy-MM-dd 2022-04-14
subBuyerId string 子买家ID 如微信的subOpenId 86833143
activityIds string 微信活动ID
yxlmAmount number 营销联盟优惠金额 仅享受联盟优惠的订单,查询返回 60
cardAttr string - 卡属性 DEBIT_CARD(借记卡);CREDIT_CARD(贷记卡)
mCardAmt string - 支付宝渠道支卡通最终核销金额
totalPromotionAmt number - 优惠金额(合计) 0
orderPromotionStatus number - 优惠状态 0:订单无优惠 1:订单有优惠但未找到 2:订单有优惠且找到 0
promotionList object 优惠活动活动列表
   chnlName string - 渠道方 ACP:银联 UMS:银联商务 ALIPAY:支付宝 WXPAY:微信
   promotionId string 50 优惠流水ID
   eventNo string 50 活动编号
   eventName string 64 活动名称
   promotionRange string - 优惠范围 GLOBAL –全场代金券 SINGLE -单品优惠
   promotionType string - 优惠类型 微信: COUPON - 代金券 DISCOUNT - 优惠券 支付宝: ALIPAY_FIX_VOUCHER - 全场代金券 ALIPAY_DISCOUNT_VOUCHER - 折扣券 ALIPAY_ITEM_VOUCHER - 单品优惠 DISCOUNT 银联: couponInfo[0].type DD01随机立减 CP01事后赠予券 CP02事前领取券
   eventPromotionAmt number 15 活动优惠金额 0
   platPromotionAmt number 15 平台优惠金额 0
   mchntPromotionAmt number 15 商户优惠金额 0
   thirdPartyPromotionAmt number 15 第三方优惠金额 0
   thirdPartyPromotionDetail string - 第三方出资详情
   goodsList object 单品列表
      goodsId string 50 商品编号
      promotionAmt number 15 单品优惠金额 0
      goodsNum number 15 商品数量 0
      goodsPrice number - 商品价格 0
      goodsRemark string - 商品备注
oriPromotionList object - 渠道和收单机构侧原始优惠信息列表 支付渠道侧信息chnlInfo: chnlCode:支付渠道名称(ACP/ALIPAY/WXPAY) wxpayPromotionDetail:微信优惠详情(base64编码) alipayPromotionDetail:支付宝活动优惠详情(base64编码) alipayGoodsPromotionDetail:支付宝单品优惠详情(base64编码) cupPromotionDetail:银联活动优惠详情(base64编码) cupGoodsPromotionDetail:银联活单品优惠详情(base64编码) 收单机构侧信息acqInfo: acqCode:收单机构名称(UMS) promotionDetail:优惠详情(base64编码)

错误码