蚂蚁金服开放平台 SDK
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 result = await alipaySdk.exec('alipay.system.oauth.token', {
grantType: 'authorization_code',
code: 'code',
refreshToken: 'token'
});