ep-open-tool-mini
TypeScript icon, indicating that this package has built-in type declarations

1.1.11 • Public • Published

ep-open-tool-mini

蚂蚁资金业务-小程序 SDK


Usage

依赖安装

npm i ep-open-tool-mini --save

场景使用-因公付

因公付-员工侧支付宝端内签约

仅获取签约地址

import { EntPay } from 'ep-open-tool-mini';

const signUrl = EntPay.Staff.getSignUrl({
  bizSceneCode: '接入时约定的bizSceneCode',
  accountId: '企业的id',
});

自动跳转到支付端内签约页面

import { EntPay } from 'ep-open-tool-mini';

// 跳转员工端签约页面
EntPay.Staff.goToSign({
  bizSceneCode: '接入时约定的bizSceneCode',
  accountId: '企业的id',
});

参数说明

signParam 内容 字段说明 类型 默认值 是否必填
bizSceneCode 接入时约定的 bizSceneCode string
accountId 企业的 id string
returnUrl 签约完成之后的回跳地址 string

支卡通

支卡通-V2

自动跳转到支付端内开通页面

import { ZCard } from 'ep-open-tool-mini';

// 跳转开通页面
ZCard.goToSignV2({
  bizProductCode:'接入时约定的birProductCode',
  bizSceneCode: '接入时约定的bizScene',
  applyToken: '绑定时的token值',
});

参数说明

signParam 内容 字段说明 类型 默认值 是否必填
bizProductCode 接入时约定的 bizProductCode string
bizSceneCode 接入时约定的 bizSceneCode string
subBizSceneCode 接入时约定的 subBizSceneCode string
applyToken 绑定时的 applyToken 值 string
returnUrl 绑定成功回跳链接 string
showResultPage 是否展示结果页 Y | N

自动跳转到支付端内开通页面

import { ZCard } from 'ep-open-tool-mini';

// 跳转开通页面
ZCard.goToSign({
  bizScene: '接入时约定的bizScene',
  bindToken: '绑定时的token值',
});

参数说明

signParam 内容 字段说明 类型 默认值 是否必填
bizScene 接入时约定的 bizScene string
bindToken 绑定时的 token 值 string
returnUrl 绑定成功回跳链接 string
showResultPage 是否展示结果页 Y | N

通用场景钱包

场景钱包-支付宝端内签约

自动跳转到支付端内签约页面(推荐)

import { SceneWallet } from 'ep-open-tool-mini';

// 跳转场景钱包端签约页面
SceneWallet.goToSign({
  bizScene: '接入时约定的bizScene',
  bindToken: '绑定凭证',
});

仅获取签约地址

import { SceneWallet } from 'ep-open-tool-mini';

const signUrl = SceneWallet.getSignUrl({
  bizScene: '接入时约定的bizScene',
  bindToken: '绑定凭证',
});

方法参数说明

signParam 内容 字段说明 类型 默认值 是否必填
bizScene 接入时约定的 bizScene string
bindToken 绑定凭证 string
returnUrl 回跳链接 string
skipResult 跳过结果页 Y | N

网商场景钱包

网商场景钱包-支付宝端内签约

自动跳转到支付端内签约页面(推荐)

import { MYBankSceneWallet } from 'ep-open-tool-mini';

// 跳转网商场景钱包端签约页面
MYBankSceneWallet.goToSign({
  bizScene: '接入时约定的bizScene',
  bindToken: '绑定凭证',
});

仅获取签约地址

import { MYBankSceneWallet } from 'ep-open-tool-mini';

const signUrl = MYBankSceneWallet.getSignUrl({
  bizScene: '接入时约定的bizScene',
  bindToken: '绑定凭证',
});

方法参数说明

signParam 内容 字段说明 类型 默认值 是否必填
bizScene 接入时约定的 bizScene string
bindToken 绑定凭证 string
returnUrl 回跳链接 string
skipResult 跳过结果页 Y | N

常见问题 FAQ

1.使用 npm 包报错

遇到 The keyword 'const' is reserved 如下的报错?

The keyword 'const' is reserved

解决:项目中的 mini.project.json 中保证 enableNodeModuleBabelTransform 配置开关为 true mini.project.json修改

2.returnUrl 支持那些类型?

当前支持的跳转链接需要满足下面的格式之一: 1.需要是 https://开头域名链接地址; 2.需要是 alipays://开头的支付宝小程序链接

需要保证传入的 returnUrl 链接能够有效访问,可以通过草料二维码转换成二维码,支付宝扫码验证是否能打开;

3.returnUrl 无法正常跳转

⚠️⚠️⚠️ 注意: 1.整体 returnUrl 不需要额外的 encode,SDK 内部已经处理过了; 2.如果是跳转地址的链接需要 url 中有页面参数,则需要自己 encode 拼接好;比如跳转小程序的 pages/index/index 页面想带参数,则需要:'alipays://platformapi/startapp?appId=2021003126648243&page='+ encodeURIComponent('pages/index/index?参数 key=参数 value')

Readme

Keywords

none

Package Sidebar

Install

npm i ep-open-tool-mini

Weekly Downloads

3

Version

1.1.11

License

MIT

Unpacked Size

77.8 kB

Total Files

19

Last publish

Collaborators

  • zanseven007
  • skyadmin
  • maybe0630