File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ import Alipay from 'react-native-uiwjs-alipay';
2525// 设置 支付宝 URL Schemes
2626// scheme = `ap` + `APPID`
2727Alipay .setAlipayScheme (scheme);
28+ // 设置支付宝沙箱环境
29+ Alipay .setAlipaySandbox (isSandbox);
2830// 支付宝 iOS 端的支付
2931// payInfo 是后台拼接好的支付参数
3032Alipay .alipay (payInfo, (res )=> console .log (res))
Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ export const Alipay: {
5454 * @param scheme scheme = `ap` + `APPID`
5555 */
5656 setAlipayScheme : ( scheme : string ) => void ;
57+ /**
58+ * 设置支付宝沙箱环境,仅 Android
59+ * @param isSandBox
60+ */
61+ setAlipaySandbox : ( isSandbox : boolean ) => void ;
5762} ;
5863
5964export default Alipay ;
Original file line number Diff line number Diff line change @@ -20,4 +20,14 @@ export default class Alipay {
2020 NativeModules . Alipay . setAlipayScheme ( scheme ) ;
2121 }
2222 }
23+
24+ /**
25+ * 设置支付宝沙箱环境,仅 Android
26+ * @param isSandBox
27+ */
28+ static setAlipaySandbox ( isSandbox ) {
29+ if ( Platform . OS === 'android' ) {
30+ NativeModules . Alipay . setAlipaySandbox ( isSandBox ) ;
31+ }
32+ }
2333}
You can’t perform that action at this time.
0 commit comments