1

I have set validation to check valid format of UPI.

String validateUpiID(String value) {
  String pattern = '[a-zA-Z0-9.\-_]{2,256}@[a-zA-Z]{2,64}';
  RegExp regExp = RegExp(pattern);
  if (value.isEmpty) {
    return 'Please Enter UPI ID';
  } else if (!regExp.hasMatch(value)) {
    return 'Please Enter valid UPI ID';
  }
  return "";
}

But Now I'm stuck there, How do I check that entered UPI is exist or in working mode ?

Vrusti Patel
  • 394
  • 2
  • 15

1 Answers1

0

Use package upi_pay: https://pub.dev/packages/upi_pay

After calling the method initiateTransaction, you can get the status of the transaction

Future doUpiTransation(ApplicationMeta appMeta) {
  final UpiTransactionResponse response = await UpiPay.initiateTransaction(
    amount: '100.00',
    app: appMeta.application,
    receiverName: 'John Doe',
    receiverUpiAddress: 'john@doe',
    transactionRef: 'UPITXREF0001',
    transactionNote: 'A UPI Transaction',
  );
  print(response.status);
}
Policy
  • 46
  • 2
  • Thanks, But, In my case, I have to save details into database. and the admin will use that UPI in their bussiness account. So, whatever UPI id i'm going to store, that will be real time. So how do I check that. – Vrusti Patel Aug 17 '22 at 13:14