Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

alipay-sdk

3.1.1 • Public • Published

Alipay SDK

蚂蚁金服开放平台 SDK

NPM version build status Test coverage

安装

npm install alipay-sdk

使用

// TypeScript
import AlipaySdk from 'alipay-sdk';
// 普通公钥模式
const alipaySdk = new AlipaySdk({
  // 参考下方 SDK 配置
  appId: '2016123456789012',
  privateKey: fs.readFileSync('./private-key.pem', 'ascii'),
});
// 证书模式
const alipaySdk = new AlipaySdk({
  // 参考下方 SDK 配置
  appId: '2016123456789012',
  privateKey: fs.readFileSync('./private-key.pem', 'ascii'),
  alipayRootCertPath: path.join(__dirname,'../fixtures/alipayRootCert.crt'),
  appCertPath: path.join(__dirname,'../fixtures/appCertPublicKey.crt'),
  alipayPublicCertPath: path.join(__dirname,'../fixtures/alipayCertPublicKey_RSA2.crt'),
});

const result = await alipaySdk.exec('alipay.system.oauth.token', {
    grantType: 'authorization_code',
    code: 'code',
    refreshToken: 'token'
});

Demo:

Keywords

none

Install

npm i alipay-sdk

DownloadsWeekly Downloads

581

Version

3.1.1

License

ISC

Unpacked Size

58.1 kB

Total Files

26

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar