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

Issue while making payment to upi id in react native #63

Open
saurabhc-ecsion opened this issue Feb 13, 2024 · 1 comment
Open

Issue while making payment to upi id in react native #63

saurabhc-ecsion opened this issue Feb 13, 2024 · 1 comment

Comments

@saurabhc-ecsion
Copy link

please correct me if I am wrong,

I am trying to integrate this library to make payment using upi in react native app, after integration it giving error
Error initiating payment: [TypeError: Cannot read property 'intializePayment' of null]

And also I am getting confused, is this also work from iOS device when user try to make payment from iOS devices.

please let me know, what to do next for payment integration

sharing you sample code (if you can fix):

import React from 'react';
import { View, Button, Alert } from 'react-native';
import UpiPayment from 'react-native-upi-payment';

const App = () => {
  const initiatePayment = async () => {
    try {
      if (UpiPayment) {
        const response = await UpiPayment.initializePayment(
          {
            vpa: 'saurabh.iosdevlpr@okhdfcbank',
            payeeName: 'Saurabh Chaudhari',
            amount: '1',
            transactionRef: 'Testing Transaction',
            transactionNote: 'Test payment',
          },
          (data) => {
            if (data && data.Status === 'SUCCESS') {
              Alert.alert('Payment Successful', 'Payment was successful.');
            } else {
              Alert.alert('Payment Failed', 'Payment was not successful.');
            }
          },
          (error) => {
            console.error('Error initiating payment:', error);
            Alert.alert('Payment Error', 'An error occurred while processing payment.');
          }
        );
      } else {
        Alert.alert('Payment Error', 'UPI Payment module is not available.');
      }
    } catch (error) {
      console.error('Error initiating payment:', error);
      Alert.alert('Payment Error', 'An error occurred while processing payment.');
    }
  };

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Button title="Initiate Payment" onPress={initiatePayment} />
    </View>
  );
};

export default App;

@chandanmallik
Copy link

me also getting same
any solution you found

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