银联商务天满服务平台
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/refund";
        //开发者ID
        String appId = "平台分配";
        //开发者秘钥
        String appKey = "平台分配";
        //实例化客户端
        ConfigBean configBean = new ConfigBean();
        OpenApiContext context = new OpenApiContext();
        String request = "{\"requestTimestamp\":\"\",
                    \"merOrderId\":\"\",
                    \"refundAmount\":\"\",
                    \"mid\":\"\",
                    \"tid\":\"\",
                    \"msgId\":\"\",
                    \"srcReserve\":\"\",
                    \"refundDesc\":\"\",
                    \"refundOrderId\":\"\",
                    \"systemId\":\"\",
                    \"ylyxId\":\"\",
                    \"ylyxName\":\"\",
                    \"ylyxMerAbbr\":\"\"}";
        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/refund";
        $data = json_encode(array("requestTimestamp"=>"",
                    "merOrderId"=>"",
                    "refundAmount"=>"",
                    "mid"=>"",
                    "tid"=>"",
                    "msgId"=>"",
                    "srcReserve"=>"",
                    "refundDesc"=>"",
                    "refundOrderId"=>"",
                    "systemId"=>"",
                    "ylyxId"=>"",
                    "ylyxName"=>"",
                    "ylyxMerAbbr"=>""));
        $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/refund"

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\":\"\",
                    \"merOrderId\":\"\",
                    \"refundAmount\":\"\",
                    \"mid\":\"\",
                    \"tid\":\"\",
                    \"msgId\":\"\",
                    \"srcReserve\":\"\",
                    \"refundDesc\":\"\",
                    \"refundOrderId\":\"\",
                    \"systemId\":\"\",
                    \"ylyxId\":\"\",
                    \"ylyxName\":\"\",
                    \"ylyxMerAbbr\":\"\"})
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/refund
  • 测试环境: POST https://test-api-open.chinaums.com/v1/netpay/refund

描述:申请退款

ContentType:HTTP(S) + JSON

请求头

名称 必填 描述 示例值
Authorization 认证内容(认证参考天满开发者中心->接入指引->平台认证方式:开发者中心

请求参数

名称 类型 必填 最大长度 描述 示例值
requestTimestamp string 报文请求时间 格式yyyy-MM-dd HH:mm:ss
merOrderId string 6..32 商户订单号
refundAmount number 1..1000000 要退款的金额,单位分
mid string 15 商户号
tid string 8 终端号
msgId string <=64 消息ID 原样返回
srcReserve string <=255 请求系统预留字段
refundDesc string ⇐255 退货说明
refundOrderId string 6..64 退货交易的订单号 如不指定,则系统自动生成
systemId string ⇐32 系统ID
ylyxId string 5-15 银联营销代码
ylyxName string 40 银联营销名称
ylyxMerAbbr string 16 银联营销二级子商户简称

响应示例

{
  "errCode":"",
  "errMsg":"",
  "responseTimeStamp":"",
  "mid":"",
  "tid":"",
  "merOrderId":"",
  "msgId":"",
  "merName":"",
  "srcReserve":"",
  "settleDate":"",
  "seqId":"",
  "status":"",
  "settleRefId":"",
  "bankInfo":"",
  "refundStatus":"",
  "targetMid":"",
  "targetOrderId":"",
  "targetStatus":"",
  "targetSys":"",
  "totalAmount":0,
  "refundAmount":0,
  "refundFunds":"",
  "refundFundsDesc":"",
  "refundOrderId":"",
  "refundTargetOrderId":""
}

响应参数

名称 类型 必填 最大长度 描述 示例值
errCode string 错误代码
平台错误码
业务错误码
errMsg string 错误信息
responseTimeStamp Date 报文应答时间 格式yyyy-MM-dd HH:mm:ss
mid string 8..32 银商商户号
tid string 2..32 终端号
merOrderId string 6..32 商户订单号
msgId string <=64 消息ID,原样返回
merName string - 商户名称
srcReserve string ⇐255 请求系统预留字段
settleDate string - 结算日期 格式yyyy-MM-dd
seqId string - 平台流水号
status string - 交易状态
settleRefId string - 清分ID
bankInfo string - 银行信息
refundStatus string - 退款状态
targetMid string - 支付渠道商户号 各渠道情况不同,酌情转换。
targetOrderId string - 第三方订单号 退货交易时不返回
targetStatus string - 目标平台状态
targetSys string - 目标平台代码
totalAmount number - 支付总金额
refundAmount number - 总退款金额
refundFunds string - 退款渠道列表
refundFundsDesc string - 退款渠道描述
refundOrderId string 6..64 退货交易的订单号
refundTargetOrderId string - 目标系统退货订单号

错误码