Closed maheshshrigod closed 3 years ago
Yep we need this :-)
i'll try to push it by tomorrow
Hey @Suraj-Tiwari did you find any solution to this problem? There is currently no way to get cancelled by user. Please help
Payumoney(payData).then((data) => {
console.log(data)
}).catch((e) => {
console.log('error', e)
})
Always return 0
I tried your example code @Suraj-Tiwari but even if I am getting data in the console its not setting payment status in payumoney and I not able to manually transact out from the payumoney
It's a callback system, so if you're getting in console log payment screen has been closed. The only known issue is if User manually force closed the payment screen, it won't return any proper callback.
so what do you suggest me to do return back
This is my code here .... @Suraj-Tiwari
import React, {Fragment,useState,useEffect} from 'react'; import {SafeAreaView, Text,View, StyleSheet, TouchableOpacity} from 'react-native'; import CustomHeader from '../CustomHeader'; import PayuMoney from 'react-native-payumoney'; import AsyncStorage from '@react-native-community/async-storage'; import {Button } from 'react-native-paper'; import { useNavigation } from '@react-navigation/native'; import * as RootNavigation from '../RootNavigation';
const HashScreen = ({ navigation,route,props}) => { // const navigation = useNavigation(); const passing = 'passing'; const [username , setUsername] = useState(''); const [name ,setName] = useState(''); const [currentplan , setCurrentPlan] = useState(''); const [prvbalance , setPrvBalance] = useState(''); const [trigger , setTrigger] = useState(''); const [paymentStatus, setPaymentStatus] = useState('');
useEffect(() => {
pay()
}, [])
const pay = async () => {
AsyncStorage.getItem(passing).then((value) =>{
if(value !== null){
}
else{
console.log('value is null')
}
}).done();
setPaymentStatus('');
const payData = {
amount: '10.0',
txnId: '12345678',
productName: 'product_info',
firstName: 'firstname',
email: 'xyz@gmail.com',
phone: '1234567890',
merchantId: '789',
key: 'qwert',
successUrl: 'https://www.payumoney.com/success.php',
failedUrl: 'https://www.payumoney.com/faliure.php',
isDebug: false,
hash:
'my own hash',
}
PayuMoney(payData).then((data) => {
// Payment Success
setPaymentStatus('Success')
// alert(data)
console.log(data)
}).catch((e) => {
setPaymentStatus('Failed')
// Payment Failed
console.log(e)
})
popup(paymentStatus);
}
const popup = (paymentStatus) => {
if(paymentStatus === 'success'){
navigation.pop();
}
else{
navigation.pop();
}
}
return true;
// <View>
// <CustomHeader navigation={navigation} />
// <View>
// <Text>
// You're payment had been failed please try again
// </Text>
// <Text>Payment Status : {paymentStatus}</Text>
// </View>
// </View>
// <Fragment>
// <View
// style={{
// flex: 1,
// alignItems: 'center',
// justifyContent: 'center',
// height: 200,
// }}
// >
// <Button
// onPress={() => pay()}
// title='Pay me :P'
// />
// <Text>{paymentStatus}</Text>
// </View>
// </Fragment>
}
export default HashScreen;
From release 1.0.2 (#55 ) you'll get status code along with errors, 1 = success -1 = gateway failure 0 = User cancelled
@shrutiraoniit25 check the example again, doesn't faced any issue like this in my testing. still i've updated gateway sdk to latest version. If you're still facing email me at surajtiwari020@gmail.com
Any reason closed the with out any comment or suggestion? Can you please reopen this one