银联商务天满服务平台
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/preauthed";
        //开发者ID
        String appId = "平台分配";
        //开发者秘钥
        String appKey = "平台分配";
        //实例化客户端
        ConfigBean configBean = new ConfigBean();
        OpenApiContext context = new OpenApiContext();
        String request = "{\"reqTs\":\"2023-08-03 09:50:36\",
                    \"mchntOrderId\":\"1017202308030947148248612792\",
                    \"preauthOrderId\":\"101720230803094714824861279211\",
                    \"authIdRespCode\":\"384822\",
                    \"bizType\":\"QRPAYDEFAULT\",
                    \"mchntNo\":\"898201612345678\",
                    \"termNo\":\"88880001\",
                    \"totalAmt\":\"1\",
                    \"msgId\":\"001\",
                    \"srcReserve\":\"webpay\",
                    \"orderDesc\":\"测试\"}";
        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/preauthed";
        $data = json_encode(array("reqTs"=>"2023-08-03 09=>50=>36",
                    "mchntOrderId"=>"1017202308030947148248612792",
                    "preauthOrderId"=>"101720230803094714824861279211",
                    "authIdRespCode"=>"384822",
                    "bizType"=>"QRPAYDEFAULT",
                    "mchntNo"=>"898201612345678",
                    "termNo"=>"88880001",
                    "totalAmt"=>"1",
                    "msgId"=>"001",
                    "srcReserve"=>"webpay",
                    "orderDesc"=>"测试"));
        $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/preauthed"

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({\"reqTs\":\"2023-08-03 09:50:36\",
                    \"mchntOrderId\":\"1017202308030947148248612792\",
                    \"preauthOrderId\":\"101720230803094714824861279211\",
                    \"authIdRespCode\":\"384822\",
                    \"bizType\":\"QRPAYDEFAULT\",
                    \"mchntNo\":\"898201612345678\",
                    \"termNo\":\"88880001\",
                    \"totalAmt\":\"1\",
                    \"msgId\":\"001\",
                    \"srcReserve\":\"webpay\",
                    \"orderDesc\":\"测试\"})
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/preauthed
  • 测试环境: POST https://test-api-open.chinaums.com/v1/netpay/preauthed

描述:商户上送授权标识应答码,银商订单号完成预授权交易。

ContentType:HTTP(S) + JSON

请求头

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

请求参数

名称 类型 必填 最大长度 描述 示例值
reqTs string 报文请求时间 格式yyyy-MM-dd HH:mm:ss 2023-08-03 09:50:36
mchntOrderId string 6..32 商户订单号 1017202308030947148248612792
preauthOrderId string 6..32 预授权原始订单号 原预授权订单商户号 101720230803094714824861279211
authIdRespCode string 6..255 授权标识应答码 384822
bizType string 8..32 业务类型 同预授权订单 QRPAYDEFAULT
mchntNo string 8..32 商户号 898201612345678
termNo string 2..32 终端号 88880001
totalAmt number 1..100000000 要完成的金额 1
msgId string <=64 消息ID 原样返回 001
srcReserve string <=255 请求系统预留字段 webpay
orderDesc string <=255 订单说明 测试

响应示例

{
  "errCode":"SUCCESS",
  "errMsg":"预授权完成",
  "respTs":"2023-08-03 09:48:24",
  "mchntNo":"898201612345678",
  "termNo":"88880001",
  "msgId":"001",
  "srcReserve":"webpay",
  "bizType":"QRPAYDEFAULT",
  "addiData":"",
  "platSsn":"01254701208N",
  "stlId":"01254701208N",
  "refId":"01254701208N",
  "status":"TRADE_SUCCESS",
  "secureStatus":"AUTHED",
  "totalAmt":"1",
  "mchntName":"测试商户",
  "mchntOrderId":"101720230803094714824861279211",
  "targetOrderId":"26230803352748175832",
  "targetSys":"ACP",
  "targetStatus":"",
  "buyerId":"",
  "payMchntNo":"",
  "usrCardNo":"",
  "bankInfo":"",
  "targetList":"",
  "targetListDesc":"现金支付0.01元",
  "payAmt":"1",
  "buyerUsrname":"测试用户",
  "couponAmt":"0",
  "invoiceAmt":"1",
  "payTs":"2023-08-03 09:48:23",
  "stlDate":"2023-08-03",
  "subBuyerId":""
}

响应参数

名称 类型 必填 最大长度 描述 示例值
errCode string 错误代码
平台错误码
业务错误码
SUCCESS
errMsg string 错误信息 预授权完成
respTs string 报文响应时间 格式yyyy-MM-dd HH:mm:ss 2023-08-03 09:48:24
mchntNo string 商户号 898201612345678
termNo string 终端号 88880001
msgId string <=64 消息ID 原样返回 001
srcReserve string <=255 请求系统预留字段 webpay
bizType string 业务类型 QRPAYDEFAULT
addiData string 附加数据
platSsn string 平台流水号,类似检索参考号 01254701208N
stlId string 清分ID 如果来源方传了bankRefId就等于bankRefId,否则等于seqId 01254701208N
refId string 检索参考号,用在银联体系交易中 01254701208N
status string 交易状态 TRADE_SUCCESS
secureStatus string 担保交易状态 AUTHED
totalAmt number 支付总金额 1
mchntName string 商户名称 测试商户
mchntOrderId string 商户订单号 101720230803094714824861279211
targetOrderId string 第三方订单号 26230803352748175832
targetSys string 目标平台代码 ACP
targetStatus string 目标平台状态
buyerId string 买家ID
payMchntNo string 支付渠道商户号
usrCardNo string 银行卡号,如果有的话
bankInfo string 银行信息
targetList string 支付渠道列表
targetListDesc string 支付渠道描述 现金支付0.01元
payAmt number 买家付款的金额,支付宝会有 1
buyerUsrname string 买家用户名 测试用户
couponAmt number 渠道优惠金额 0
invoiceAmt number 交易中可给用户开具发票的金额 1
payTs string 支付时间 格式yyyy-MM-dd HH:mm:ss 2023-08-03 09:48:23
stlDate string 结算日期 格式yyyy-MM-dd 2023-08-03
subBuyerId string 子买家ID,比如微信的subOpenId

错误码