@greensoul/expo-native-wechat
v0.5.0
Published
A Expo Module for supporting Wechat APIs on Android and iOS (forked with openBusinessView support)
Maintainers
Readme
@greensoul/expo-native-wechat
Fork of expo-native-wechat with added
openBusinessViewsupport.
A Expo Module for supporting Wechat APIs on Android and iOS.
Features
- WeChat Login (Authorization)
- Share (Text, Image, Video, Webpage, MiniProgram)
- WeChat Pay
- Launch MiniProgram
- Customer Service
- Subscribe Message
- openBusinessView (NEW) - Generic interface for all business types
Installation
pnpm add @greensoul/expo-native-wechatConfiguration
app.json
{
"expo": {
"scheme": ["wxYOUR_APP_ID"],
"ios": {
"associatedDomains": ["applinks:your-domain.com"],
"infoPlist": {
"LSApplicationQueriesSchemes": ["weixin", "weixinULAPI", "weixinURLParamsAPI"]
}
},
"plugins": ["@greensoul/expo-native-wechat"]
}
}Usage
Register App
import { registerApp } from '@greensoul/expo-native-wechat';
// Register on app start
await registerApp({
appid: 'wxYOUR_APP_ID',
universalLink: 'https://your-domain.com/app/',
});openBusinessView (New Feature)
Generic interface for opening WeChat business views.
import { openBusinessView } from '@greensoul/expo-native-wechat';
// Example: Open enterprise payment
const result = await openBusinessView({
businessType: 'mp_business_type',
query: 'token=xxx',
});
// Example: Open payment score detail
const result = await openBusinessView({
businessType: 'wxpayScoreDetail',
query: 'mch_id=xxx&service_id=xxx&out_order_no=xxx&...',
});Supported businessType
| businessType | Description |
|-------------|-------------|
| mp_business_type | Enterprise Payment |
| wxpayScoreDetail | Payment Score Detail |
| wxpayScoreEnable | Payment Score Authorization |
| wxpayCouponUse | Coupon |
| wxpayCardMember | Member Card |
Differences from upstream
- Added generic
openBusinessViewinterface - Fixed Android SDK version to
6.8.31(stable version, not SNAPSHOT) - Package renamed to
@greensoul/expo-native-wechat
License
MIT - Original work by Héctor Chong
