-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDemo.js
More file actions
50 lines (44 loc) · 1.15 KB
/
Demo.js
File metadata and controls
50 lines (44 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
// 1000 Rai = 0.001 XRB
import NanoPayment from './src/NanoPayment';
export default class Demo extends Component {
state = {
destination:
'xrb_3uwehdksj643ngheidkpq5gyz9khutfse8ihbjey7yub5fatkqciukrmwz63',
amount: 1000,
currency: 'rai',
};
_onSuccess = details => {
let sampleUrl = 'https://brainblocks.io/api/session/${token}/verify';
window.alert(`
I should now verify serverside with this token ${details.token}.
i.e. ${sampleUrl}
`);
};
_onFailure = message => {
window.alert(`Payment failed: ${message}`);
};
render() {
return (
<View style={styles.container}>
<NanoPayment
amount={this.state.amount}
autoplay={true}
currency={this.state.currency}
destination={this.state.destination}
onFailure={this._onFailure}
onSuccess={this._onSuccess}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
},
});