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\":\"\",
\"mid\":\"\",
\"tid\":\"\",
\"merOrderId\":\"\",
\"srcReserve\":\"\",
\"msgId\":\"\",
\"systemId\":\"\"}";
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"=>"",
"mid"=>"",
"tid"=>"",
"merOrderId"=>"",
"srcReserve"=>"",
"msgId"=>"",
"systemId"=>""));
$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\":\"\",
\"mid\":\"\",
\"tid\":\"\",
\"merOrderId\":\"\",
\"srcReserve\":\"\",
\"msgId\":\"\",
\"systemId\":\"\"})
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)
请求头
名称 | 必填 | 描述 | 示例值 |
---|---|---|---|
Authorization | 是 | 认证内容(认证参考天满开发者中心->接入指引->平台认证方式:开发者中心 ) |
请求参数
名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|
requestTimestamp | string | 是 | 19 | 报文请求时间 格式yyyy-MM-dd HH:mm:ss | |
mid | string | 是 | 8..32 | 商户号 | |
tid | string | 是 | 2..32 | 终端号 | |
merOrderId | string | 是 | 6..32 | 商户订单号 交易过期时间,为空则使用系统默认过期时间(30分钟),格式yyyy-MM-dd HH:mm:ss | |
srcReserve | string | 否 | ⇐255 | 请求系统预留字段 | |
msgId | string | 否 | ⇐64 | 消息ID | |
systemId | string | 否 | ⇐32 | 系统ID |
响应示例
{
"errCode":"",
"errMsg":"",
"mid":"",
"tid":"",
"totalAmount":0,
"merOrderId":"",
"msgId":"",
"merName":"",
"connectSys":"",
"bankCardNo":"",
"bankInfo":"",
"status":"",
"seqId":"",
"settleRefId":"",
"settleDate":"",
"invoiceAmount":0,
"couponAmount":0,
"buyerPayAmount":0,
"targetMid":"",
"billFunds":"",
"billFundsDesc":"",
"attachedData":"",
"targetOrderId":"",
"payTime":"",
"srcReserve":"",
"instMid":"",
"buyerId":"",
"subBuyerId":"",
"targetStatus":"",
"targetSys":"",
"cardAttr":"",
"totalPromotionAmt":0,
"orderPromotionStatus":0,
"promotionList":
[
],
"oriPromotionList":
[
]
}
响应参数
名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|
errCode | string | 是 | <=64 | 错误代码 平台错误码 业务错误码 |
|
errMsg | string | 否 | <=255 | 错误信息 | |
mid | string | 是 | 8..32 | 银商商户号 | |
tid | string | 是 | 2..32 | 终端号 | |
totalAmount | number | 是 | 1..1000000 | 支付总金额 | |
merOrderId | string | 是 | 6..32 | 商户订单号 | |
msgId | string | 否 | ⇐64 | 消息ID,原样返回 | |
merName | string | 否 | - | 商户名称 | |
connectSys | string | 否 | - | 链接系统 | |
bankCardNo | string | 否 | - | 银行卡号 | |
bankInfo | string | 否 | - | 银行信息 | |
status | string | 否 | - | 交易状态 | |
seqId | string | 否 | - | 平台流水号 | |
settleRefId | string | 否 | - | 清分ID 如果来源方传了bankRefId就等于bankRefId,否则等于seqId | |
settleDate | string | 否 | - | 结算日期 格式yyyy-MM-dd | |
invoiceAmount | number | 否 | 1..1000000 | 交易中可给用户开具发票的金额 | |
couponAmount | number | 否 | 1..1000000 | 优惠金额 | |
buyerPayAmount | number | 否 | 1..1000000 | 实付金额 | |
targetMid | string | 否 | - | 支付渠道商户号 各渠道情况不同,酌情转换。 | |
billFunds | string | 否 | - | 支付渠道列表 | |
billFundsDesc | string | 否 | - | 支付渠道描述 | |
attachedData | string | 否 | ⇐128 | 商户附加数据 | |
targetOrderId | string | 否 | - | 第三方订单号 | |
payTime | string | 否 | - | 支付时间 格式yyyy-MM-dd HH:mm:ss | |
srcReserve | string | 否 | ⇐255 | 请求系统预留字段 | |
instMid | string | 否 | 8..32 | 业务类型 | |
buyerId | string | 否 | - | 买家ID | |
subBuyerId | string | 否 | - | 子买家ID | |
targetStatus | string | 否 | - | 目标平台状态 | |
targetSys | string | 否 | - | 目标平台代码 | |
cardAttr | string | 否 | - | 借贷记卡信息 DEBIT_CARD(借记卡);CREDIT_CARD(贷记卡) | |
totalPromotionAmt | number | 否 | - | 优惠金额(合计) | |
orderPromotionStatus | number | 否 | - | 优惠状态 | |
promotionList | array |
否 | 优惠活动活动列表 | ||
chnlName | string | 是 | - | 渠道方 | |
promotionId | string | 是 | - | 优惠流水ID | |
eventPromotionAmt | number | 是 | - | 活动优惠金额 | |
platPromotionAmt | number | 是 | - | 平台优惠金额 | |
mchntPromotionAmt | number | 是 | - | 商户优惠金额 | |
thirdPartyPromotionAmt | number | 是 | - | 第三方优惠金额 | |
eventNo | string | 否 | - | 活动编号 | |
eventName | string | 否 | - | 活动名称 | |
promotionRange | string | 否 | - | 优惠范围 | |
promotionType | string | 否 | - | 优惠类型 | |
thirdPartyPromotionDetail | string | 否 | - | 第三方出资详情 | |
goodsList | array |
否 | 单品列表 | ||
goodsId | string | 是 | - | 商品编号 | |
promotionAmt | number | 是 | - | 单品优惠金额 | |
goodsNum | number | 是 | - | 商品数量 | |
goodsPrice | number | 否 | - | 商品价格 | |
goodsRemark | string | 否 | - | 商品备注 | |
oriPromotionList | array |
否 | - | 渠道和收单机构侧原始优惠信息列表 |