Open harikanammi opened 6 years ago
Hi, i am using this module in sample app. But i am getting error page like below image. Please give me any suggestion. Thankyou. here is my code:
import React, { Component } from 'react' import { Platform, StyleSheet, Text, View, DeviceEventEmitter, NativeModules, NativeEventEmitter, TouchableOpacity } from 'react-native' import paytm from 'react-native-paytm' const instructions = Platform.select({ ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', android: 'Double tap R on your keyboard to reload,\n' + 'Shake or press menu button for dev menu' }) const paytmConfig = { MID: 'sample123456', WEBSITE: 'APP_STAGING', CHANNEL_ID: 'APP', INDUSTRY_TYPE_ID: 'Retail', CALLBACK_URL: 'https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=' } type Props = {} export default class App extends Component<Props> { componentWillMount() { if (Platform.OS == 'ios') { const { RNPayTm } = NativeModules const emitter = new NativeEventEmitter(RNPayTm) emitter.addListener('PayTMResponse', this.onPayTmResponse) } else { DeviceEventEmitter.addListener('PayTMResponse', this.onPayTmResponse) } } onPayTmResponse(response) { alert('RESPONSE') // Process Response // response.response in case of iOS // reponse in case of Android console.log(response) } runTransaction(amount, customerId, orderId, mobile, email, checkSum) { const callbackUrl = `${paytmConfig.CALLBACK_URL}${150}` const details = { mode: 'Staging', mid: paytmConfig.MID, industryType: paytmConfig.INDUSTRY_TYPE_ID, website: paytmConfig.WEBSITE, channel: paytmConfig.CHANNEL_ID, amount: '200', orderId: '150', email: '123456@gmail.com', phone: '9876543210', custId: 'PO23Jf4', checksumhash: 'checkSum', callback: callbackUrl } paytm.startPayment(details) } render() { return ( <View style={styles.container}> <Text style={styles.welcome}>Welcome to React Native!</Text> <Text style={styles.instructions}>To get started, edit App.js</Text> <Text style={styles.instructions}>{instructions}</Text> <TouchableOpacity onPress={this.runTransaction.bind(this)}> <Text style={[styles.welcome, { color: 'green', fontWeight: '800' }]}>Paytm</Text> </TouchableOpacity> </View> ) } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF' }, welcome: { fontSize: 20, textAlign: 'center', margin: 10 }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5 } })
Here is my screenshot:
is this done?
Hi, i am using this module in sample app. But i am getting error page like below image. Please give me any suggestion. Thankyou. here is my code:
Here is my screenshot: