/*
* opt {String} 传入密文
*/
export function wxpay(opt) {
const form = document.createElement('form')
const textarea = document.createElement('input');
const button = document.createElement('button')
form.setAttribute('action', 'https://api.minpayment.com/pay.do');
form.setAttribute('method', 'post');
form.setAttribute('id', 'formid');
textarea.setAttribute('name', 'sendMsg');
textarea.setAttribute('value', opt);
button.setAttribute('type', 'submit');
button.setAttribute('id', 'submit');
/* 此处form就是后台返回接收到的数据 */
document.body.appendChild(form)
form.appendChild(textarea);
form.appendChild(button);
var submit=document.getElementById("submit");
submit.click(); // 自动提交按钮
}
h5支付返回密文请求支付端接口写法(支付宝、银联等),跳转到支付页面
微信支付JS模拟提交
最新推荐文章于 2025-01-03 22:11:11 发布
本文介绍了一种使用JavaScript模拟微信支付请求的方法。通过创建表单元素,并自动触发提交过程,可以实现网页端调用微信支付接口的功能。具体步骤包括构建表单、设置请求地址及方法、添加密文输入字段等。

4853

被折叠的 条评论
为什么被折叠?



