Skip to content

Commit afa8dee

Browse files
committed
feat: Add setAlipaySandbox props.
1 parent e91767e commit afa8dee

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import Alipay from 'react-native-uiwjs-alipay';
2525
// 设置 支付宝 URL Schemes
2626
// scheme = `ap` + `APPID`
2727
Alipay.setAlipayScheme(scheme);
28+
// 设置支付宝沙箱环境
29+
Alipay.setAlipaySandbox(isSandbox);
2830
// 支付宝 iOS 端的支付
2931
// payInfo 是后台拼接好的支付参数
3032
Alipay.alipay(payInfo, (res)=>console.log(res))

index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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

5964
export default Alipay;

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)