微信商户单号是什么怎样复制

微信通过交易单号怎么查红包发给谁_百度知道
微信通过交易单号怎么查红包发给谁
可以打开特定的“红包详情”就可以知道了;在“发出的红包”界面上,选择“发出的红包”,具体步骤如下.jpg" esrc="http:登录手机微信.com/zhidao/pic/item/de9c82a9fce4bd6b62.baidu,点击“我”.hiphotos.baidu。<img class="ikqb_img" src="/zhidao/wh%3D450%2C600/sign=b031f941aa4bd6f9f9b3de9c82a9fce4bd6b62://a.com/zhidao/wh%3D600%2C800/sign=e6f527bae5bf5a3e8d109b3de9c82a9fce4bd6b62://a.baidu
其他类似问题
为您推荐:
其他1条回答
点开发的红包就能看到谁抢到了
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁微信公众号支付(二):统一下单
上一篇已经获取到了用户的OpenId
这篇主要是调用微信公众支付的统一下单API
API地址:https://pay./wiki/doc/api/jsapi.php?chapter=9_1
看文档,主要流程就是把20个左右的参数封装为XML格式发送到微信给的接口地址,然后就可以获取到返回的内容了,如果成功里面就有支付所需要的预支付ID
请求参数就不解释了。
其中,随机字符串:我用的是UUID去中划线
public static String create_nonce_str() {
return UUID.randomUUID().toString().replace(&-&,&&);
商户订单号:每个订单号只能使用一次,所以用的是的订单号加的时间戳。
总金额:不能为0
通知地址:微信支付成功或失败回调给系统的地址
import java.io.S
public class PayInfo
implements Serializable{
private static final long serialVersionUID = 4222380L;
private String mch_
private String device_
private String nonce_
private String out_trade_
private int total_
private String spbill_create_
private String notify_
private String trade_
//下面是get,set方法
* 创建统一下单的xml的java对象
* @param bizOrder 系统中的业务单号
* @param ip 用户的ip地址
* @param openId 用户的openId
public PayInfo createPayInfo(BizOrder bizOrder,String ip,String openId) {
PayInfo payInfo = new PayInfo();
payInfo.setAppid(Constants.appid);
payInfo.setDevice_info(&WEB&);
payInfo.setMch_id(Constants.mch_id);
payInfo.setNonce_str(CommonUtil.create_nonce_str().replace(&-&, &&));
payInfo.setBody(&这里是某某白米饭的body&);
payInfo.setAttach(bizOrder.getId());
payInfo.setOut_trade_no(bizOrder.getOrderCode().concat(&A&).concat(DateFormatUtils.format(new Date(), &MMddHHmmss&)));
payInfo.setTotal_fee((int)bizOrder.getFeeAmount());
payInfo.setSpbill_create_ip(ip);
payInfo.setNotify_url(Constants.notify_url);
payInfo.setTrade_type(&JSAPI&);
payInfo.setOpenid(openId);
return payI
获取签名:
* 获取签名
* @param payInfo
* @throws Exception
public String getSign(PayInfo payInfo) throws Exception {
String signTemp = &appid=&+payInfo.getAppid()
+&&attach=&+payInfo.getAttach()
+&&body=&+payInfo.getBody()
+&&device_info=&+payInfo.getDevice_info()
+&&mch_id=&+payInfo.getMch_id()
+&&nonce_str=&+payInfo.getNonce_str()
+&&notify_url=&+payInfo.getNotify_url()
+&&openid=&+payInfo.getOpenid()
+&&out_trade_no=&+payInfo.getOut_trade_no()
+&&spbill_create_ip=&+payInfo.getSpbill_create_ip()
+&&total_fee=&+payInfo.getTotal_fee()
+&&trade_type=&+payInfo.getTrade_type()
+&&key=&+Constants. //这个key注意
MessageDigest md5 = MessageDigest.getInstance(&MD5&);
md5.reset();
md5.update(signTemp.getBytes(&UTF-8&));
String sign = CommonUtil.byteToStr(md5.digest()).toUpperCase();
注意:上面的Constants.key取值在商户号API安全的API密钥中。
一些工具方法:获取ip地址,将字节数组转换为十六进制字符串,将字节转换为十六进制字符串
/** * 将字节数组转换为十六进制字符串 * * @param byteArray * @return */ public static String byteToStr(byte[] byteArray) { String strDigest = &&; for (int i = 0; i & byteArray. i++) { strDigest += byteToHexStr(byteArray[i]); } return strD } /** * 将字节转换为十六进制字符串 * * @param btyes * @return */ public static String byteToHexStr(byte bytes) { char[] Digit = { &#39;0&#39;, &#39;1&#39;, &#39;2&#39;, &#39;3&#39;, &#39;4&#39;, &#39;5&#39;, &#39;6&#39;, &#39;7&#39;, &#39;8&#39;, &#39;9&#39;, &#39;A&#39;, &#39;B&#39;, &#39;C&#39;, &#39;D&#39;, &#39;E&#39;, &#39;F&#39; }; char[] tempArr = new char[2]; tempArr[0] = Digit[(bytes &&& 4) & 0X0F]; tempArr[1] = Digit[bytes & 0X0F]; String s = new String(tempArr); } /** * 获取ip地址 * @param request * @return */ public static String getIpAddr(HttpServletRequest request) { InetAddress addr = try { addr = InetAddress.getLocalHost(); } catch (UnknownHostException e) { return request.getRemoteAddr(); } byte[] ipAddr = addr.getAddress(); String ipAddrStr = &&; for (int i = 0; i & ipAddr. i++) { if (i & 0) { ipAddrStr += &.&; } ipAddrStr += ipAddr[i] & 0xFF; } return ipAddrS }
这样就获取了签名,把签名与PayInfo中的其他数据转成XML格式,当做参数传递给统一下单地址。
PayInfo pi = pu.createPayInfo(bo,&10.204.3.32&,&22&);
String sign = pu.getSign(pi);
pi.setSign(sign);
* 扩展xstream使其支持CDATA
private static XStream xstream = new XStream(new XppDriver() {
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
//增加CDATA标记
boolean cdata =
@SuppressWarnings(&rawtypes&)
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write(&&![CDATA[&);
writer.write(text);
writer.write(&]]&&);
writer.write(text);
public static String payInfoToXML(PayInfo pi) {
xstream.alias(&xml&, pi.getClass());
return xstream.toXML(pi);
@SuppressWarnings(&unchecked&)
public static Map&String, String& parseXml(String xml) throws Exception {
Map&String, String& map = new HashMap&String, String&();
Document document = DocumentHelper.parseText(xml);
Element root = document.getRootElement();
List&Element& elementList = root.elements();
for (Element e : elementList)
map.put(e.getName(), e.getText());
下面就是调用统一下单的URL了
  (MessageUtil.payInfoToXML(pi).replace(&__&, &_&));
  Map map = CommonUtil.httpsRequestToXML(&https://api.mch./pay/unifiedorder&, &POST&, MessageUtil.payInfoToXML(pi).replace(&__&, &_&).replace(&&, &&));
public static Map&String, String& httpsRequestToXML(String requestUrl, String requestMethod, String outputStr) {
Map&String, String& result = new HashMap&&();
StringBuffer buffer = httpsRequest(requestUrl, requestMethod, outputStr);
result = MessageUtil.parseXml(buffer.toString());
} catch (ConnectException ce) {
log.error(&连接超时:&+ce.getMessage());
} catch (Exception e) {
log.error(&https请求异常:&+ece.getMessage());
httpsRequest()这个方法在第一篇中
上面获取到的Map如果成功的话,里面就会有
String return_code = map.get(&return_code&);
if(StringUtils.isNotBlank(return_code) && return_code.equals(&SUCCESS&)){
  String return_msg = map.get(&return_msg&);
if(StringUtils.isNotBlank(return_msg) && !return_msg.equals(&OK&)) {
  return &统一下单错误!&;
  return &统一下单错误!&;
String prepay_Id = map.get(&prepay_id&);
这个prepay_id就是预支付的ID。后面支付需要它。
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'微信支付里的商户单号有什么用_百度知道
微信支付里的商户单号有什么用
您的回答被采纳后将获得:
系统奖励20(财富值+经验值)+难题奖励20(财富值+经验值)
我有更好的答案
就是你的交易流水号
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁实用&|微信下单后,怎样查到快递单号?
请注意,本文仅适用于购买《科学世界》的读者!发货说明当天下单,正常情况下第二天就发货。周五下午、周六、周日下单,统一下一个周一发货。发货后,北京同城快递2天左右,外省3~4天即可收到。如果您下单后超过一周还没有收到杂志,请拨打发行部电话010-查询。微信下单后,怎样查到快递单号呢?按照下面的步骤操作,很快就能get啦!如何查询“科学世界”微信订单的快递单号?请关注我们的服务号“科学世界杂志”,微信号:kexueshijie,或者可以长按下方二维码。这样,如果小伙伴购买了杂志,发行部的同事在发出快递后会到微信后台点击“发货”并输入单号,我们的服务号就自动将快递单号推送到你的手机上啦。是不是很方便!(由于订单量巨大,单号更新可能会稍稍延迟,请耐心等待)但是,请注意!如果小伙伴订阅的是全年杂志,通过服务号就只能收到第1期的单号!为什么呢?因为微信后台只给每个订单设置了一次“发货”按钮,所以我们只能点击一次:( 不过不要担心,我们每期都会及时给大家发出的!所以,如果你订阅的是全年杂志,希望得到每一期的单号,可以拨打杂志社发行部电话:010-。请注意,如果你在月初还没有收到当月杂志,请及时联系我们。最后,感谢大家对《科学世界》的热爱,我们会把更多更好的内容呈现给大家的!有交易单号和商户单号怎么查询?_百度知道
有交易单号和商户单号怎么查询?
我有更好的答案
您好,您提供一下订单号或手机号码我们帮您查询物流信息,或添加买卖宝商城的微信公众账号(maimaibaomall)发送手机号码即可查询包裹投递情况。
其他类似问题
为您推荐:
您可能关注的推广
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 微信商户单号查询 的文章

 

随机推荐