# 支付

  1. 点击开通支付宝js支付 (opens new window)

  2. 开发文档 (opens new window)

效果浏览 alt text

nodejs demo

// 这个在最外面申明公共方法即可
const alipaySdk = new AlipaySdk.AlipaySdk({
    appId,
    privateKey,
    alipayPublicKey,
});
// 结束


 const obj = this.post()
        const result = await alipaySdk.exec("alipay.trade.create", {
            bizContent: {
                out_trade_no: 'my' + this.randomString(50),
                total_amount: obj.xianjia,
                subject: obj.title,
                product_code: "JSAPI_PAY",
                op_app_id: appId,
                buyer_open_id: this.openid,
                op_buyer_open_id: this.openid
            },
        });
        this.success(result)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23