"Произошла некоторая ошибка" при интеграции PayuMoney в Android
Я пытаюсь интегрировать Payumoney в Android, но всегда получаю ошибку
произошла ошибка
Ниже приведен код.
hashcal:
public static String hashCal(String hashString) {
StringBuilder hash = new StringBuilder();
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("SHA-512");
messageDigest.update(hashString.getBytes());
byte[] mdbytes = messageDigest.digest();
for (byte hashByte : mdbytes) {
hash.append(Integer.toString((hashByte & 0xff) + 0x100, 16).substring(1));
}
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return hash.toString();
}
Основной код:
Random rand = new Random();
String randomString = Integer.toString(rand.nextInt()) + (System.currentTimeMillis() / 1000L);
String txnId = hashCal(randomString).substring(0, 20);
int amount = new BigDecimal(100).setScale(0, RoundingMode.UP).intValue();
String hashSequence = "mLeqrgMpR|"+txnId+"|"+amount+"|Coupons|abcdef|test@gmail.com|udf1|udf2|udf3|udf4|udf5|3d7vtDalxm";
String hash = hashCal(hashSequence);
PayUmoneySdkInitializer.PaymentParam.Builder builder = new
PayUmoneySdkInitializer.PaymentParam.Builder();
builder.setAmount(amount) // Payment amount
.setTxnId(txnId) // Transaction ID
.setPhone("+911234567890") // User Phone number
.setProductName("Coupons") // Product Name or description
.setFirstName("abcdef") // User First name
.setEmail("test@gmail.com") // User Email ID
.setsUrl("https://test.payumoney.com/mobileapp/payumoney/success.php") // Success URL (surl)
.setfUrl("https://test.payumoney.com/mobileapp/payumoney/failure.php")
.setIsDebug(true) // Integration environment - true (Debug)/ false(Production)
.setKey("mLeqrgMpR") // Merchant key
.setMerchantId("12359971"); // Merchant ID
PayUmoneySdkInitializer.PaymentParam paymentParam = builder.build();
//set the hash
paymentParam.setMerchantHash(hash);
PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam, getActivity(), R.style.AppTheme_NoActionBar,false);
Всякий раз, когда я пытаюсь выполнить приведенный выше код, действие payumoney заканчивается и выдает тост "произошла какая-то ошибка".
Что я делаю не так?
Благодарю.