alipay-cloud-sdk-test
v1.17.0
Published
Alipay Cloud SDK for Test
Downloads
65
Readme
Alipay Cloud SDK
Serverless 云端调用 - 支付宝开放平台
Installation 安装
npm install alipay-cloud-sdk --save
npm install @alicloud/mpserverless-sdk --save
alipay-cloud-sdk
依赖@alicloud/mpserverless-sdk
,使用时需要传入 mpserverless-sdk 实例进行初始化
Usage 使用示例
// 1. 引入必要的 sdk
import MiniProgram from '@alicloud/mpserverless-sdk';
import cloud from 'alipay-cloud-sdk';
// 2. 在 app.js 中对 sdk 进行初始化
// 2.1 初始化 mpserverless
const mpserverless = new MiniProgram(my, {
// 参数能在小程序云服务空间详情中获取
appId: '',
spaceId: '',
endpoint: '',
clientSecret: '',
});
// 2.3 初始化 alipay-cloud-sdk
cloud.init(mpserverless, {});
// 3. 在想要使用的页面导入 alipay-cloud-sdk 即可使用
// 比如在 page.js
import cloud from 'alipay-cloud-sdk';
cloud.base.createQrcode(urlParam, queryParam, describe);
API 接口列表
cloud.init() 初始化
cloud.init(mpserverless, {
// 配置此参数后,拥有回调消息的 openapi 将回调该地址
notify: {
url: 'https://callback',
},
})
cloud.aliyun 阿里云能力
短信
cloud.aliyun.sendSms(phoneNumbers: string, signName: string, templateCode: string)
cloud.aliyun.sendBatchSms(phoneNumberJson: object, signNameJson: object, templateCode: string, templateParamJson: object)
cloud.aliyun.querySms(phoneNumber: string, sendDate: string, pageSize: number, currentPage: number)
cloud.aliyun.querySmsWithBizId(phoneNumber: string, sendDate: string, pageSize: number, currentPage: number, bizId: string)
cloud.base 通用基础能力
用户授权
cloud.base.getOAuthToken(code: string)
cloud.base.getOAuthTokenWithAuthCode(code: string)
cloud.base.getOAuthTokenWithRefreshToken(refreshToken: string)
小程序二维码
cloud.base.createQrcode(urlParam: string, queryParam: string, describe: string)
cloud.fund 资金能力
授权
cloud.fund.freezeAuth(outOrderNo: string, outRequestNo: string, orderTitle: string, amount: string, payeeUserId: string)
cloud.fund.unfreezeAuth(authNo: string, outRequestNo: string, amount: string, remark: string)
cloud.fund.payTrade(subject: string, outTradeNo: string, totalAmount: string, authCode: string)
cloud.fund.cancelAuth(authNo: string, outOrderNo: string, outRequestNo: string, remark: string)
cloud.fund.queryAuth(authNo: string, outOrderNo: string, outRequestNo: string)
转账
cloud.fund.transfer(outBizNo: string, transAmount: string, productCode: string, orderTitle: string, payee_Info: Participant)
cloud.fund.queryTransfer(productCode: string, payFundOrderId: string)
cloud.fund.queryAccount(alipayUserId: string)
红包
cloud.fund.redpacketTransfer(params: object)
cloud.marketing 营销能力
小程序模板消息
cloud.marketing.sendTemplateMessage(toUserId: string, formId: string, userTemplateId: string, page: string, data: string)
cloud.member 会员能力
支付宝身份认证
cloud.member.initializeUserCertify(outerOrderNo: string, bizCode: string, identityParam: UserCertifyParam, merchantConfig: UserCertifyMerchantConfig)
cloud.member.userCertify(certifyId: string)
cloud.member.queryUserCertify(certifyId: string)
cloud.payment 支付能力
通用能力
cloud.payment.createTrade(subject: string, outTradeNo: string, totalAmount: string, buyerId: string)
cloud.payment.queryTrade(tradeNo: string)
cloud.payment.refundTrade(outTradeNo: string, refundAmount: string, outRequestNo: string, refundReason: string)
// cloud.payment.closeTrade()
// cloud.payment.cancelTrade()
花呗分期
cloud.payment.createHuabeiTrade(subject: string, outTradeNo: string, totalAmount: string, buyerId: string, huabeiConfig: HuabeiConfig)
当面付
// cloud.payment.payFaceToFaceTrade()
cloud.security 安全能力
文本风险识别
cloud.security.detectRiskContent(content: string);