1.1.4 • Published 4 years ago

alipay-sdk-node v1.1.4

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

alipay-sdk-node

All Contributors

Build Status JavaScript Style Guide

npm download Total visitors Visitors in today


Install

 $ npm install alipay-sdk-node --save

Usage

Create Alipay Instance

e.g.

  const Alipay = require('alipay-sdk-node')

  /**
   *  @param app_id required
   *  @param app_private_key required
   *  @param alipay_public_key required
   *  @param notify_url required
   *  @param return_url optional, for wap pay
   *  @param sign_type optional, default is RSA2
   *  @param base_url optional, default is 'https://openapi.alipay.com/gateway.do'
   *  @param cache optional, whether cache the alipay instance or not
   * /
  const alipay = new Alipay({
    app_id: 'xxx',
    app_private_key: fs.readFileSync('filePath'),
    alipay_public_key: fs.readFileSync('filePath'),
    notify_url: 'xxx',
    sign_type: 'RSA2',
    base_url: 'https://openapi.alipaydev.com/gateway.do',
    return_url: 'xxx',
    cache: false
  })

WAP pay click

  • #getWapPageUrl(bizContent[,publicParams]): get the url of wap pay
  • params: bizContent { JSON: required }
  • params: publicParams { JSON: optional }, override the public params
  • return: String

e.g.

  alipay.getWapPageURL({
    subject: 'xxx',
    out_trade_no: 'xxx',
    total_amount: 'xxx',
    product_code: 'xxx'
  }, { return_url: 'http://xxx.com/orders/result/{id}' })

APP Pay click

  • #getOrderInfoStr(bizContent[,publicParams]): get the string of order info
  • params: bizContent {JSON: required}
  • params: publicParams { JSON: optional }, override the public params
  • return: String

e.g.

  alipay.getOrderInfoStr({
    subject: 'xxx',
    out_trade_no: 'xxx',
    total_amount: 'xxx',
    product_code: 'xxx'
  })

Check sign click

  • #rsaCheck(options): check sign
  • params: request body {JSON}
  • return: Boolean

e.g.

  alipay.rsaCheck(request.body)

Refund click

  • #refund(bizContent[,callback]): refund api
  • params: bizContent {JSON}
  • return: Promise Or Callback

e.g.

  alipay.refund({
    out_trade_no: 'xxx',
    trade_no: 'xxx',
    refund_amount: 'xxx',
    out_request_no: 'xxx',
    refund_reason: 'xxx'
  })

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.1

7 years ago