签名算法
签名生成的通用步骤如下:
  1. 设所有发送或者接收到的数据为集合M,将集合M内非空参数值的参数按照参数名ASCII码从小到大排序(字典序),使用URL键值对的格式(即key1=value1&key2=value2…)拼接成字符串stringA。
  2. 在stringA最后拼接上 &key=密钥 得到stringSignTemp字符串,并对stringSignTemp进行MD5运算,再将得到的字符串所有字符转换为大写,得到sign值。

注意:只有必填参数才参与签名!!!

注意:只有必填参数才参与签名!!!

注意:只有必填参数才参与签名!!!

温馨提示:蓝兔支付签名算法与微信支付V2签名算法一致,签名校验工具 >>点击此处

JS示例代码:
function wxPaySign(params, key) {
    const paramsArr = Object.keys(params);
    paramsArr.sort();
    const stringArr = [];
    paramsArr.map(key => {
        stringArr.push(key + '=' + params[key]);
    });
    // 最后加上商户Key
    stringArr.push("key=" + key);
    const string = stringArr.join('&');
    return md5(string).toString().toUpperCase();
}
PHP示例代码:
function sign(array $data, $key) {
    ksort($data);
    $sign = strtoupper(md5(urldecode(http_build_query($data)) . '&key=' . $key));
    return $sign;
}
JAVA示例代码:
public static String packageSign(Map < String, String > params, boolean urlEncoder) {
    // 先将参数以其参数名的字典序升序进行排序
    TreeMap < String, String > sortedParams = new TreeMap < String, String > (params);
    // 遍历排序后的字典,将所有参数按"key=value"格式拼接在一起
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (Entry < String, String > param: sortedParams.entrySet()) {
        String value = param.getValue();
        if (StrKit.isBlank(value)) {
            continue;
        }
        if (first) {
            first = false;
        } else {
            sb.append("&");
        }
        sb.append(param.getKey()).append("=");
        if (urlEncoder) {
            try {
                value = urlEncode(value);
            } catch (UnsupportedEncodingException e) {}
        }
        sb.append(value);
    }
    return sb.toString();
}

public static String urlEncode(String src) throws UnsupportedEncodingException {
    return URLEncoder.encode(src, Charsets.UTF_8.name()).replace("+", "%20");
}

public static String createSign(Map < String, String > params, String partnerKey) {
    // 生成签名前先去除sign
    params.remove("sign");
    String stringA = packageSign(params, false);
    String stringSignTemp = stringA + "&key=" + partnerKey;
    return md5(stringSignTemp).toUpperCase();
}
支付通知API
蓝兔支付通过支付通知接口将用户支付成功消息通知给商户

注意:

  • 同样的通知可能会多次发送给商户系统。商户系统必须能够正确处理重复的通知。 推荐的做法是,当商户系统收到通知进行处理时,先检查对应业务数据的状态,并判断该通知是否已经处理。如果未处理,则再进行处理;如果已处理,则直接返回结果成功。在对业务数据进行状态检查和处理之前,要采用数据锁进行并发控制,以避免函数重入造成的数据混乱。
  • 如果在所有通知频率后没有收到蓝兔支付侧回调,商户应调用查询订单接口确认订单状态。

特别提醒:商户系统对于开启结果通知的内容一定要做签名验证,并校验通知的信息是否与商户侧的信息一致,防止数据泄露导致出现“假通知”,造成资金损失。


接口说明

适用对象:个人、个体户、企业

请求方式:POST

回调URL:该链接是通过支付接口中的请求参数“notify_url”来设置的,要求必须为http或https地址。请确保回调URL是外部可正常访问的,且不能携带后缀参数,否则可能导致商户无法接收到蓝兔支付的回调通知信息。回调URL示例:“https://pay.weixin.qq.com/wxpay/pay.action”

通知规则

用户支付完成后,蓝兔支付会把相关支付结果和用户信息发送给商户,商户需要接收处理该消息,并返回应答。

对后台通知交互时,如果蓝兔支付收到商户的应答不符合规范或超时,蓝兔支付认为通知失败,蓝兔支付会通过一定的策略定期重新发起通知,尽可能提高通知的成功率,但蓝兔支付不保证通知最终能成功。(通知频率为15s/15s/30s/3m/10m/20m/30m/30m/30m/60m/3h/3h/3h/6h/6h - 总计 24h4m)

通知参数
参数名 参数类型 是否参与签名 描述
code String 支付结果,枚举值:
0:成功
1:失败
示例值:0
timestamp String 时间戳
示例值:1669518774
mch_id String 商户号
示例值:1230000109
order_no String 系统订单号
示例值:WX202211221155084844072633
out_trade_no String 商户订单号
示例值:LTZF2022112264463
pay_no String 支付宝或微信支付订单号
示例值:4200001635202211222291508463
total_fee String 支付金额
示例值:0.01
sign String 签名,签名验证的算法请参考
示例值:575225E549B2FBB82FB23505263633CD
pay_channel String 支付渠道,枚举值:
alipay:支付宝
wxpay:微信支付
示例值:wxpay
trade_type String 支付类型,枚举值:
NATIVE:扫码支付
H5:H5支付
APP:APP支付
JSAPI:公众号支付
MINIPROGRAM:小程序支付
示例值:NATIVE
success_time String 支付完成时间
示例值:2022-11-22 11:55:42
attach String 附加数据,在支付接口中填写的数据,可作为自定义参数使用。
示例值:自定义数据
openid String 支付者信息
示例值:o5wq46GAKVxVKpsdcI4aU4cBpgT0
通知应答

接收成功:HTTP应答状态码需返回200,同时应答报文需返回:SUCCESS必须为大写

接收失败:应答报文返回:FAIL

退款通知API
蓝兔支付通过退款通知接口将退款成功消息通知给商户

注意:

  • 同样的通知可能会多次发送给商户系统。商户系统必须能够正确处理重复的通知。 推荐的做法是,当商户系统收到通知进行处理时,先检查对应业务数据的状态,并判断该通知是否已经处理。如果未处理,则再进行处理;如果已处理,则直接返回结果成功。在对业务数据进行状态检查和处理之前,要采用数据锁进行并发控制,以避免函数重入造成的数据混乱。
  • 如果在所有通知频率后没有收到蓝兔支付侧回调,商户应调用查询退款结果接口确认退款状态。

特别提醒:商户系统对于开启结果通知的内容一定要做签名验证,并校验通知的信息是否与商户侧的信息一致,防止数据泄露导致出现“假通知”,造成资金损失。


接口说明

适用对象:个人、个体户、企业

请求方式:POST

回调URL:该链接是通过订单退款接口中的请求参数“notify_url”来设置的,要求必须为http或https地址。请确保回调URL是外部可正常访问的,且不能携带后缀参数,否则可能导致商户无法接收到蓝兔支付的回调通知信息。回调URL示例:“https://pay.weixin.qq.com/wxpay/pay.action”

通知规则

退款完成后,蓝兔支付会把相关退款结果发送给商户,商户需要接收处理该消息,并返回应答。

对后台通知交互时,如果蓝兔支付收到商户的应答不符合规范或超时,蓝兔支付认为通知失败,蓝兔支付会通过一定的策略定期重新发起通知,尽可能提高通知的成功率,但蓝兔支付不保证通知最终能成功。(通知频率为15s/15s/30s/3m/10m/20m/30m/30m/30m/60m/3h/3h/3h/6h/6h - 总计 24h4m)

通知参数
参数名 参数类型 是否参与签名 描述
code String 支付结果,枚举值:
0:成功
1:失败
示例值:0
timestamp String 时间戳
示例值:1669809319
mch_id String 商户号
示例值:1230000109
order_no String 系统订单号
示例值:WX202211301535506173701342
out_trade_no String 商户订单号
示例值:LTZF2022113023096
pay_no String 支付宝或微信支付订单号
示例值:4200001655202211302129710035
refund_no String 系统退款单号
示例值:T02022113054995451
out_refund_no String 商户退款单号
示例值:TK2022113058808
pay_channel String 退款渠道,枚举值:
alipay:支付宝
wxpay:微信支付
示例值:wxpay
refund_fee String 退款金额
示例值:0.01
sign String 签名,签名验证的算法请参考
示例值:2C44F0D59E54320C2A6D4E3EB9CA909F
success_time String 退款完成时间
示例值:2022-11-30 19:47:58
通知应答

接收成功:HTTP应答状态码需返回200,同时应答报文需返回:SUCCESS必须为大写

接收失败:应答报文返回:FAIL

扫码支付API
蓝兔支付后台系统返回二维码地址和微信原生的支付链接,商户可自行使用原生链接生成二维码图片,用户使用微信客户端扫码后发起支付。

