网页端调用支付宝

https://blog.csdn.net/weixin_41003211/article/details/78541735

var prodConfig = {
  "body": "body",
  "subject": "daledou",
  "out_trade_no": "70501111111S001111110",
  "timeout_express": "90m",
  "total_amount": 9.00,
  "product_code": "QUICK_WAP_WAY"
}
var alipayConfig = {
  biz_content: JSON.stringify(prodConfig),
  app_id: '自己的appid',
  version: '1.0',
  format: 'json',
  sign_type: 'RSA2',
  method: 'alipay.trade.wap.pay',
  notify_url: 'http://***/alipy/notify_url.php',
  return_url: 'http://***/alipy/return_url.php',
  charset: 'UTF-8',
  sign:   'L3quItR9hqIfsgjZVqDO/L8k5dmdSSn7KCQcHMRsZl0yzFa9im5Ge/ZXZh1sIo+fqr5zJkUUYmZknERw+iPiiNt/w0VLKPzjgzL4afoQ4oS5vnD8SzdccA9C1E5GxjvJCXGseeciQpyNkMmvXwTcL7egS4ukn2dAV0lpcM8KNPJdi+1HlWgAlnFT0Xq6Kqs24GD+Fd4ogpXoWOa3HfSjY1+DY+7FwKyunTvR9isN/kRIckW887GE2Dy2jRSghhANrf47f54SDMu+UcuRsNfxsgwfSTiafTW1q8Eym/2G7PBOWnI0I5llD7bs9Qu3zB/b+IpLlkEa0jUNj1rXgvkjww==',
  timestamp: '2017-11-15 14:55:46'
}
function to() {
  httpPost('https://openapi.alipaydev.com/gateway.do', alipayConfig)
}
function httpPost(URL, PARAMS) {
  var temp = document.createElement("form");
  temp.action = URL;
  temp.method = "post";
  temp.style.display = "none";

  or (var x in PARAMS) {
    var opt = document.createElement("textarea");
    opt.name = x;
    opt.value = PARAMS[x];
    temp.appendChild(opt);
  }

  document.body.appendChild(temp);
  temp.submit();

  return temp;
}

猜你喜欢

转载自www.cnblogs.com/lmxxlm-123/p/8888409.html