Skip to content

Payment Failed #11

Open
Open
@harikanammi

Description

@harikanammi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions