Я интегрирую платежный шлюз payumoney в свое приложение для Android.Но когда я пытался совершить тестовую транзакцию с помощью тестовой дебетовой карты.Это показывает ошибку.когда я связываюсь с отделом обслуживания клиентов Payumoney, они говорят, что белый список URL-адреса сервера.я не знаю, как сделать белый список URL-адрес сервера.
public void startpay() {
builder.setAmount(amount) // Payment amount
.setTxnId(txnid) // Transaction ID
.setPhone(phone) // User Phone number
.setProductName(prodname) // Product Name or description
.setFirstName(firstname) // User First name
.setEmail(email) // User Email ID
.setsUrl("https://www.payumoney.com/mobileapp/payumoney/success.php") // Success URL (surl)
.setfUrl("https://www.payumoney.com/mobileapp/payumoney/failure.php") //Failure URL (furl)
.setUdf1("")
.setUdf2("")
.setUdf3("")
.setUdf4("")
.setUdf5("")
.setUdf6("")
.setUdf7("")
.setUdf8("")
.setUdf9("")
.setUdf10("")
.setIsDebug(true) // Integration environment - true (Debug)/ false(Production)
.setKey(merchantkey) // Merchant key
.setMerchantId(merchantId);
try {
paymentParam = builder.build();
// generateHashFromServer(paymentParam );
getHashkey();
} catch (Exception e) {
Log.e(TAG, " error s " + e.toString());
}
}
public void getHashkey() {
ServiceWrapper service = new ServiceWrapper(null);
Call<String> call = service.newHashCall(merchantkey, txnid, amount, prodname,
firstname, email);
call.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
Log.e(TAG, "hash res " + response.body());
String merchantHash = response.body();
if (merchantHash.isEmpty() || merchantHash.equals("")) {
Toast.makeText(StartPaymentActivity.this, "Could not generate hash", Toast.LENGTH_SHORT).show();
Log.e(TAG, "hash empty");
} else {
// mPaymentParams.setMerchantHash(merchantHash);
paymentParam.setMerchantHash(merchantHash);
// Invoke the following function to open the checkout page.
// PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam, StartPaymentActivity.this,-1, true);
PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam, StartPaymentActivity.this, R.style.AppTheme_default, false);
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
Log.e(TAG, "hash error " + t.toString());
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//PayUMoneySdk: Success -- merchantResponse438104
// on successfull txn
// request code 10000 resultcode -1
// Result Code is -1 send from Payumoney activity
Log.e("StartPaymentActivity", "request code " + requestCode + " resultcode " + resultCode);
if (requestCode == PayUmoneyFlowManager.REQUEST_CODE_PAYMENT && resultCode == RESULT_OK && data != null) {
TransactionResponse transactionResponse = data.getParcelableExtra(PayUmoneyFlowManager.INTENT_EXTRA_TRANSACTION_RESPONSE);
if (transactionResponse != null && transactionResponse.getPayuResponse() != null) {
if (transactionResponse.getTransactionStatus().equals(TransactionResponse.TransactionStatus.SUCCESSFUL)) {
//Success Transaction
Toast.makeText(this, "Payment successful", Toast.LENGTH_SHORT).show();
} else {
//Failure Transaction
Toast.makeText(this, "Payment failed", Toast.LENGTH_SHORT).show();
}
// Response from Payumoney
//String payuResponse = transactionResponse.getPayuResponse();
// Response from SURl and FURL
//String merchantResponse = transactionResponse.getTransactionDetails();
//Log.e(TAG, "tran " + payuResponse + "---" + merchantResponse);
} /* else if (resultModel != null && resultModel.getError() != null) {
Log.d(TAG, "Error response : " + resultModel.getError().getTransactionResponse());
} else {
Log.d(TAG, "Both objects are null!");
}*/
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//PayUMoneySdk: Success -- merchantResponse438104
// on successfull txn
// request code 10000 resultcode -1
// Result Code is -1 send from Payumoney activity
Log.e("StartPaymentActivity", "request code " + requestCode + " resultcode " + resultCode);
if (requestCode == PayUmoneyFlowManager.REQUEST_CODE_PAYMENT && resultCode == RESULT_OK && data != null) {
TransactionResponse transactionResponse = data.getParcelableExtra(PayUmoneyFlowManager.INTENT_EXTRA_TRANSACTION_RESPONSE);
if (transactionResponse != null && transactionResponse.getPayuResponse() != null) {
if (transactionResponse.getTransactionStatus().equals(TransactionResponse.TransactionStatus.SUCCESSFUL)) {
//Success Transaction
Toast.makeText(this, "Payment successful", Toast.LENGTH_SHORT).show();
} else {
//Failure Transaction
Toast.makeText(this, "Payment failed", Toast.LENGTH_SHORT).show();
}
// Response from Payumoney
//String payuResponse = transactionResponse.getPayuResponse();
// Response from SURl and FURL
//String merchantResponse = transactionResponse.getTransactionDetails();
//Log.e(TAG, "tran " + payuResponse + "---" + merchantResponse);
}
}
}