Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payment Failed #11

Open
harikanammi opened this issue May 14, 2018 · 1 comment
Open

Payment Failed #11

harikanammi opened this issue May 14, 2018 · 1 comment

Comments

@harikanammi
Copy link

harikanammi commented May 14, 2018

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: '[email protected]', 
      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:
screen shot 2018-05-14 at 2 58 59 pm

@kunal886496
Copy link

is this done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants