银联商务天满服务平台
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 = "/v6/poslink/transaction/query";
        //开发者ID
        String appId = "平台分配";
        //开发者秘钥
        String appKey = "平台分配";
        //实例化客户端
        ConfigBean configBean = new ConfigBean();
        OpenApiContext context = new OpenApiContext();
        String request = "{\"merchantCode\":\"898340149000005\",
                    \"terminalCode\":\"00000001\",
                    \"systemTraceNum\":\"123456\",
                    \"merchantOrderId\":\"M23005480004202307190084742\",
                    \"originalOrderId\":\"M23005480004202307190084742\",
                    \"oriTransDate\":\"20230719\"}";
        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 = "/v6/poslink/transaction/query";
        $data = json_encode(array("merchantCode"=>"898340149000005",
                    "terminalCode"=>"00000001",
                    "systemTraceNum"=>"123456",
                    "merchantOrderId"=>"M23005480004202307190084742",
                    "originalOrderId"=>"M23005480004202307190084742",
                    "oriTransDate"=>"20230719"));
        $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 = "/v6/poslink/transaction/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({\"merchantCode\":\"898340149000005\",
                    \"terminalCode\":\"00000001\",
                    \"systemTraceNum\":\"123456\",
                    \"merchantOrderId\":\"M23005480004202307190084742\",
                    \"originalOrderId\":\"M23005480004202307190084742\",
                    \"oriTransDate\":\"20230719\"})
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-wh.open.chinaums.com/v6/poslink/transaction/query
  • 测试环境: POST https://test-api-open.chinaums.com/v6/poslink/transaction/query

描述:进行POS通交易状态查询操作

ContentType:application/json

请求头

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

请求参数

名称 类型 必填 最大长度 描述 示例值
merchantCode string 15 商户号 898340149000005
terminalCode string 8 终端号 00000001
systemTraceNum string 6 系统跟踪号 6位数字 123456
merchantOrderId string 50 商户订单号 商户订单号与银商订单号至少存在一个,如均存在,以商户订单号为准,忽略银商订单号 M23005480004202307190084742
originalOrderId string 50 银商订单号 必须与原支付交易返回的订单号一致 M23005480004202307190084742
oriTransDate string 8 原交易日期 格式:YYYYMMDD 20230719

响应示例

{
  "errCode":"00",
  "errInfo":"10000成功响应码",
  "orderStatus":"TRADE_CLOSED",
  "orderCloseTime":"2023-07-19 11:01:49",
  "bankCardNo":"",
  "balanceAmtEnc":"",
  "queryFlag":"",
  "originalTransactionTime":"20230719110103",
  "originalSettlementDate":"20230719",
  "queryResCode":"",
  "queryResDesc":"",
  "originalPayCode":"134001101916293962",
  "originalBatchNo":"000001",
  "originalSystemTraceNum":"006380",
  "origialRetrievalRefNum":"29180946754W",
  "originalTransactionAmount":"17153",
  "merchantOrderId":"10002002270975826198816099",
  "orderId":"10002002270975826198816099",
  "refundedAmount":"15",
  "actualTransactionAmount":"15",
  "amount":"15",
  "marketingAllianceDiscountInstruction":"",
  "thirdPartyDiscountInstruction":"",
  "thirdPartyName":"",
  "thirdPartyBuyerId":"",
  "thirdPartyBuyerUserName":"",
  "thirdPartyOrderId":"",
  "thirdPartyPayInformation":"",
  "totalDiscountAmount":0,
  "discountStatus":0,
  "promotionList":
  [
    {
      "channelName":"",
      "discountId":"",
      "eventNo":"",
      "eventName":"",
      "discountScope":"",
      "discountType":"",
      "eventDiscountAmount":"5",
      "platformDiscountAmount":"5",
      "merchantDiscountAmount":"5",
      "thirdPartyDiscountAmount":"5",
      "thirdPartyDiscountDetail":"",
      "goodsList":
      [
        {
          "goodsId":"001",
          "discountAmount":"5",
          "goodsNumber":"10",
          "goodsPrice":"10",
          "goodsRemark":"test"
        } 
      ] 
    } 
  ],
  "rawPromotionList":
  {

  },
  "merchantAllowance":"10",
  "thirdPartyAllowance":"10",
  "thirdPartyPointDiscountAmount":"10",
  "mchntName":"测试商户",
  "convMchntNo":"103290070111417",
  "convTermNo":"12340511",
  "chnlType":"",
  "promotionAmt":"",
  "acqInstCode":"",
  "issInstCode":"",
  "acctAmt":"",
  "mCardAmt":""
}

响应参数

