PayUMoney - Android:收到一些错误响应
PayUMoney - Android: Getting some error occured response
我正在 android 应用程序中实施 PayUmoney 支付网关集成。
当我运行应用程序中的支付模式收到以下错误消息时。
Some error occurred
还有下面的例外情况
java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.XXX.XXX/com.payumoney.sdkui.
ui.activities.PayUmoneyActivity}:
java.lang.NullPointerException:
Attempt to invoke virtual method 'void
com.payumoney.core.PayUmoneySDK.addPayment
(com.payumoney.core.listener.OnPaymentOptionReceivedListener,
java.lang.String)'
on a null object reference
下面是一些link我已经尝试过的
PayuMoney Integration in Android : Some error occured! Try again
https://github.com/payu-intrepos/payumoney-new-sample-app/issues/8
PayUMoney - Android: Only getting **paymentId** from payUMoney SDK after successful payment
这是付款代码
private void makePayment() {
//Creating Transaction Id
Random rand = new Random();
String randomString = Integer.toString(rand.nextInt()) +
(System.currentTimeMillis() / 1000L);
mTXNId = hashCal("SHA-256", randomString).substring(0, 20);
double roundOffAmount = Math.round(payamount * 100.0) / 100.0;
String productName = "Test";
String udf1 = "";
String udf2 = "";
String udf3 = "";
String udf4 = "";
String udf5 = "";
String udf6 = "";
String udf7 = "";
String udf8 = "";
String udf9 = "";
String udf10 = "";
/**
* Creating Hash Key
*/
mHash = hashCal("SHA-512",
mMerchantKey + "|" +
mTXNId + "|" +
String.valueOf(roundOffAmount) + "|" +
productName + "|" +
userEmail + "|" +
userName + "|" +
udf1 + "|" +
udf2 + "|" +
udf3 + "|" +
udf4 + "|" +
udf5 + "|" +
udf6 + "|" +
udf7 + "|" +
udf8 + "|" +
udf9 + "|" +
udf10 + "|" +
mSalt);
/**
* Final Action URL...
*/
mAction = mBaseURL.concat("/_payment");
PayUmoneySdkInitializer.PaymentParam.Builder builder = new
PayUmoneySdkInitializer.PaymentParam.Builder();
builder.setAmount(String.valueOf(roundOffAmount)) // Payment amount
.setTxnId(mTXNId) // Transaction ID
.setPhone("9874563210") // User Phone number
.setProductName(productName) // Product Name or description
.setFirstName(userName) // User First name
.setEmail(userEmail) // User Email ID
.setsUrl(mSuccessUrl) // Success URL (surl)
.setfUrl(mFailedUrl) //Failure URL (furl)
.setUdf1(udf1)
.setUdf2(udf2)
.setUdf3(udf3)
.setUdf4(udf4)
.setUdf5(udf5)
.setUdf6(udf6)
.setUdf7(udf7)
.setUdf8(udf8)
.setUdf9(udf9)
.setUdf10(udf10)
.setIsDebug(false) // Integration environment - true (Debug)/
false(Production)
.setKey(mMerchantKey) // Merchant key
.setMerchantId(mMerchantId);
//declare paymentParam object
PayUmoneySdkInitializer.PaymentParam paymentParam = null;
try {
paymentParam = builder.build();
} catch (Exception e) {
e.printStackTrace();
}
//set the hash
paymentParam.setMerchantHash(mHash);
// Invoke the following function to open the checkout page.
PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam,
PaymentMethodAddressActivity.this, R.style.PaymentAppTheme, true);
}
我不知道我的代码有什么问题。
请帮我解决这个问题。
我已经替换了这一行
builder.setAmount(String.valueOf(roundOffAmount))
和
builder.setAmount(roundOffAmount)
现在一切正常,如我所料。
我正在 android 应用程序中实施 PayUmoney 支付网关集成。
当我运行应用程序中的支付模式收到以下错误消息时。
Some error occurred
还有下面的例外情况
java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.XXX.XXX/com.payumoney.sdkui.
ui.activities.PayUmoneyActivity}:
java.lang.NullPointerException:
Attempt to invoke virtual method 'void
com.payumoney.core.PayUmoneySDK.addPayment
(com.payumoney.core.listener.OnPaymentOptionReceivedListener,
java.lang.String)'
on a null object reference
下面是一些link我已经尝试过的
PayuMoney Integration in Android : Some error occured! Try again
https://github.com/payu-intrepos/payumoney-new-sample-app/issues/8
PayUMoney - Android: Only getting **paymentId** from payUMoney SDK after successful payment
这是付款代码
private void makePayment() {
//Creating Transaction Id
Random rand = new Random();
String randomString = Integer.toString(rand.nextInt()) +
(System.currentTimeMillis() / 1000L);
mTXNId = hashCal("SHA-256", randomString).substring(0, 20);
double roundOffAmount = Math.round(payamount * 100.0) / 100.0;
String productName = "Test";
String udf1 = "";
String udf2 = "";
String udf3 = "";
String udf4 = "";
String udf5 = "";
String udf6 = "";
String udf7 = "";
String udf8 = "";
String udf9 = "";
String udf10 = "";
/**
* Creating Hash Key
*/
mHash = hashCal("SHA-512",
mMerchantKey + "|" +
mTXNId + "|" +
String.valueOf(roundOffAmount) + "|" +
productName + "|" +
userEmail + "|" +
userName + "|" +
udf1 + "|" +
udf2 + "|" +
udf3 + "|" +
udf4 + "|" +
udf5 + "|" +
udf6 + "|" +
udf7 + "|" +
udf8 + "|" +
udf9 + "|" +
udf10 + "|" +
mSalt);
/**
* Final Action URL...
*/
mAction = mBaseURL.concat("/_payment");
PayUmoneySdkInitializer.PaymentParam.Builder builder = new
PayUmoneySdkInitializer.PaymentParam.Builder();
builder.setAmount(String.valueOf(roundOffAmount)) // Payment amount
.setTxnId(mTXNId) // Transaction ID
.setPhone("9874563210") // User Phone number
.setProductName(productName) // Product Name or description
.setFirstName(userName) // User First name
.setEmail(userEmail) // User Email ID
.setsUrl(mSuccessUrl) // Success URL (surl)
.setfUrl(mFailedUrl) //Failure URL (furl)
.setUdf1(udf1)
.setUdf2(udf2)
.setUdf3(udf3)
.setUdf4(udf4)
.setUdf5(udf5)
.setUdf6(udf6)
.setUdf7(udf7)
.setUdf8(udf8)
.setUdf9(udf9)
.setUdf10(udf10)
.setIsDebug(false) // Integration environment - true (Debug)/
false(Production)
.setKey(mMerchantKey) // Merchant key
.setMerchantId(mMerchantId);
//declare paymentParam object
PayUmoneySdkInitializer.PaymentParam paymentParam = null;
try {
paymentParam = builder.build();
} catch (Exception e) {
e.printStackTrace();
}
//set the hash
paymentParam.setMerchantHash(mHash);
// Invoke the following function to open the checkout page.
PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam,
PaymentMethodAddressActivity.this, R.style.PaymentAppTheme, true);
}
我不知道我的代码有什么问题。
请帮我解决这个问题。
我已经替换了这一行
builder.setAmount(String.valueOf(roundOffAmount))
和
builder.setAmount(roundOffAmount)
现在一切正常,如我所料。