Using the Zxing library I am generating QR Code for UPI transactions. Below is the string
String UPI = "upi://pay?pa=" + payeeAddress + "&pn=" + payeeName
+ "&tr=" + trxnRefId
+ "&tn=" + trxnNote + "&am=" + payeeAmount + "&cu=" + currencyCode+ "&ad="+ str ;
Using Zxing Scanner, how to read values one by one like transaction reference id, amount and payee name.
Present I am getting a full string of UPI using the below code.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
Toast.makeText(this, "Scanned: " + result.getContents(),
Toast.LENGTH_LONG).show();
}
Zxing's result.text gets you a string of the content of the QR Code. you could create a function to get the value that you want.
val trxnRefId = result.text.substringAfter(&tr=).substringBefore(&tn=)