Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PubScanPay

刷卡支付

const pay = new PubScanPay({
  appId: "wxb80e5bddb2d804f3",
  key: "6Q9VX4N3WTBM9G9XBL7H1L9PB9ANHLY7",
  mchId: "1434712502",
  pfx: fs.readFileSync(path.resolve(__dirname, "cert.p12"))
});
see

https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=5_1

Hierarchy

Index

Constructors

constructor

Properties

appId

appId: string

公众账号ID

debug

debug: boolean = false

仿真模式开关

key

key: string

密钥

keyForDebug

keyForDebug: string

测试用验签密钥

mchId

mchId: string

商户号

pfx

pfx: Buffer

证书

Methods

authCodeToOpenId

batchQueryComment

Protected completeURL

  • completeURL(base: string): string

Protected createFetchOptions

  • createFetchOptions(url: string, usePfx?: boolean): Promise<FetchOptions>

downloadBill

downloadFundFlow

Protected getKey

  • getKey(): string

microPay

orderQuery

refund

refundNotify

  • refundNotify(baseData: RefundNotifyBase, handler: types.RefundNotifyHandler): Promise<string>
  • 退款结果通知处理

    router.post("/wechatpay/notify/refund", (req, res) => {
      getXMLBody(req, options).then(data => {
        pay
          .refundNotify(data, async parsedData => {
            if (!pay.verifySign(parsedData)) {
              // 签名校验失败
            }
            if (parsedData.result_code === "FAIL") {
              // 业务逻辑失败
            }
            // ...
            return {
              return_code: "SUCCESS",
              return_msg: "OK"
            };
          })
          .then(returnData => {
            res.set("Content-Type", "application/xml; charset=utf-8");
            res.end(returnData);
          });
      });
    });
    see

    https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_16&index=11

    Parameters

    Returns Promise<string>

refundQuery

report

reverse

setDebug

  • setDebug(useDebug: boolean): Promise<void>

shortURL

verifySign

  • verifySign(data: object, signType?: SignType): boolean

Generated using TypeDoc