注意:

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/native

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/native",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/native")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/native", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/native"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022113023096" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669533132" },
        { "notify_url", "https://www.weixin.qq.com/wxpay/pay.php" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/native"

	payload := strings.NewReader("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/native");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/native");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022113023096",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669533132",
  "notify_url": "https://www.weixin.qq.com/wxpay/pay.php",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/native"

payload <- "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.code_url String 微信原生支付链接,此URL用于生成支付二维码,然后提供给用户扫码支付。
示例值:weixin://wxpay/bizpayurl?pr=i8SfEeFzz
data.QRcode_url String 蓝兔支付生成的二维码链接地址
示例值:https://api.ltzf.cn/uploads/QRcode/wxpay/1667888007846.png
msg String 消息
示例值:微信Native下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:8fbbcb94-94f0-dcfa-3b25-892b45579b12

成功示例

{
    "code": 0, 
    "data": {
        "code_url": "weixin://wxpay/bizpayurl?pr=i8SfEeFzz", 
        "QRcode_url": "https://api.ltzf.cn/uploads/QRcode/wxpay/1667888007846.png"
    }, 
    "msg": "微信Native下单成功", 
    "request_id": "8fbbcb94-94f0-dcfa-3b25-892b45579b12"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:签名错误
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:d42ad311-989f-ba93-c8a6-f4520f6d8169

失败示例

{
    "code": 1, 
    "msg": "签名错误", 
    "request_id": "d42ad311-989f-ba93-c8a6-f4520f6d8169"
}
H5支付API
蓝兔支付后台系统返回微信原生的支付链接,用户使用微信外部的浏览器访问该链接地址调起微信支付中间页。

注意:

  • 如果域名备案主体和申请人不一致或者只在APP里面调用,达不到绑定H5支付域名的要求,请使用支付接口。
  • 此接口需联系在线客服绑定H5支付域名。H5支付域名要求:域名备案主体需与申请人一致,且可打开有实际业务内容,与真实使用业务内容一致。(本平台帮您提交到官方审核,微信支付人工审核时间为3 - 7个工作日)
  • 此接口返回的支付链接URL有效期为5分钟,请在5分钟内重定向到该地址。
  • 如果设置了回跳地址return_url,回跳地址的域名需与申请H5支付时提交的授权域名一致。
  • 如果是APP里调起H5支付,需要在webview中手动设置referer,如(Map extraHeaders = new HashMap();extraHeaders.put("Referer", "商户申请H5时提交的授权域名");//例如 https://pay.weixin.qq.com )

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/h5

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
return_url String 回跳地址,支付成功后或取消支付自动跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。
示例值:https://www.weixin.qq.com/
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/h5",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/h5")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/h5", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/h5"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022113023096" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669533132" },
        { "notify_url", "https://www.weixin.qq.com/wxpay/pay.php" },
        { "return_url", "https://www.weixin.qq.com/" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/h5"

	payload := strings.NewReader("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/h5");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/h5");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022113023096",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669533132",
  "notify_url": "https://www.weixin.qq.com/wxpay/pay.php",
  "return_url": "https://www.weixin.qq.com/",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/h5"

payload <- "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data String 微信原生支付跳转链接,URL为拉起微信支付收银台的中间页面,可通过访问该URL来拉起微信客户端,完成支付,URL的有效期为5分钟。
示例值:https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx091921364601964fd23b65ceb6c3400000&package=2473996775
msg String 消息
示例值:微信H5下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:98758a7c-daea-bc63-b725-52c8998d808c

成功示例

{
    "code": 0, 
    "data": "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx091921364601964fd23b65ceb6c3400000&package=2473996775", 
    "msg": "微信H5下单成功", 
    "request_id": "98758a7c-daea-bc63-b725-52c8998d808c"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:7b80b625-4320-9d63-26cc-00a400af9135

失败示例

{
    "code": 1, 
    "msg": "商户订单号重复", 
    "request_id": "7b80b625-4320-9d63-26cc-00a400af9135"
}
H5支付[跳转模式]API
蓝兔支付后台系统返回支付链接,用户使用微信外部的浏览器或app访问该链接地址唤起微信并调起微信支付中间页。

注意:

  • 此接口返回的支付链接URL有效期为5分钟,请在5分钟内重定向到该地址。
  • 如果设置了回跳地址return_url,回跳地址的域名需与白名单域名里面的一致。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/jump_h5

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
quit_url String 取消支付自动跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。(如果此参数未设置,将使用return_url的参数跳转)
示例值:https://www.weixin.qq.com/
return_url String 支付成功后自动跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。
示例值:https://www.weixin.qq.com/
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/jump_h5",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/jump_h5")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/jump_h5", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/jump_h5"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022113023096" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669533132" },
        { "notify_url", "https://www.weixin.qq.com/wxpay/pay.php" },
        { "return_url", "https://www.weixin.qq.com/" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/jump_h5"

	payload := strings.NewReader("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/jump_h5");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/jump_h5");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022113023096",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669533132",
  "notify_url": "https://www.weixin.qq.com/wxpay/pay.php",
  "return_url": "https://www.weixin.qq.com/",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/jump_h5"

payload <- "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data String 支付跳转链接,URL为拉起微信支付的中间页面,可通过访问该URL来拉起微信客户端,完成支付,URL的有效期为5分钟。
示例值:https://api.ltzf.cn/template/html/jump_h5?order_no=WX202305091807051373879911
msg String 消息
示例值:微信H5下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:98758a7c-daea-bc63-b725-52c8998d808c

成功示例

{
    "code": 0, 
    "data": "https://api.ltzf.cn/template/html/jump_h5?order_no=WX202305091807051373879911", 
    "msg": "微信H5下单成功", 
    "request_id": "98758a7c-daea-bc63-b725-52c8998d808c"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:7b80b625-4320-9d63-26cc-00a400af9135

失败示例

{
    "code": 1, 
    "msg": "商户订单号重复", 
    "request_id": "7b80b625-4320-9d63-26cc-00a400af9135"
}
H5支付[跳转模式]API
蓝兔支付后台系统返回支付链接,用户使用微信外部的浏览器或app访问该链接地址唤起微信并调起微信支付中间页。

注意:

  • 此接口返回的支付链接URL有效期为5分钟,请在5分钟内重定向到该地址。
  • 如果设置了回跳地址return_url,回跳地址的域名需与白名单域名里面的一致。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/miniprogram_h5

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
return_url String 回跳地址,支付成功后或取消支付自动跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。
示例值:https://www.weixin.qq.com/
type String 场景类型,枚举值:
h5:手机浏览器拉起支付
app:app拉起支付
不填写默认h5
示例值:h5
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
title String 蓝兔收银小程序页面顶部的标题,可自定义品牌名称,不传默认为“收银台”,如传递参数“蓝兔支付”,页面则显示“蓝兔支付-收银台”。
示例值:蓝兔支付
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/miniprogram_h5",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/miniprogram_h5")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/miniprogram_h5", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/miniprogram_h5"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022113023096" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669533132" },
        { "notify_url", "https://www.weixin.qq.com/wxpay/pay.php" },
        { "return_url", "https://www.weixin.qq.com/" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/miniprogram_h5"

	payload := strings.NewReader("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/miniprogram_h5");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/miniprogram_h5");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022113023096",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669533132",
  "notify_url": "https://www.weixin.qq.com/wxpay/pay.php",
  "return_url": "https://www.weixin.qq.com/",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/miniprogram_h5"

payload <- "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data String 支付跳转链接,URL为拉起微信支付的中间页面,可通过访问该URL来拉起微信客户端,完成支付,URL的有效期为5分钟。
示例值:https://api.ltzf.cn/template/html/miniprogram_h5?state=0427B234B52A0DEEB0F20811589F0B74
msg String 消息
示例值:微信H5下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:98758a7c-daea-bc63-b725-52c8998d808c

成功示例

{
    "code": 0, 
    "data": "https://api.ltzf.cn/template/html/miniprogram_h5?state=0427B234B52A0DEEB0F20811589F0B74", 
    "msg": "微信H5下单成功", 
    "request_id": "98758a7c-daea-bc63-b725-52c8998d808c"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:7b80b625-4320-9d63-26cc-00a400af9135

失败示例

{
    "code": 1, 
    "msg": "商户订单号重复", 
    "request_id": "7b80b625-4320-9d63-26cc-00a400af9135"
}
公众号支付API
蓝兔支付后台系统返回微信WeixinJSBridge内置对象所需的参数,然后使用微信支付提供的前端JS方法WeixinJSBridge.invoke调起公众号支付。

注意:

JSAPI支付接口请求步骤:

  1. 下单前需获取到用户的Openid,获取用户Openid请参考
  2. 通过此接口获取JSAPI支付参数。
  3. 通过WeixinJsBridge方式自行发起支付。

注意:WeixinJSBridge对象仅限微信内置浏览器,在其他浏览器中无效。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/jsapi

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
openid String 用户Openid,获取用户Openid请参考
示例值:o5wq46GAKVxVKpsdcI4aU4cBpgT0
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
return_url String 回跳地址,支付成功后用户点击【返回商户网站】跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。
示例值:https://www.weixin.qq.com/
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/jsapi",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&openid=o5wq46GAKVxVKpsdcI4aU4cBpgT0&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/jsapi")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&openid=o5wq46GAKVxVKpsdcI4aU4cBpgT0&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&openid=o5wq46GAKVxVKpsdcI4aU4cBpgT0&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/jsapi", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/jsapi"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022113023096" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "openid", "o5wq46GAKVxVKpsdcI4aU4cBpgT0" },
        { "timestamp", "1669533132" },
        { "notify_url", "https://www.weixin.qq.com/wxpay/pay.php" },
        { "return_url", "https://www.weixin.qq.com/" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/jsapi"

	payload := strings.NewReader("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&openid=o5wq46GAKVxVKpsdcI4aU4cBpgT0&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&openid=o5wq46GAKVxVKpsdcI4aU4cBpgT0&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/jsapi");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/jsapi");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022113023096",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "openid": "o5wq46GAKVxVKpsdcI4aU4cBpgT0",
  "timestamp": "1669533132",
  "notify_url": "https://www.weixin.qq.com/wxpay/pay.php",
  "return_url": "https://www.weixin.qq.com/",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/jsapi"

payload <- "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&openid=o5wq46GAKVxVKpsdcI4aU4cBpgT0&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.appId String 公众号appid
示例值:wxa3d61201263587a8
data.timeStamp String 时间戳
示例值:1669198554
data.nonceStr String 随机字符串
示例值:Gx3Emzknk3FVLsnMVXHkzGkrZSdOR1J4
data.package String 订单详情扩展字符串
示例值:prepay_id=wx2318155478659398d48bcd97f476de0000
data.signType String 签名方式
示例值:RSA
data.paySign String 签名
示例值:hALXAWJ1YocPsmVDNDG04Eru1LCUsqjIYLzWjZPlI3iUhFV7/Klr2CdFcGkvHfEsusHnW2oPyt4F79lH8O/zmQnnuXWIfpH2+H8KOtm+OYQ49Cme0kCkuUS1Vv64b7VKrDQIQUY8tL8+TZZ0XPcDdPnUQ0nVp0abzX9s8RB/VsVUoma/rX8ZT+YpyNkax/Sm3KGLdnpKETij+TSQk3CIPxE90/NICo+LLQkpPvJHc04AXX4uRKaGmab2FH4HpXOfZacQ9IKh1U5INWZqbIcDsIbnUwJd4/tGe03lb3HxZJa4xc16Iwj4PSp0DvWsY5IVPIGB2Mt41qUFjsGzTdXJng==
msg String 消息
示例值:jsapi支付参数构造完成,请通过jssdk或WeixinJsBridge方式自行发起支付
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:003c3d39-d1ce-c947-43e8-fe2ef3bb5e62

成功示例

{
    "code": 0, 
    "data": {
        "appId": "wxa3d61201263587a8", 
        "timeStamp": "1669198554", 
        "nonceStr": "Gx3Emzknk3FVLsnMVXHkzGkrZSdOR1J4", 
        "package": "prepay_id=wx2318155478659398d48bcd97f476de0000", 
        "signType": "RSA", 
        "paySign": "hALXAWJ1YocPsmVDNDG04Eru1LCUsqjIYLzWjZPlI3iUhFV7/Klr2CdFcGkvHfEsusHnW2oPyt4F79lH8O/zmQnnuXWIfpH2+H8KOtm+OYQ49Cme0kCkuUS1Vv64b7VKrDQIQUY8tL8+TZZ0XPcDdPnUQ0nVp0abzX9s8RB/VsVUoma/rX8ZT+YpyNkax/Sm3KGLdnpKETij+TSQk3CIPxE90/NICo+LLQkpPvJHc04AXX4uRKaGmab2FH4HpXOfZacQ9IKh1U5INWZqbIcDsIbnUwJd4/tGe03lb3HxZJa4xc16Iwj4PSp0DvWsY5IVPIGB2Mt41qUFjsGzTdXJng=="
    }, 
    "msg": "jsapi支付参数构造完成,请通过jssdk或WeixinJsBridge方式自行发起支付", 
    "request_id": "003c3d39-d1ce-c947-43e8-fe2ef3bb5e62"
}

前端发起支付演示代码

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>蓝兔支付-微信jsapi支付演示</title>
  </head>
  <body>
    <script>
      function onBridgeReady() {
        WeixinJSBridge.invoke(
          "getBrandWCPayRequest",
          {
            // 以下6个支付参数通过蓝兔支付的jsapi接口获取
            // **************************
            appId: "wxa3d61201263587a8", //公众号appid
            timeStamp: "1669198554", //时间戳
            nonceStr: "Gx3Emzknk3FVLsnMVXHkzGkrZSdOR1J4", //随机字符串
            package: "prepay_id=wx2318155478659398d48bcd97f476de0000", //订单详情扩展字符串
            signType: "RSA", //签名方式
            paySign: "hALXAWJ1YocPsmVDNDG04Eru1LCUsqjIYLzWjZPlI3iUhFV7/Klr2CdFcGkvHfEsusHnW2oPyt4F79lH8O/zmQnnuXWIfpH2+H8KOtm+OYQ49Cme0kCkuUS1Vv64b7VKrDQIQUY8tL8+TZZ0XPcDdPnUQ0nVp0abzX9s8RB/VsVUoma/rX8ZT+YpyNkax/Sm3KGLdnpKETij+TSQk3CIPxE90/NICo+LLQkpPvJHc04AXX4uRKaGmab2FH4HpXOfZacQ9IKh1U5INWZqbIcDsIbnUwJd4/tGe03lb3HxZJa4xc16Iwj4PSp0DvWsY5IVPIGB2Mt41qUFjsGzTdXJng==" //签名
            // **************************
          },
          function (res) {
            document.write('<p style="text-align:center;">返回的信息:' + JSON.stringify(res) + "</p>");
            // 支付成功
            if (res.err_msg == "get_brand_wcpay_request:ok") {
              // 使用以上方式判断前端返回,微信团队郑重提示:
              //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
            }
            // 支付过程中用户取消
            if (res.err_msg == "get_brand_wcpay_request:cancel") {
              //WeixinJSBridge.call('closeWindow');//关闭网页
            }
            // 支付失败
            if (res.err_msg == "get_brand_wcpay_request:fail") {
            }
            /**
             * 其它
             * 1、请检查预支付会话标识prepay_id是否已失效
             * 2、请求的appid与下单接口的appid是否一致
             * */
            if (res.err_msg == "调用支付JSAPI缺少参数:total_fee") {
            }
          }
        );
      }

      // 检测支付环境中的 WeixinJSBridge
      if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
          document.addEventListener(
            "WeixinJSBridgeReady",
            onBridgeReady,
            false
          );
        } else if (document.attachEvent) {
          document.attachEvent("WeixinJSBridgeReady", onBridgeReady);
          document.attachEvent("onWeixinJSBridgeReady", onBridgeReady);
        }
      } else {
        onBridgeReady();
      }
    </script>
  </body>
</html>

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:签名错误
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:d618dc39-0430-deff-4363-86944f1304be

失败示例

{
    "code": 1, 
    "msg": "签名错误", 
    "request_id": "d618dc39-0430-deff-4363-86944f1304be"
}
公众号支付便捷版API
蓝兔支付后台系统返回二维码地址和支付链接,商户可自行使用支付链接生成二维码图片,用户使用微信客户端扫码或微信内置浏览器访问后调起支付页面。

注意:

  • 此接口同样是通过JSAPI方式发起的支付,只是进一步对公众号支付接口的封装,简化了开发步骤和流程。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/jsapi_convenient

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
return_url String 回跳地址,支付成功后用户点击【返回商户网站】跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。
示例值:https://www.weixin.qq.com/
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/jsapi_convenient",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/jsapi_convenient")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/jsapi_convenient", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/jsapi_convenient"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022113023096" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669533132" },
        { "notify_url", "https://www.weixin.qq.com/wxpay/pay.php" },
        { "return_url", "https://www.weixin.qq.com/" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/jsapi_convenient"

	payload := strings.NewReader("mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/jsapi_convenient");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/jsapi_convenient");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022113023096",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669533132",
  "notify_url": "https://www.weixin.qq.com/wxpay/pay.php",
  "return_url": "https://www.weixin.qq.com/",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/jsapi_convenient"

payload <- "mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&return_url=https://www.weixin.qq.com/&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.order_url String 蓝兔支付生成的支付链接,此URL可用于生成支付二维码,然后提供给用户扫码或微信内置浏览器访问后调起支付。
示例值:https://api.ltzf.cn/api/wxpay/jsapi_order?state=682F5B5B344E2C65FD13AC10CD0CF122
data.QRcode_url String 蓝兔支付生成的二维码链接地址
示例值:https://api.ltzf.cn/uploads/QRcode/wxpay/682F5B5B344E2C65FD13AC10CD0CF122.png
msg String 消息
示例值:JSAPI下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:16d195b8-75f6-55cf-b696-78f98dd8edd8

成功示例

{
    "code": 0, 
    "data": {
        "order_url": "https://api.ltzf.cn/api/wxpay/jsapi_order?state=682F5B5B344E2C65FD13AC10CD0CF122", 
        "QRcode_url": "https://api.ltzf.cn/uploads/QRcode/wxpay/682F5B5B344E2C65FD13AC10CD0CF122.png"
    }, 
    "msg": "JSAPI下单成功", 
    "request_id": "16d195b8-75f6-55cf-b696-78f98dd8edd8"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:参数mch_id不能为空
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:e1865a21-875c-09e5-3fc9-58b8f2f13e8c

失败示例

{
    "code": 1, 
    "msg": "参数mch_id不能为空", 
    "request_id": "e1865a21-875c-09e5-3fc9-58b8f2f13e8c"
}
APP支付API
蓝兔支付后台系统返回APP调起微信支付所需的参数。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/app

请求方式:POST

请求参数
参数名 参数类型 必填 描述
app_id String 微信开放平台审核通过的移动应用appid
示例值:wxfa7dbd439a7773b0
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/app",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "app_id=wxfa7dbd439a7773b0&mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/app")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("app_id=wxfa7dbd439a7773b0&mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "app_id=wxfa7dbd439a7773b0&mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/app", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/app"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "app_id", "wxfa7dbd439a7773b0" },
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022113023096" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669533132" },
        { "notify_url", "https://www.weixin.qq.com/wxpay/pay.php" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/app"

	payload := strings.NewReader("app_id=wxfa7dbd439a7773b0&mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "app_id=wxfa7dbd439a7773b0&mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/app");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/app");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "app_id": "wxfa7dbd439a7773b0",
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022113023096",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669533132",
  "notify_url": "https://www.weixin.qq.com/wxpay/pay.php",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/app"

payload <- "app_id=wxfa7dbd439a7773b0&mch_id=1230000109&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669533132&notify_url=https://www.weixin.qq.com/wxpay/pay.php&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.appid String 移动应用appid
示例值:wxfa7dbd439a7773b0
data.partnerid String 商户号
示例值:1230000109
data.prepayid String 预支付交易会话ID
示例值:wx231812473413099ab69f270e20f0250000
data.package String 订单详情扩展字符串
示例值:Sign=WXPay
data.noncestr String 随机字符串
示例值:jWFxa0X9AO9Enej6TknqHJTBwvfVc7Es
data.timestamp String 时间戳
示例值:1669198367
data.sign String 签名
示例值:oF4EbHLtoyjIs9Vh+nI30ZfPef++GxhtfgfPia82eXng99F6kxSOBa57dRXefPl1uNn6iVdlyPEhMwk+u6W+UrDA7mzFOD6BL44tMS4RmC74PDkE3x/cQEZXl1ELR6dmzUtB7Kg0DMxsWmFrag6f9zkwHXO/GqtXmo7rtS7o8dc7hFtVaFOsfcgLwqKcyuqR8Sq3EIAeLXoQJRTDlTd4lpYU6ewOKI/WNrmvr7zaeA7RBkS4jzi9r9MYGhNY9kHtBLWBefcuQHxTn1Y84pqL1plkv9LeF+jiteiPHtQ78Bx79r4R7CGA6Axodz5y0eS7DgXsf+4HBlZmA1PO0SdDvg==
msg String 消息
示例值:微信App下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:3d848202-0ac8-4112-3972-9f9bd746d428

成功示例

{
    "code": 0, 
    "data": {
        "appid": "wxfa7dbd439a7773b0", 
        "partnerid": "1230000109", 
        "prepayid": "wx231812473413099ab69f270e20f0250000", 
        "package": "Sign=WXPay", 
        "noncestr": "jWFxa0X9AO9Enej6TknqHJTBwvfVc7Es", 
        "timestamp": "1669198367", 
        "sign": "oF4EbHLtoyjIs9Vh+nI30ZfPef++GxhtfgfPia82eXng99F6kxSOBa57dRXefPl1uNn6iVdlyPEhMwk+u6W+UrDA7mzFOD6BL44tMS4RmC74PDkE3x/cQEZXl1ELR6dmzUtB7Kg0DMxsWmFrag6f9zkwHXO/GqtXmo7rtS7o8dc7hFtVaFOsfcgLwqKcyuqR8Sq3EIAeLXoQJRTDlTd4lpYU6ewOKI/WNrmvr7zaeA7RBkS4jzi9r9MYGhNY9kHtBLWBefcuQHxTn1Y84pqL1plkv9LeF+jiteiPHtQ78Bx79r4R7CGA6Axodz5y0eS7DgXsf+4HBlZmA1PO0SdDvg=="
    }, 
    "msg": "微信App下单成功", 
    "request_id": "3d848202-0ac8-4112-3972-9f9bd746d428"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:da59bed9-4d27-25ed-b87b-deefc6b5dc32

失败示例

{
    "code": 1, 
    "msg": "商户订单号重复", 
    "request_id": "da59bed9-4d27-25ed-b87b-deefc6b5dc32"
}
APP支付[跳转模式]API
商户后端将相关参数通过调用移动应用SDK “WXLaunchMiniProgram”接口拉起 “蓝兔收银” 小程序,“蓝兔收银” 小程序负责下单支付,并返回结果。

注意:

  • 请勿以 “蓝兔收银” 小程序返回结果作为判断订单状态的依据,需后端查询订单状态。

APP支付[跳转模式]支付接口接入流程:

  1. 后端按照下面请求参数构造订单参数。
  2. 您的APP携带上述参数拉起 “蓝兔收银” 小程序。
  3. 用户支付完成后点击返回APP。

APP拉起小程序功能介绍:https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Launching_a_Mini_Program/Launching_a_Mini_Program.html

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名。


接口说明

适用对象:个人、个体户、企业

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
title String 蓝兔收银小程序页面顶部的标题,可自定义品牌名称,不传默认为“收银台”,如传递参数“蓝兔支付”,页面则显示“蓝兔支付-收银台”。
示例值:蓝兔支付
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07
返回参数
参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
-1:异常
示例值:0
data Object 返回数据
data.out_trade_no String 商户订单号
示例值:LTZF2022113023096
msg String 消息
示例值:支付成功
返回示例

成功示例

{
    "code": 0, 
    "data": {
        "out_trade_no": "LTZF2022113023096"
    }, 
    "msg": "支付成功"
}

失败示例

{
    "code": 1, //1:支付已取消或支付接口返回错误等、-1:小程序执行中出现异常
    "msg": "取消支付"
}

接入步骤:

  1. 注意:小程序原始id:gh_40a6af82554e,path路径:pages/pay/pay?mch_id=xxx&out_trade_no=xxx...。

  2. 在您的APP需要支付的页面,拉起 “蓝兔收银” 小程序。

    String appId = "***************"; // 填移动应用(App)的 AppId,非小程序的 AppID
    IWXAPI api = WXAPIFactory.createWXAPI(getApplicationContext(), appId);
    String out_trade_no = txt_order.getText().toString(); //'商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
    String total_fee = txt_money.getText().toString(); // '支付金额
    String body = txt_msg.getText().toString(); // '商品描述
    String timestamp = (TimeUtils.getNowMills() / 1000) + ""; //.ToUnixTime(DateTime.Now); //'当前时间戳
    String datastr = "";
    //'生成签名的参数
    String postdata = "body=" + body + "&mch_id=" + mch_id + "&notify_url=" + notify_url + "&out_trade_no=" + out_trade_no + "&timestamp=" + timestamp + "&total_fee=" + total_fee;
    datastr = postdata + "&key=" + mch_key;
    String sign = EncryptUtils.encryptMD5ToString(datastr); //'生成签名
    WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
    req.userName = "gh_40a6af82554e"; // 填小程序原始id,固定值 不可修改
    req.path = "pages/pay/pay?" + postdata + "&sign=" + sign + "&title=蓝兔支付"; //拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
    req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE; // 可选打开 开发版,体验版和正式版
    api.sendReq(req);
    ToastUtils.showLong("开始拉起");
  3. 用户在 “蓝兔收银” 小程序中完成支付后点击返回APP会回调支付结果,具体结果可以在APP中通过以下方式获取

    public void onResp(BaseResp resp)
    {
        if(resp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM)
        {
            WXLaunchMiniProgram.Resp launchMiniProResp = (WXLaunchMiniProgram.Resp) resp;
            String extraData = launchMiniProResp.extMsg; //对应小程序组件 <button open-type="launchApp"> 中的 app-parameter 属性
        }
    }
小程序支付API
商户后端将相关参数通过调用wx.openEmbeddedMiniProgram接口传入 “蓝兔收银” 小程序,“蓝兔收银” 小程序负责下单支付,并返回结果。

注意:

  • 请勿以 “蓝兔收银” 小程序跳转结果作为判断订单状态的依据,需后端查询订单状态。

小程序支付接口接入流程:

  1. 后端按照下面请求参数构造订单参数。
  2. 您的小程序携带上述参数半屏调起 “蓝兔收银” 小程序。
  3. 用户支付完成后自动返回到您的小程序。

在线体验:

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单域名。


接口说明

适用对象:个人、个体户、企业

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669533132
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.weixin.qq.com/wxpay/pay.php
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
title String 蓝兔收银小程序页面顶部的标题,可自定义品牌名称,不传默认为“收银台”,如传递参数“蓝兔支付”,页面则显示“蓝兔支付-收银台”。
示例值:蓝兔支付
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07
返回参数
参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
-1:异常
示例值:0
data Object 返回数据
data.out_trade_no String 商户订单号
示例值:LTZF2022113023096
msg String 消息
示例值:支付成功
返回示例

成功示例

{
    "code": 0, 
    "data": {
        "out_trade_no": "LTZF2022113023096"
    }, 
    "msg": "支付成功"
}

失败示例

{
    "code": 1, //1:支付已取消或支付接口返回错误等、-1:小程序执行中出现异常
    "msg": "取消支付"
}

接入步骤:

  1. 您需要在小程序管理后台「设置」-「第三方设置」-「半屏小程序管理」-「我调用的」添加 “蓝兔收银” 小程序的appid:wx5356f0d34f30337f。

  2. 在您的小程序app.json文件中添加 “蓝兔收银” 小程序的appid:wx5356f0d34f30337f。

    "embeddedAppIdList": ["wx5356f0d34f30337f"]
  3. 在您的小程序需要支付的页面,半屏调起 “蓝兔收银” 小程序。

    //构造订单参数
    let data = {
    	mch_id: '1230000109', //商户号
    	out_trade_no: 'LTZF2022113023096', //商户订单号
    	total_fee: '0.01', //支付金额
    	body: 'Image形象店-深圳腾大-QQ公仔', //商品描述
    	timestamp: '1669533132', //当前时间戳
    	notify_url: 'https://www.weixin.qq.com/wxpay/pay.php', //支付通知地址
    	sign: 'B7337098E280841EB5F4D28261B60C07' //签名
    };
    //半屏调起蓝兔收银小程序
    wx.openEmbeddedMiniProgram({
    	appId: 'wx5356f0d34f30337f', //蓝兔收银小程序的appid 固定值 不可修改
    	path: 'pages/pay/pay', //支付页面 固定值 不可修改
    	extraData: data, //携带的参数 参考API文档
    	success(res) {
    		//打开成功
    	},
    	fail(res) {
    		//打开失败
    	}
    });
  4. 用户在 “蓝兔收银” 小程序中完成支付后,会回调支付结果,具体结果可以在小程序生命周期App.onShow中通过以下方式获取

    onShow() {
    	const self = this; //声明常量
    	let options = wx.getEnterOptionsSync();
    	if (options && options.scene == 1038 && options.referrerInfo.appId == 'wx5356f0d34f30337f') {
    		let data = options.referrerInfo.extraData; //蓝兔收银 小程序传过来的数据
    		if (data) {
    			if (data.code === 0) {
    				//支付成功
    				self.globalData.out_trade_no = data.data.out_trade_no; //商户订单号
    				self.globalData.pay_status = 0; //支付成功
    				self.globalData.pay_msg = data.msg; //支付返回的信息
    			} else if (data.code === 1) {
    				//支付已取消或支付接口返回错误等
    				self.globalData.pay_status = 1; //支付已取消
    				self.globalData.pay_msg = data.msg; //支付返回的信息
    			} else {//data.code === -1
    				//小程序执行中出现异常
    			}
    		} else {
    			/*当通过物理返回键或者通过半屏小程序右上角关闭退出(即未通过收银台小程序内按钮退出),extraData内容会为空,
    			调用方小程序会无法获得支付结果,该情况为微信小程序特性,小程序代码无法处理。需要自行查询订单支付结果*/
    			wx.showToast({
    				title: '状态未知,未通过收银台小程序内按钮退出', //错误提示
    				icon: 'none',
    				duration: 3000
    			});
    		}
    	}
    
    }
  5. 在您的小程序页面中获取支付结果参数(注意:必须在Page.onShow方法中获取)

    onShow() {
    	//支付完成,开始处理数据
    	if (app.globalData.pay_status != null && app.globalData.pay_status === 0) {
    		app.globalData.pay_status = null; //建议处理数据后重置改状态
    		let out_trade_no = app.globalData.out_trade_no; //商户订单号
    		//处理您自己的业务
    		/*
    		/*
    		*/
    	}
    }
订单退款API
对已经支付的订单发起退款。

注意:

  • 交易时间超过一年的订单无法提交退款。
  • 每个支付订单的部分退款次数不能超过50次。
  • 同一笔订单多次退款的请求需相隔1分钟。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/refund_order

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号
示例值:LTZF2022111609188
out_refund_no String 商户退款单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:TK2022112100576
timestamp String 当前时间戳
示例值:1669518774
refund_fee String 退款金额
示例值:0.01
refund_desc String 退款描述
示例值:商品已售完
notify_url String 退款通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://weixin.qq.com
sign String 签名,数据签名的算法请参考
示例值:AD38ACEA706F2E46CCD668B8D2DEC57E

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/refund_order",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_trade_no=LTZF2022111609188&out_refund_no=TK2022112100576&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://weixin.qq.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/refund_order")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_trade_no=LTZF2022111609188&out_refund_no=TK2022112100576&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://weixin.qq.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_trade_no=LTZF2022111609188&out_refund_no=TK2022112100576&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://weixin.qq.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/refund_order", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/refund_order"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022111609188" },
        { "out_refund_no", "TK2022112100576" },
        { "timestamp", "1669518774" },
        { "refund_fee", "0.01" },
        { "refund_desc", "商品已售完" },
        { "notify_url", "https://weixin.qq.com" },
        { "sign", "AD38ACEA706F2E46CCD668B8D2DEC57E" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/refund_order"

	payload := strings.NewReader("mch_id=1230000109&out_trade_no=LTZF2022111609188&out_refund_no=TK2022112100576&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://weixin.qq.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_trade_no=LTZF2022111609188&out_refund_no=TK2022112100576&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://weixin.qq.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/refund_order");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/refund_order");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022111609188",
  "out_refund_no": "TK2022112100576",
  "timestamp": "1669518774",
  "refund_fee": "0.01",
  "refund_desc": "商品已售完",
  "notify_url": "https://weixin.qq.com",
  "sign": "AD38ACEA706F2E46CCD668B8D2DEC57E"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/refund_order"

payload <- "mch_id=1230000109&out_trade_no=LTZF2022111609188&out_refund_no=TK2022112100576&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://weixin.qq.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.mch_id String 商户号
示例值:1230000109
data.out_trade_no String 商户订单号
示例值:LTZF2022111609188
data.out_refund_no String 商户退款单号
示例值:TK2022112100576
data.order_no String 系统退款单号
示例值:T0202211211939004893520234
data.pay_refund_no String 微信支付退款单号
示例值:50300203882022112127463972123
msg String 消息
示例值:发起退款成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:d3dc7552-f132-81c9-9aa7-fb114d4ba97b

成功示例

{
    "code": 0, 
    "data": {
        "mch_id": "1230000109", 
        "out_trade_no": "LTZF2022111609188", 
        "out_refund_no": "TK2022112100576", 
        "order_no": "T0202211211939004893520234", 
        "pay_refund_no": "50300203882022112127463972123"
    }, 
    "msg": "发起退款成功", 
    "request_id": "d3dc7552-f132-81c9-9aa7-fb114d4ba97b"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:退款金额不能超过可退金额:0
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:1b2bafd7-f387-6151-015e-5b4261bc5209

失败示例

{
    "code": 1, 
    "msg": "退款金额不能超过可退金额:0", 
    "request_id": "1b2bafd7-f387-6151-015e-5b4261bc5209"
}
获取微信Openid API
蓝兔支付返回授权链接。

注意:

  • 此接口禁止业务未发生时调用,比如网站一打开就调用此接口,系统识别该种情况会拉黑服务器IP。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/get_wechat_openid

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
timestamp String 当前时间戳
示例值:1669518774
callback_url String 授权后重定向的回调链接地址
示例值:https://www.ltzf.cn/
attach String 附加数据,回调时原样返回,可作为自定义参数使用。
示例值:自定义数据
sign String 签名,数据签名的算法请参考
示例值:04E635F91BE30725195E574826C01A46

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/get_wechat_openid",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&timestamp=1669518774&callback_url=https://www.ltzf.cn/&attach=自定义数据&sign=04E635F91BE30725195E574826C01A46",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/get_wechat_openid")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&timestamp=1669518774&callback_url=https://www.ltzf.cn/&attach=自定义数据&sign=04E635F91BE30725195E574826C01A46")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&timestamp=1669518774&callback_url=https://www.ltzf.cn/&attach=自定义数据&sign=04E635F91BE30725195E574826C01A46"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/get_wechat_openid", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/get_wechat_openid"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "timestamp", "1669518774" },
        { "callback_url", "https://www.ltzf.cn/" },
        { "attach", "自定义数据" },
        { "sign", "04E635F91BE30725195E574826C01A46" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/get_wechat_openid"

	payload := strings.NewReader("mch_id=1230000109&timestamp=1669518774&callback_url=https://www.ltzf.cn/&attach=自定义数据&sign=04E635F91BE30725195E574826C01A46")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&timestamp=1669518774&callback_url=https://www.ltzf.cn/&attach=自定义数据&sign=04E635F91BE30725195E574826C01A46";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/get_wechat_openid");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/get_wechat_openid");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "timestamp": "1669518774",
  "callback_url": "https://www.ltzf.cn/",
  "attach": "自定义数据",
  "sign": "04E635F91BE30725195E574826C01A46"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/get_wechat_openid"

payload <- "mch_id=1230000109&timestamp=1669518774&callback_url=https://www.ltzf.cn/&attach=自定义数据&sign=04E635F91BE30725195E574826C01A46"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data String 授权链接,在微信里访问这个链接,访问后将自动跳转到您填写的回调地址,地址后面会增加openid和attach参数(例如:https://www.ltzf.cn/?openid=XXXXXX&attach=自定义数据)
示例值:https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa3d61201263587a8&redirect_uri=https://api.ltzf.cn/api/wxpay/wx_oauth&response_type=code&scope=snsapi_base&state=AB23F31B5F0C863B344C8D59605B0809#wechat_redirect
msg String 消息
示例值:获取授权链接成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:3a08d731-f79b-9283-1a1a-24156707111e

成功示例

{
    "code": 0, 
    "data": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa3d61201263587a8&redirect_uri=https://api.ltzf.cn/api/wxpay/wx_oauth&response_type=code&scope=snsapi_base&state=AB23F31B5F0C863B344C8D59605B0809#wechat_redirect", 
    "msg": "获取授权链接成功", 
    "request_id": "3a08d731-f79b-9283-1a1a-24156707111e"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:签名错误
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:e5938d29-8ed4-98b1-d192-b50fcb4909de

失败示例

{
    "code": 1, 
    "msg": "签名错误", 
    "request_id": "e5938d29-8ed4-98b1-d192-b50fcb4909de"
}
查询订单API
商户可以通过查询订单接口主动查询订单状态,完成下一步的业务逻辑。

注意:

  • 此接口请求频率限制:1qps/5s,即5秒钟请求限制为1次。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/get_pay_order

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_trade_no String 商户订单号
示例值:LTZF2022112264463
timestamp String 当前时间戳
示例值:1669518774
sign String 签名,数据签名的算法请参考
示例值:4440B462E792B604BD56A37EA41E5B8F

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/get_pay_order",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_trade_no=LTZF2022112264463&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/get_pay_order")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_trade_no=LTZF2022112264463&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_trade_no=LTZF2022112264463&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/get_pay_order", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/get_pay_order"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_trade_no", "LTZF2022112264463" },
        { "timestamp", "1669518774" },
        { "sign", "4440B462E792B604BD56A37EA41E5B8F" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/get_pay_order"

	payload := strings.NewReader("mch_id=1230000109&out_trade_no=LTZF2022112264463&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_trade_no=LTZF2022112264463&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/get_pay_order");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/get_pay_order");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_trade_no": "LTZF2022112264463",
  "timestamp": "1669518774",
  "sign": "4440B462E792B604BD56A37EA41E5B8F"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/get_pay_order"

payload <- "mch_id=1230000109&out_trade_no=LTZF2022112264463&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.add_time String 下单时间
示例值:2022-11-22 11:55:09
data.mch_id String 商户号
示例值:1230000109
data.order_no String 系统订单号
示例值:WX202211221155084844072633
data.out_trade_no String 商户订单号
示例值:LTZF2022112264463
data.pay_no String 微信支付订单号,当支付状态为已支付时返回此参数。
示例值:4200001635202211222291508463
data.body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
data.total_fee String 支付金额
示例值:0.01
data.trade_type String 支付类型,枚举值:
NATIVE:扫码支付
H5:H5支付
APP:APP支付
JSAPI:公众号支付
MINIPROGRAM:小程序支付
示例值:NATIVE
data.success_time String 支付完成时间,当支付状态为已支付时返回此参数。
示例值:2022-11-22 11:55:42
data.attach String 附加数据,在支付接口中填写的数据,可作为自定义参数使用。
示例值:自定义数据
data.openid String 支付者信息,当支付状态为已支付时返回此参数。
示例值:o5wq46GAKVxVKpsdcI4aU4cBpgT0
data.pay_status Integer 支付状态,枚举值:
0:未支付
1:已支付
示例值:1
msg String 消息
示例值:查询成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:1bc65e47-77c3-b68a-c37c-b56a97d18d24

成功示例

{
    "code": 0, 
    "data": {
        "add_time": "2022-11-22 11:55:09", 
        "mch_id": "1230000109", 
        "order_no": "WX202211221155084844072633", 
        "out_trade_no": "LTZF2022112264463", 
        "pay_no": "4200001635202211222291508463", 
        "body": "Image形象店-深圳腾大-QQ公仔", 
        "total_fee": "0.01", 
        "trade_type": "NATIVE", 
        "success_time": "2022-11-22 11:55:42", 
        "attach": "自定义数据", 
        "openid": "o5wq46GAKVxVKpsdcI4aU4cBpgT0", 
        "pay_status": 1
    }, 
    "msg": "查询成功", 
    "request_id": "1bc65e47-77c3-b68a-c37c-b56a97d18d24"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号不存在
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:f46b1932-7f95-b728-7e0c-17663f7a3c7e

失败示例

{
    "code": 1, 
    "msg": "商户订单号不存在", 
    "request_id": "f46b1932-7f95-b728-7e0c-17663f7a3c7e"
}
查询退款结果API
提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,建议在提交退款申请后1分钟发起查询退款状态,一般来说零钱支付的退款5分钟内到账,银行卡支付的退款1-3个工作日到账。

注意:

  • 此接口请求频率限制:1qps/10s,即10秒钟请求限制为1次。

特别提醒:调用接口前请先在控制台微信支付商户管理修改设置白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/wxpay/get_refund_order

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:1230000109
out_refund_no String 商户退款单号
示例值:TK2022112294916
timestamp String 当前时间戳
示例值:1669518774
sign String 签名,数据签名的算法请参考
示例值:682B13F8D7305CDBC70E22721604D14B

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/wxpay/get_refund_order",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1230000109&out_refund_no=TK2022112294916&timestamp=1669518774&sign=682B13F8D7305CDBC70E22721604D14B",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/wxpay/get_refund_order")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1230000109&out_refund_no=TK2022112294916&timestamp=1669518774&sign=682B13F8D7305CDBC70E22721604D14B")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1230000109&out_refund_no=TK2022112294916&timestamp=1669518774&sign=682B13F8D7305CDBC70E22721604D14B"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/wxpay/get_refund_order", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/wxpay/get_refund_order"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1230000109" },
        { "out_refund_no", "TK2022112294916" },
        { "timestamp", "1669518774" },
        { "sign", "682B13F8D7305CDBC70E22721604D14B" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/wxpay/get_refund_order"

	payload := strings.NewReader("mch_id=1230000109&out_refund_no=TK2022112294916&timestamp=1669518774&sign=682B13F8D7305CDBC70E22721604D14B")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1230000109&out_refund_no=TK2022112294916&timestamp=1669518774&sign=682B13F8D7305CDBC70E22721604D14B";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/wxpay/get_refund_order");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/wxpay/get_refund_order");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1230000109",
  "out_refund_no": "TK2022112294916",
  "timestamp": "1669518774",
  "sign": "682B13F8D7305CDBC70E22721604D14B"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/wxpay/get_refund_order"

payload <- "mch_id=1230000109&out_refund_no=TK2022112294916&timestamp=1669518774&sign=682B13F8D7305CDBC70E22721604D14B"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.refund_status Integer 退款状态,枚举值:
0:退款中
1:退款成功
-1:退款失败
示例值:1
data.mch_id String 商户号
示例值:1230000109
data.out_trade_no String 商户订单号
示例值:ltzf1667389556
data.pay_no String 微信支付订单号
示例值:4200001667202211023770698203
data.order_no String 系统退款单号
示例值:T0202211221235592690754030
data.out_refund_no String 商户退款单号
示例值:TK2022112294916
data.pay_refund_no String 微信支付退款单号
示例值:50302603802022112227478742725
data.refund_fee String 退款金额
示例值:0.01
data.user_received_account String 退款入账账户
示例值:支付用户零钱
data.success_time String 退款完成时间,当退款状态为退款成功时返回此参数。
示例值:2022-11-22 12:36:07
msg String 消息
示例值:查询成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:74e51b04-dd6b-a319-3234-c46f53b9de45

成功示例

{
    "code": 0, 
    "data": {
        "refund_status": 1, 
        "mch_id": "1230000109", 
        "out_trade_no": "ltzf1667389556", 
        "pay_no": "4200001667202211023770698203", 
        "order_no": "T0202211221235592690754030", 
        "out_refund_no": "TK2022112294916", 
        "pay_refund_no": "50302603802022112227478742725", 
        "refund_fee": "0.01", 
        "user_received_account": "支付用户零钱", 
        "success_time": "2022-11-22 12:36:07"
    }, 
    "msg": "查询成功", 
    "request_id": "74e51b04-dd6b-a319-3234-c46f53b9de45"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:签名错误
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:22d3d7f6-0fca-0931-1f17-09e4d41edb6f

失败示例

{
    "code": 1, 
    "msg": "签名错误", 
    "request_id": "22d3d7f6-0fca-0931-1f17-09e4d41edb6f"
}
扫码支付API
蓝兔支付后台系统返回二维码地址,用户使用支付宝客户端扫码后发起支付。

特别提醒:调用接口前请先在控制台支付宝商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/alipay/native

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:2088610977715791
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022111211038183
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669529706
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:http://api.test.alipay.net/atinterface/receive_notify.htm
return_url String 回跳地址,支付成功后自动跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。
示例值:https://m.alipay.com/Gk8NF23
type String 返回类型,枚举值:
qrcode_url:蓝兔支付生成的二维码链接地址
link_url:蓝兔支付生成的支付链接,此URL可用于生成支付二维码,然后提供给用户扫码调起支付。
不填写默认qrcode_url
示例值:qrcode_url
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
d:天
取值范围:1m~15d(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/alipay/native",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=2088610977715791&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/alipay/native")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=2088610977715791&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=2088610977715791&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/alipay/native", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/alipay/native"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "2088610977715791" },
        { "out_trade_no", "LTZF2022111211038183" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669529706" },
        { "notify_url", "http://api.test.alipay.net/atinterface/receive_notify.htm" },
        { "return_url", "https://m.alipay.com/Gk8NF23" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/alipay/native"

	payload := strings.NewReader("mch_id=2088610977715791&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=2088610977715791&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/alipay/native");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/alipay/native");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "2088610977715791",
  "out_trade_no": "LTZF2022111211038183",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669529706",
  "notify_url": "http://api.test.alipay.net/atinterface/receive_notify.htm",
  "return_url": "https://m.alipay.com/Gk8NF23",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/alipay/native"

payload <- "mch_id=2088610977715791&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data String 蓝兔支付生成的二维码链接地址
示例值:https://api.ltzf.cn/uploads/QRcode/alipay/AL202211231804045033176243.png
msg String 消息
示例值:支付宝Native下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:0c63bacb-ebe2-0708-5b15-024bc7145f45

成功示例

{
    "code": 0, 
    "data": "https://api.ltzf.cn/uploads/QRcode/alipay/AL202211231804045033176243.png", 
    "msg": "支付宝Native下单成功", 
    "request_id": "0c63bacb-ebe2-0708-5b15-024bc7145f45"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:27a0eec3-9166-32f9-cd0b-f34337d3cee7

失败示例

{
    "code": 1, 
    "msg": "商户订单号重复", 
    "request_id": "27a0eec3-9166-32f9-cd0b-f34337d3cee7"
}
H5支付API
蓝兔支付后台系统返回短链接地址和支付宝原生的支付链接,用户使用浏览器访问该链接地址后自动调起支付宝APP。

特别提醒:调用接口前请先在控制台支付宝商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/alipay/h5

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:2088610977715791
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022113023096
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669518774
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:http://api.test.alipay.net/atinterface/receive_notify.htm
return_url String 回跳地址,支付成功后或取消支付自动跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。
示例值:https://m.alipay.com/Gk8NF23
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
d:天
取值范围:1m~15d(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:9018ECD3C9C97C12CF8B5699D5E198E6

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/alipay/h5",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=2088610977715791&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/alipay/h5")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=2088610977715791&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=2088610977715791&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/alipay/h5", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/alipay/h5"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "2088610977715791" },
        { "out_trade_no", "LTZF2022113023096" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669518774" },
        { "notify_url", "http://api.test.alipay.net/atinterface/receive_notify.htm" },
        { "return_url", "https://m.alipay.com/Gk8NF23" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "9018ECD3C9C97C12CF8B5699D5E198E6" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/alipay/h5"

	payload := strings.NewReader("mch_id=2088610977715791&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=2088610977715791&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/alipay/h5");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/alipay/h5");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "2088610977715791",
  "out_trade_no": "LTZF2022113023096",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669518774",
  "notify_url": "http://api.test.alipay.net/atinterface/receive_notify.htm",
  "return_url": "https://m.alipay.com/Gk8NF23",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "9018ECD3C9C97C12CF8B5699D5E198E6"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/alipay/h5"

payload <- "mch_id=2088610977715791&out_trade_no=LTZF2022113023096&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.h5_url String 支付宝原生支付链接
示例值:https://openapi.alipay.com/gateway.do?alipay_root_cert_sn=687b59193f3f462dd5336e5abf83c5d8_02941eef3187dddf3d3b83462e1dfcf6&app_cert_sn=23ceb84219967f04252d4857149c8437&app_id=2021003143650127&biz_content=%2FddbISAnn9U3mEWEUh1gJ2zaiNIekaAsqzw4mJJ%2FkZszBS%2Bk1%2FjgXY02C%2F2MNDfXp%2BLMRFoU9PvE8ptA15RfIjkWDd13z3ly%2B9UIbInkMdJ5lfiNyIq9p6C4VMoXOO4h%2F97o%2FAGEtoVuJtB90dG%2BNH5Y1FP9UcgbwRBUEky%2BLWyDl838K7KwGkFC1WK6KB97IyFaYMpGJBo%2FoL23R2W6hAcXNO1NzDbnjh68Xfl7Bbn0kMlvsNHgFG34d7BF10b2vHWEEu1Sac6ax4nJcG0VN6gSuVU0uNznI7bPV6IotVVtMI1AfIWjt5O4ytCZoL169Td6zhONTwutUl74jGWiAGGdCGFXA0cYoStwlu13fuvfo5gmyp33mFSmpROP%2B%2FGRL0ugC03WO9gNjmy2HJD36UBZorPNKql1pR3qaMWcQ3w%3D&charset=utf-8&encrypt_type=AES&format=JSON&method=alipay.trade.wap.pay¬ify_url=https%3A%2F%2Fapi.ltzf.cn%2Fapi%2Fcallback%2Falipay_order_notify&return_url=http%3A%2F%2Fyanshi.ltzf.cn&sign=GfVOIuXAf1Ck0HWcV1%2B8OVvNVZoCHEPL8rNRWAJHRtBYTweHYVNYzBZO3447xzeK7QsgZmEDz%2F4RUeyHktXexDTahrUjuei3SoU04RBI%2FDWkAYUzrHxTIys53l%2FpVXzEwtdZka4GXLRgaAViJQax2MIk9IK4g%2Fw9Y0oY%2FSRJ%2BHRNKh1wU3Kh4Bt%2FH8DRSaGZ0YxZnzkXSdD7ycnb%2B9C1xsOEdi3PrfkSith8q9gWOuRZyan8i7Echxfn0uVjz%2BAY7ToFTVcXZ2wWQfruWhb1pyUWIx9JJZdXkTgQ6TYh%2FUD8ouUe2C0ddW%2Bgz9RpV56mXy4%2B4NcS%2FiA05ATMf8UWGQ%3D%3D&sign_type=RSA2×tamp=2022-11-23+18%3A03%3A20&version=1.0
data.order_url String 蓝兔支付生成的短链接地址
示例值:https://api.ltzf.cn/api/alipay/order_url?order_no=AL202211231803203924408142
msg String 消息
示例值:支付宝H5下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:01b2c7a8-8004-bbfb-4a0e-e406ba3d9516

成功示例

{
    "code": 0, 
    "data": {
        "h5_url": "https://openapi.alipay.com/gateway.do?alipay_root_cert_sn=687b59193f3f462dd5336e5abf83c5d8_02941eef3187dddf3d3b83462e1dfcf6&app_cert_sn=23ceb84219967f04252d4857149c8437&app_id=2021003143650127&biz_content=%2FddbISAnn9U3mEWEUh1gJ2zaiNIekaAsqzw4mJJ%2FkZszBS%2Bk1%2FjgXY02C%2F2MNDfXp%2BLMRFoU9PvE8ptA15RfIjkWDd13z3ly%2B9UIbInkMdJ5lfiNyIq9p6C4VMoXOO4h%2F97o%2FAGEtoVuJtB90dG%2BNH5Y1FP9UcgbwRBUEky%2BLWyDl838K7KwGkFC1WK6KB97IyFaYMpGJBo%2FoL23R2W6hAcXNO1NzDbnjh68Xfl7Bbn0kMlvsNHgFG34d7BF10b2vHWEEu1Sac6ax4nJcG0VN6gSuVU0uNznI7bPV6IotVVtMI1AfIWjt5O4ytCZoL169Td6zhONTwutUl74jGWiAGGdCGFXA0cYoStwlu13fuvfo5gmyp33mFSmpROP%2B%2FGRL0ugC03WO9gNjmy2HJD36UBZorPNKql1pR3qaMWcQ3w%3D&charset=utf-8&encrypt_type=AES&format=JSON&method=alipay.trade.wap.pay¬ify_url=https%3A%2F%2Fapi.ltzf.cn%2Fapi%2Fcallback%2Falipay_order_notify&return_url=http%3A%2F%2Fyanshi.ltzf.cn&sign=GfVOIuXAf1Ck0HWcV1%2B8OVvNVZoCHEPL8rNRWAJHRtBYTweHYVNYzBZO3447xzeK7QsgZmEDz%2F4RUeyHktXexDTahrUjuei3SoU04RBI%2FDWkAYUzrHxTIys53l%2FpVXzEwtdZka4GXLRgaAViJQax2MIk9IK4g%2Fw9Y0oY%2FSRJ%2BHRNKh1wU3Kh4Bt%2FH8DRSaGZ0YxZnzkXSdD7ycnb%2B9C1xsOEdi3PrfkSith8q9gWOuRZyan8i7Echxfn0uVjz%2BAY7ToFTVcXZ2wWQfruWhb1pyUWIx9JJZdXkTgQ6TYh%2FUD8ouUe2C0ddW%2Bgz9RpV56mXy4%2B4NcS%2FiA05ATMf8UWGQ%3D%3D&sign_type=RSA2×tamp=2022-11-23+18%3A03%3A20&version=1.0", 
        "order_url": "https://api.ltzf.cn/api/alipay/order_url?order_no=AL202211231803203924408142"
    }, 
    "msg": "支付宝H5下单成功", 
    "request_id": "01b2c7a8-8004-bbfb-4a0e-e406ba3d9516"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:9f3e0530-cc62-7369-a1e2-1cce80c5633b

失败示例

{
    "code": 1, 
    "msg": "商户订单号重复", 
    "request_id": "9f3e0530-cc62-7369-a1e2-1cce80c5633b"
}
APP支付API
蓝兔支付后台系统返回APP调起支付宝所需的参数。

鸿蒙接入流程:https://opendocs.alipay.com/open/01ysmx

Android接入流程:https://opendocs.alipay.com/open/204/105296

Ios接入流程:https://opendocs.alipay.com/open/204/105295

特别提醒:调用接口前请先在控制台支付宝商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/alipay/app

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:2088610977715791
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022112101715
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669518774
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:http://api.test.alipay.net/atinterface/receive_notify.htm
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
d:天
取值范围:1m~15d(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:9018ECD3C9C97C12CF8B5699D5E198E6

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/alipay/app",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=2088610977715791&out_trade_no=LTZF2022112101715&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/alipay/app")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=2088610977715791&out_trade_no=LTZF2022112101715&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=2088610977715791&out_trade_no=LTZF2022112101715&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/alipay/app", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/alipay/app"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "2088610977715791" },
        { "out_trade_no", "LTZF2022112101715" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669518774" },
        { "notify_url", "http://api.test.alipay.net/atinterface/receive_notify.htm" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "9018ECD3C9C97C12CF8B5699D5E198E6" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/alipay/app"

	payload := strings.NewReader("mch_id=2088610977715791&out_trade_no=LTZF2022112101715&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=2088610977715791&out_trade_no=LTZF2022112101715&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/alipay/app");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/alipay/app");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "2088610977715791",
  "out_trade_no": "LTZF2022112101715",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669518774",
  "notify_url": "http://api.test.alipay.net/atinterface/receive_notify.htm",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "9018ECD3C9C97C12CF8B5699D5E198E6"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/alipay/app"

payload <- "mch_id=2088610977715791&out_trade_no=LTZF2022112101715&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669518774&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=9018ECD3C9C97C12CF8B5699D5E198E6"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data String APP调起支付宝所需的参数
示例值:alipay_root_cert_sn=687b59193f3f462dd5336e5abf83c5d8_02941eef3187dddf3d3b83462e1dfcf6&app_cert_sn=23ceb84219967f04252d4857149c8437&app_id=2021003143650127&biz_content=%7B%22out_trade_no%22%3A%22AL202212071048219752359622%22%2C%22total_amount%22%3A%220.01%22%2C%22subject%22%3A%22APP%5Cu652f%5Cu4ed8%5Cu6d4b%5Cu8bd5%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22sub_merchant%22%3A%7B%22merchant_id%22%3A%222088610977715791%22%7D%2C%22settle_info%22%3A%7B%22settle_detail_infos%22%3A%5B%7B%22amount%22%3A%220.01%22%2C%22trans_in_type%22%3A%22defaultSettle%22%7D%5D%7D%2C%22extend_params%22%3A%7B%22sys_service_provider_id%22%3A%222088441361253944%22%7D%7D&charset=utf-8&format=JSON&method=alipay.trade.app.pay¬ify_url=https%3A%2F%2Fapi.ltzf.cn%2Fapi%2Fcallback%2Falipay_order_notify&sign=DHcrUM2kQBspDGs6rRo97nYkLURP7X7gbtbsf4N1V1EnF62mx9arwdJrcINzFpTDZ%2BsWBY2ygW8x8qMK5DlzJYbXc7wvz8bEtQdVoTJCvzDMTsix7fazSzsGCbDZnwQ1acSvDYOyujJDSO2BWbK3u%2F5%2FvAhuHXZeJpSZ6ybo43NZDLcH7jCGB2Po9wjlNmZpAYLlqRLyRGxdKp%2Fd1JpIv8vtPh75B38jEdn6rGzeWN2zOnRtVEPyr4E52%2Bk0Fwi6zIhNknPnTkrA192DphUF8SpOngFm5IlW3MKqA0Ii%2FQYMmYPOZSPPsJPdpDfllwYiC2%2B5hUly5v2I0ZA4u4kMTA%3D%3D&sign_type=RSA2×tamp=2022-12-07+10%3A48%3A21&version=1.0
msg String 消息
示例值:支付宝APP下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:7a13c78b-a5b0-f320-96b8-3145ca57d4ee

成功示例

{
    "code": 0, 
    "data": "alipay_root_cert_sn=687b59193f3f462dd5336e5abf83c5d8_02941eef3187dddf3d3b83462e1dfcf6&app_cert_sn=23ceb84219967f04252d4857149c8437&app_id=2021003143650127&biz_content=%7B%22out_trade_no%22%3A%22AL202212071048219752359622%22%2C%22total_amount%22%3A%220.01%22%2C%22subject%22%3A%22APP%5Cu652f%5Cu4ed8%5Cu6d4b%5Cu8bd5%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22sub_merchant%22%3A%7B%22merchant_id%22%3A%222088610977715791%22%7D%2C%22settle_info%22%3A%7B%22settle_detail_infos%22%3A%5B%7B%22amount%22%3A%220.01%22%2C%22trans_in_type%22%3A%22defaultSettle%22%7D%5D%7D%2C%22extend_params%22%3A%7B%22sys_service_provider_id%22%3A%222088441361253944%22%7D%7D&charset=utf-8&format=JSON&method=alipay.trade.app.pay¬ify_url=https%3A%2F%2Fapi.ltzf.cn%2Fapi%2Fcallback%2Falipay_order_notify&sign=DHcrUM2kQBspDGs6rRo97nYkLURP7X7gbtbsf4N1V1EnF62mx9arwdJrcINzFpTDZ%2BsWBY2ygW8x8qMK5DlzJYbXc7wvz8bEtQdVoTJCvzDMTsix7fazSzsGCbDZnwQ1acSvDYOyujJDSO2BWbK3u%2F5%2FvAhuHXZeJpSZ6ybo43NZDLcH7jCGB2Po9wjlNmZpAYLlqRLyRGxdKp%2Fd1JpIv8vtPh75B38jEdn6rGzeWN2zOnRtVEPyr4E52%2Bk0Fwi6zIhNknPnTkrA192DphUF8SpOngFm5IlW3MKqA0Ii%2FQYMmYPOZSPPsJPdpDfllwYiC2%2B5hUly5v2I0ZA4u4kMTA%3D%3D&sign_type=RSA2×tamp=2022-12-07+10%3A48%3A21&version=1.0", 
    "msg": "支付宝APP下单成功", 
    "request_id": "7a13c78b-a5b0-f320-96b8-3145ca57d4ee"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:da59bed9-4d27-25ed-b87b-deefc6b5dc32

失败示例

{
    "code": 1, 
    "msg": "商户订单号重复", 
    "request_id": "da59bed9-4d27-25ed-b87b-deefc6b5dc32"
}
订单退款API
对已经支付的订单发起退款。

注意:

  • 交易时间超过一年的订单无法提交退款。
  • 同一笔交易的退款至少间隔3s后发起。

特别提醒:调用接口前请先在控制台支付宝商户管理修改设置白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/alipay/refund_order

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:2088610977715791
out_trade_no String 商户订单号
示例值:LTZF2022112152152
out_refund_no String 商户退款单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:TK2022112108508
timestamp String 当前时间戳
示例值:1669518774
refund_fee String 退款金额
示例值:0.01
refund_desc String 退款描述
示例值:商品已售完
notify_url String 退款通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:https://www.alipay.com
sign String 签名,数据签名的算法请参考
示例值:AD38ACEA706F2E46CCD668B8D2DEC57E

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/alipay/refund_order",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=2088610977715791&out_trade_no=LTZF2022112152152&out_refund_no=TK2022112108508&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://www.alipay.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/alipay/refund_order")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=2088610977715791&out_trade_no=LTZF2022112152152&out_refund_no=TK2022112108508&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://www.alipay.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=2088610977715791&out_trade_no=LTZF2022112152152&out_refund_no=TK2022112108508&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://www.alipay.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/alipay/refund_order", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/alipay/refund_order"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "2088610977715791" },
        { "out_trade_no", "LTZF2022112152152" },
        { "out_refund_no", "TK2022112108508" },
        { "timestamp", "1669518774" },
        { "refund_fee", "0.01" },
        { "refund_desc", "商品已售完" },
        { "notify_url", "https://www.alipay.com" },
        { "sign", "AD38ACEA706F2E46CCD668B8D2DEC57E" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/alipay/refund_order"

	payload := strings.NewReader("mch_id=2088610977715791&out_trade_no=LTZF2022112152152&out_refund_no=TK2022112108508&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://www.alipay.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=2088610977715791&out_trade_no=LTZF2022112152152&out_refund_no=TK2022112108508&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://www.alipay.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/alipay/refund_order");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/alipay/refund_order");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "2088610977715791",
  "out_trade_no": "LTZF2022112152152",
  "out_refund_no": "TK2022112108508",
  "timestamp": "1669518774",
  "refund_fee": "0.01",
  "refund_desc": "商品已售完",
  "notify_url": "https://www.alipay.com",
  "sign": "AD38ACEA706F2E46CCD668B8D2DEC57E"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/alipay/refund_order"

payload <- "mch_id=2088610977715791&out_trade_no=LTZF2022112152152&out_refund_no=TK2022112108508&timestamp=1669518774&refund_fee=0.01&refund_desc=商品已售完&notify_url=https://www.alipay.com&sign=AD38ACEA706F2E46CCD668B8D2DEC57E"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.mch_id String 商户号
示例值:2088610977715791
data.out_trade_no String 商户订单号
示例值:LTZF2022112152152
data.out_refund_no String 商户退款单号
示例值:TK2022112108508
data.order_no String 系统退款单号
示例值:T0202211211841154715996820
msg String 消息
示例值:发起退款成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:9d140542-8b91-9b57-247d-072aaff152dd

成功示例

{
    "code": 0, 
    "data": {
        "mch_id": "2088610977715791", 
        "out_trade_no": "LTZF2022112152152", 
        "out_refund_no": "TK2022112108508", 
        "order_no": "T0202211211841154715996820"
    }, 
    "msg": "发起退款成功", 
    "request_id": "9d140542-8b91-9b57-247d-072aaff152dd"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:退款单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:5cf895b3-80f2-7a3d-14f3-02f970bb345f

失败示例

{
    "code": 1, 
    "msg": "退款单号重复", 
    "request_id": "5cf895b3-80f2-7a3d-14f3-02f970bb345f"
}
查询订单API
商户可以通过查询订单接口主动查询订单状态,完成下一步的业务逻辑。

注意:

  • 此接口请求频率限制:1qps/5s,即5秒钟请求限制为1次。

特别提醒:调用接口前请先在控制台支付宝商户管理修改设置白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/alipay/get_pay_order

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:2088610977715791
out_trade_no String 商户订单号
示例值:LTZF2022112297034
timestamp String 当前时间戳
示例值:1669518774
sign String 签名,数据签名的算法请参考
示例值:4440B462E792B604BD56A37EA41E5B8F

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/alipay/get_pay_order",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=2088610977715791&out_trade_no=LTZF2022112297034&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/alipay/get_pay_order")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=2088610977715791&out_trade_no=LTZF2022112297034&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=2088610977715791&out_trade_no=LTZF2022112297034&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/alipay/get_pay_order", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/alipay/get_pay_order"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "2088610977715791" },
        { "out_trade_no", "LTZF2022112297034" },
        { "timestamp", "1669518774" },
        { "sign", "4440B462E792B604BD56A37EA41E5B8F" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/alipay/get_pay_order"

	payload := strings.NewReader("mch_id=2088610977715791&out_trade_no=LTZF2022112297034&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=2088610977715791&out_trade_no=LTZF2022112297034&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/alipay/get_pay_order");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/alipay/get_pay_order");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "2088610977715791",
  "out_trade_no": "LTZF2022112297034",
  "timestamp": "1669518774",
  "sign": "4440B462E792B604BD56A37EA41E5B8F"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/alipay/get_pay_order"

payload <- "mch_id=2088610977715791&out_trade_no=LTZF2022112297034&timestamp=1669518774&sign=4440B462E792B604BD56A37EA41E5B8F"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.add_time String 下单时间
示例值:2022-11-22 12:03:20
data.mch_id String 商户号
示例值:2088610977715791
data.order_no String 系统订单号
示例值:AL202211221203203584278439
data.out_trade_no String 商户订单号
示例值:LTZF2022112297034
data.pay_no String 支付宝订单号,当支付状态为已支付时返回此参数。
示例值:2022112222001493831431126457
data.body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
data.total_fee String 支付金额
示例值:0.01
data.trade_type String 支付类型,枚举值:
NATIVE:扫码支付
H5:H5支付
APP:APP支付
示例值:NATIVE
data.success_time String 支付完成时间,当支付状态为已支付时返回此参数。
示例值:2022-11-22 12:03:42
data.attach String 附加数据,在支付接口中填写的数据,可作为自定义参数使用。
示例值:自定义数据
data.openid String 支付者信息,当支付状态为已支付时返回此参数。
示例值:vip***@ltzf.cn
data.pay_status Integer 支付状态,枚举值:
0:未支付
1:已支付
示例值:1
msg String 消息
示例值:查询成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:47bfee86-2a6a-5461-bc60-e50e02efd7f1

成功示例

{
    "code": 0, 
    "data": {
        "add_time": "2022-11-22 12:03:20", 
        "mch_id": "2088610977715791", 
        "order_no": "AL202211221203203584278439", 
        "out_trade_no": "LTZF2022112297034", 
        "pay_no": "2022112222001493831431126457", 
        "body": "Image形象店-深圳腾大-QQ公仔", 
        "total_fee": "0.01", 
        "trade_type": "NATIVE", 
        "success_time": "2022-11-22 12:03:42", 
        "attach": "附加数据", 
        "openid": "vip***@ltzf.cn", 
        "pay_status": 1
    }, 
    "msg": "查询成功", 
    "request_id": "47bfee86-2a6a-5461-bc60-e50e02efd7f1"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:签名错误
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:22d3d7f6-0fca-0931-1f17-09e4d41edb6f

失败示例

{
    "code": 1, 
    "msg": "签名错误", 
    "request_id": "22d3d7f6-0fca-0931-1f17-09e4d41edb6f"
}
查询退款结果API
提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,建议在提交退款申请后1分钟发起查询退款状态。

注意:

  • 此接口请求频率限制:1qps/10s,即10秒钟请求限制为1次。

特别提醒:调用接口前请先在控制台支付宝商户管理修改设置白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/alipay/get_refund_order

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 商户号
示例值:2088610977715791
out_refund_no String 商户退款单号
示例值:TK2022112177654
timestamp String 当前时间戳
示例值:1669518774
sign String 签名,数据签名的算法请参考
示例值:951D0E577F797A6DA40FED00FAF49893

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/alipay/get_refund_order",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=2088610977715791&out_refund_no=TK2022112177654&timestamp=1669518774&sign=951D0E577F797A6DA40FED00FAF49893",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/alipay/get_refund_order")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=2088610977715791&out_refund_no=TK2022112177654&timestamp=1669518774&sign=951D0E577F797A6DA40FED00FAF49893")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=2088610977715791&out_refund_no=TK2022112177654&timestamp=1669518774&sign=951D0E577F797A6DA40FED00FAF49893"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/alipay/get_refund_order", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/alipay/get_refund_order"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "2088610977715791" },
        { "out_refund_no", "TK2022112177654" },
        { "timestamp", "1669518774" },
        { "sign", "951D0E577F797A6DA40FED00FAF49893" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/alipay/get_refund_order"

	payload := strings.NewReader("mch_id=2088610977715791&out_refund_no=TK2022112177654&timestamp=1669518774&sign=951D0E577F797A6DA40FED00FAF49893")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=2088610977715791&out_refund_no=TK2022112177654&timestamp=1669518774&sign=951D0E577F797A6DA40FED00FAF49893";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/alipay/get_refund_order");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/alipay/get_refund_order");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "2088610977715791",
  "out_refund_no": "TK2022112177654",
  "timestamp": "1669518774",
  "sign": "951D0E577F797A6DA40FED00FAF49893"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/alipay/get_refund_order"

payload <- "mch_id=2088610977715791&out_refund_no=TK2022112177654&timestamp=1669518774&sign=951D0E577F797A6DA40FED00FAF49893"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data Object 返回数据
data.refund_status Integer 退款状态,枚举值:
0:退款中
1:退款成功
-1:退款失败
示例值:1
data.mch_id String 商户号
示例值:2088610977715791
data.out_trade_no String 商户订单号
示例值:LTZF2022112152152
data.pay_no String 支付宝订单号
示例值:2022112122001493831425507257
data.order_no String 系统退款单号
示例值:T0202211211617189890056919
data.out_refund_no String 商户退款单号
示例值:TK2022112177654
data.refund_fee String 退款金额
示例值:0.01
data.success_time String 退款完成时间,当退款状态为退款成功时返回此参数。
示例值:2022-11-21 16:17:19
msg String 消息
示例值:查询成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:a2fadff9-4498-142b-e1c7-dd4a90abe4da

成功示例

{
    "code": 0, 
    "data": {
        "refund_status": 1, 
        "mch_id": "2088610977715791", 
        "out_trade_no": "LTZF2022112152152", 
        "pay_no": "2022112122001493831425507257", 
        "order_no": "T0202211211617189890056919", 
        "out_refund_no": "TK2022112177654", 
        "refund_fee": "0.01", 
        "success_time": "2022-11-21 16:17:19"
    }, 
    "msg": "查询成功", 
    "request_id": "a2fadff9-4498-142b-e1c7-dd4a90abe4da"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:签名错误
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:22d3d7f6-0fca-0931-1f17-09e4d41edb6f

失败示例

{
    "code": 1, 
    "msg": "签名错误", 
    "request_id": "22d3d7f6-0fca-0931-1f17-09e4d41edb6f"
}
一码付API
蓝兔支付后台系统返回二维码地址,支持微信、支付宝共同扫,将根据用户扫码情况自动调用相关支付接口,需同时签约微信支付和支付宝接口才可以使用。

特别提醒:调用接口前请先在控制台支付宝&微信支付商户管理修改设置白名单域名和白名单IP。


接口说明

适用对象:个人、个体户、企业

请求URL:https://api.ltzf.cn/api/merge/native

请求方式:POST

请求参数
参数名 参数类型 必填 描述
mch_id String 聚合商户号
示例值:1132082680
out_trade_no String 商户订单号,只能是数字、大小写字母_-且在同一个商户号下唯一。
示例值:LTZF2022111211038183
total_fee String 支付金额
示例值:0.01
body String 商品描述
示例值:Image形象店-深圳腾大-QQ公仔
timestamp String 当前时间戳
示例值:1669529706
notify_url String 支付通知地址,通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为http或https地址,回调通知参数请参考
示例值:http://api.test.alipay.net/atinterface/receive_notify.htm
return_url String 回跳地址,支付成功后自动跳转到该地址,跳转不会携带任何参数,如需携带参数请自行拼接。
示例值:https://m.alipay.com/Gk8NF23
type String 返回类型,枚举值:
qrcode_url:蓝兔支付生成的二维码链接地址
link_url:蓝兔支付生成的支付链接,此URL可用于生成支付二维码,然后提供给用户扫码调起支付。
不填写默认qrcode_url
示例值:qrcode_url
attach String 附加数据,在支付通知中原样返回,可作为自定义参数使用。
示例值:自定义数据
time_expire String 订单失效时间,枚举值:
m:分钟
h:小时
取值范围:1m~2h(接口请求后开始计算时间)
示例值:5m
developer_appid String 开发者应用ID
示例值:1041589049015120
sign String 签名,数据签名的算法请参考
示例值:B7337098E280841EB5F4D28261B60C07

请求示例代码

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ltzf.cn/api/merge/native",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "mch_id=1132082680&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07",
  CURLOPT_HTTPHEADER => [
    "content-type: application/x-www-form-urlencoded"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.ltzf.cn/api/merge/native")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("mch_id=1132082680&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")
  .asString();
import http.client

conn = http.client.HTTPSConnection("api.ltzf.cn")

payload = "mch_id=1132082680&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/api/merge/native", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.ltzf.cn/api/merge/native"),
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "mch_id", "1132082680" },
        { "out_trade_no", "LTZF2022111211038183" },
        { "total_fee", "0.01" },
        { "body", "Image形象店-深圳腾大-QQ公仔" },
        { "timestamp", "1669529706" },
        { "notify_url", "http://api.test.alipay.net/atinterface/receive_notify.htm" },
        { "return_url", "https://m.alipay.com/Gk8NF23" },
        { "attach", "自定义数据" },
        { "time_expire", "5m" },
        { "developer_appid", "1041589049015120" },
        { "sign", "B7337098E280841EB5F4D28261B60C07" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.ltzf.cn/api/merge/native"

	payload := strings.NewReader("mch_id=1132082680&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
const data = "mch_id=1132082680&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07";

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ltzf.cn/api/merge/native");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);
const unirest = require("unirest");

const req = unirest("POST", "https://api.ltzf.cn/api/merge/native");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "mch_id": "1132082680",
  "out_trade_no": "LTZF2022111211038183",
  "total_fee": "0.01",
  "body": "Image形象店-深圳腾大-QQ公仔",
  "timestamp": "1669529706",
  "notify_url": "http://api.test.alipay.net/atinterface/receive_notify.htm",
  "return_url": "https://m.alipay.com/Gk8NF23",
  "attach": "自定义数据",
  "time_expire": "5m",
  "developer_appid": "1041589049015120",
  "sign": "B7337098E280841EB5F4D28261B60C07"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
library(httr)

url <- "https://api.ltzf.cn/api/merge/native"

payload <- "mch_id=1132082680&out_trade_no=LTZF2022111211038183&total_fee=0.01&body=Image形象店-深圳腾大-QQ公仔&timestamp=1669529706&notify_url=http://api.test.alipay.net/atinterface/receive_notify.htm&return_url=https://m.alipay.com/Gk8NF23&attach=自定义数据&time_expire=5m&developer_appid=1041589049015120&sign=B7337098E280841EB5F4D28261B60C07"

encode <- "form"

response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)

content(response, "text")
返回参数

成功参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:0
data String 蓝兔支付生成的二维码链接地址
示例值:https://api.ltzf.cn/uploads/QRcode/merge/6724441F73ECA9AA6A52CDD321C36971.png
msg String 消息
示例值:一码付下单成功
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:0c63bacb-ebe2-0708-5b15-024bc7145f45

成功示例

{
    "code": 0, 
    "data": "https://api.ltzf.cn/uploads/QRcode/merge/6724441F73ECA9AA6A52CDD321C36971.png", 
    "msg": "一码付下单成功", 
    "request_id": "0c63bacb-ebe2-0708-5b15-024bc7145f45"
}

失败参数

参数名 参数类型 必填 描述
code Integer 返回状态,枚举值:
0:成功
1:失败
示例值:1
msg String 消息
示例值:商户订单号重复
request_id String 唯一请求ID,每次请求都会返回,定位问题时需要提供该次请求的request_id。
示例值:27a0eec3-9166-32f9-cd0b-f34337d3cee7

失败示例

{
    "code": 1, 
    "msg": "商户订单号重复", 
    "request_id": "27a0eec3-9166-32f9-cd0b-f34337d3cee7"
}

消费者付款资金直接进入您签约的支付宝、微信支付商户号里,支付资金由支付宝、微信支付官方结算,蓝兔支付只负责帮商户代发起支付,避免二次清算带来的风险。

立即使用
微信公众号
协议政策
友情链接

Copyright © 2022-2024 www.ltzf.cn 版权所有 | 
赣ICP备2022004885号 | 
赣公网安备 36070202000768号 | 
支付协会备 W2305041659025045 | 
赣B2-20220234

v3.14.0

在线咨询