名称 类型 必填 最大长度 描述 示例值
errCode string -
平台错误码
业务错误码
00
errInfo string - 错误说明 10000成功响应码
orderStatus string - 订单状态 TRADE_CLOSED、TRADE_SUCCESS、TRADE_REFUND、WAIT_BUYER_PAY、NEW_ORDER、UNKNOWN TRADE_CLOSED
orderCloseTime string - 订单关闭时间 格式:yyyy-MM-dd HH:mm:ss 2023-07-19 11:01:49
bankCardNo string - 脱敏后的银行卡号,目前仅云闪付返回
balanceAmtEnc string - 数币IC余额 余额(密文),仅数字货币IC卡交易返回
queryFlag string - 查询标志 “Y”表示:订单状态未知,需要终端发起自动查询
originalTransactionTime string - 原始交易时间 格式:YYYYMMDDHHmmSS 20230719110103
originalSettlementDate string - 原始交易清算日期 格式:yyyyMMdd 20230719
queryResCode string - 查询结果
0:成功
1:超时
2:已撤销
3:已退货
4:已冲正
5:失败(失败情况,后面追加失败描述)
FF:交易状态未知
queryResDesc string - 查询结果描述 最大长度32位
originalPayCode string - 原交易付款码 最大长度12位 134001101916293962
originalBatchNo string - 原交易批次号 最大长度6位 000001
originalSystemTraceNum string - 原交易流水号 最大长度6位 006380
origialRetrievalRefNum string - 原检索参考号 最大长度12位 29180946754W
originalTransactionAmount number - 原交易金额 最大长度12位,单位:分 17153
merchantOrderId string - 商户订单号 最大长度50位 10002002270975826198816099
orderId string - 银商订单号 最大长度26位 10002002270975826198816099
refundedAmount number - 已退货金额 退货交易的已退货金额,单位:分 15
actualTransactionAmount number - 营销联盟优惠后交易金额 最大长度12位,单位:分 15
amount number - 实际支付金额 用户实际支付金额,最大长度12位,单位:分 15
marketingAllianceDiscountInstruction string - 交易营销联盟优惠说明 最大长度200位
thirdPartyDiscountInstruction string - 第三方优惠说明 最大长度200位
thirdPartyName string - 第三方名称 最大长度60位
thirdPartyBuyerId string - 第三方买家Id 最大长度32位
thirdPartyBuyerUserName string - 第三方买家用户名
thirdPartyOrderId string - 第三方订单号
thirdPartyPayInformation string - 第三方支付信息 格式为:方式:金额(单位:分)
totalDiscountAmount number - 优惠金额(合计) ,单位:分
discountStatus number - 优惠状态
1:订单有优惠但未找到
2:订单有优惠且找到
promotionList array 优惠活动活动列表 单品营销优惠活动列表
   channelName string - 渠道方
ACP:银联
UMS:银联商务
ALIPAY:支付宝
WXPAY:微信
   discountId string - 优惠流水ID 最大长度50位
   eventNo string - 活动编号 最大长度50位
   eventName string - 活动名称 最大长度64位
   discountScope string - 优惠范围
GLOBAL –全场代金券
SINGLE -单品优惠
   discountType string - 优惠类型
微信:
COUPON - 代金券
DISCOUNT - 优惠券
支付宝:
ALIPAY_FIX_VOUCHER - 全场代金券
ALIPAY_DISCOUNT_VOUCHER - 折扣券
ALIPAY_ITEM_VOUCHER - 单品优惠
   eventDiscountAmount number - 活动优惠金额 最大长度15位,单位:分 5
   platformDiscountAmount number - 平台优惠金额 最大长度15位,单位:分 5
   merchantDiscountAmount number - 商户优惠金额 最大长度15位,单位:分 5
   thirdPartyDiscountAmount number - 第三方优惠金额 最大长度15位,单位:分 5
   thirdPartyDiscountDetail string - 第三方出资详情
   goodsList array 单品列表
      goodsId string - 商品编号 最大长度50位 001
      discountAmount number - 单品优惠金额 最大长度15位,单位:分 5
      goodsNumber number - 商品数量 最大长度15位,为非0整数 10
      goodsPrice number - 商品价格 单位:分 10
      goodsRemark string - 商品备注 test
rawPromotionList object - 渠道和收单机构侧原始优惠信息列表
支付渠道侧信息channel_info:
channel_code:支付渠道名称(ACP/ALIPAY/WXPAY)
promotion_detail:微信优惠详情
voucher_detail_list:支付宝活动优惠详情
discount_goods_detail:支付宝单品优惠详情
coupon_info:银联活动优惠详情
dct_goods_info:银联活单品优惠详情
收单机构侧信息acq_info:
acq_code:收单机构名称(UMS)
coupon_list:优惠详情
merchantAllowance number - 商户让利金额 单位:分 10
thirdPartyAllowance number - 第三方补贴金额 ,单位:分 10
thirdPartyPointDiscountAmount number - 积分抵扣金额 ,单位:分 10
mchntName string - 商户名称 测试商户
convMchntNo string - 转商户商户号 103290070111417
convTermNo string - 转终端终端号 12340511
chnlType string - 目标渠道类型 目前仅数字货币二维码返回DCEP
promotionAmt string - 优惠金额 单位为分,目前仅数字货币二维码返回
acqInstCode string - 受理银行机构代码 详见返回码说明,目前仅数字货币二维码返回
issInstCode string - 发卡行代码 详见返回码说明,目前仅数字货币二维码返回
acctAmt string - 青岛医保预付卡余额
mCardAmt string - 支卡通最终核销金额 支付宝渠道

错误码