feat: 添加支付宝SDK
This commit is contained in:
@@ -1,37 +1,27 @@
|
||||
/**
|
||||
* Sample React Native App
|
||||
*
|
||||
* adapted from App.js generated by the following command:
|
||||
*
|
||||
* react-native init example
|
||||
*
|
||||
* https://github.com/facebook/react-native
|
||||
*/
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { Platform, StyleSheet, Text, View } from 'react-native';
|
||||
import { Button, StyleSheet, Text, View } from 'react-native';
|
||||
import Alipay from 'react-native-uiwjs-alipay';
|
||||
|
||||
export default class App extends Component<{}> {
|
||||
state = {
|
||||
status: 'starting',
|
||||
message: '--'
|
||||
};
|
||||
export default class App extends Component {
|
||||
componentDidMount() {
|
||||
Alipay.sampleMethod('Testing', 123, (message) => {
|
||||
this.setState({
|
||||
status: 'native callback received',
|
||||
message
|
||||
});
|
||||
Alipay.setAlipayScheme('ap2021001172656340');
|
||||
}
|
||||
aliPay = () => {
|
||||
const payInfo = 'app_id=2021001172656340&biz_content=%7B%22timeout_express%22%3A%2230m%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22total_amount%22%3A%220.01%22%2C%22subject%22%3A%221%22%2C%22body%22%3A%22%E6%88%91%E6%98%AF%E6%B5%8B%E8%AF%95%E6%95%B0%E6%8D%AE%22%2C%22out_trade_no%22%3A%22IQJZSRC1YMQB5HU%22%7D&charset=utf-8&format=json&method=alipay.trade.app.pay¬ify_url=http%3A%2F%2Fdomain.merchant.com%2Fpayment_notify&sign_type=RSA2×tamp=2016-08-25%2020%3A26%3A31&version=1.0&sign=cYmuUnKi5QdBsoZEAbMXVMmRWjsuUj%2By48A2DvWAVVBuYkiBj13CFDHu2vZQvmOfkjE0YqCUQE04kqm9Xg3tIX8tPeIGIFtsIyp%2FM45w1ZsDOiduBbduGfRo1XRsvAyVAv2hCrBLLrDI5Vi7uZZ77Lo5J0PpUUWwyQGt0M4cj8g%3D';
|
||||
Alipay.alipay(payInfo, (resule) => {
|
||||
console.log(res)
|
||||
});
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.welcome}>☆Alipay example☆</Text>
|
||||
<Text style={styles.instructions}>STATUS: {this.state.status}</Text>
|
||||
<Text style={styles.welcome}>☆NATIVE CALLBACK MESSAGE☆</Text>
|
||||
<Text style={styles.instructions}>{this.state.message}</Text>
|
||||
<Text style={styles.welcome}>☆Alipay Example☆</Text>
|
||||
<Button
|
||||
onPress={this.aliPay}
|
||||
title="支付宝支付"
|
||||
color="#841584"
|
||||
accessibilityLabel="Learn more about this purple button"
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user