1
votes

I have followed this link: https://developer.paytm.com/docs/upi-smart-intent/ to integrate UPI Payment Gateway in my android app.

I get the error as:

  1. Paytm: 'This payment mode is not allowed for this acc'
  2. PhonePe: 'For Security reasons you can not transfer amout to this bank...'
  3. Gpay: 'Maximum limit exceeded...'

I have searched and tried almost all the links but none have solved my issue.

Following is my android code:

public void intializePayment(ReadableMap config, Callback successHandler, Callback failureHandler) {
        this.successHandler = successHandler;
        this.failureHandler = failureHandler;

        String UPI = this.getUPIString(config.getString("vpa"),
                config.getString("payeeName"),
                config.getString("merchantID"),
                config.getString("transactionID"),
                config.getString("transactionRef"),
                config.getString("transactionNote"),
                config.getString("amount"),
                config.getString("currency"));
        
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        
        intent.setData(Uri.parse(UPI));
        intent.setPackage(config.getString("pkgName"));
        Context currentContext = getCurrentActivity().getApplicationContext();
        if (intent != null) {
            Intent chooser = Intent.createChooser(intent, "Choose a upi app");
            if (isCallable(chooser, currentContext)) {
                getCurrentActivity().startActivityForResult(chooser, REQUEST_CODE);
            } else {
                final JSONObject responseData = new JSONObject();
                try {
                    responseData.put("message", "UPI supporting app not installed");
                    responseData.put("status", FAILURE);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                this.failureHandler.invoke(gson.toJson(responseData));
            }
        }
        
    }

    private boolean isCallable(Intent intent, Context context) {
        List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
                PackageManager.MATCH_DEFAULT_ONLY);
        return list.size() > 0;
    }

    @Override
    public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
        final JSONObject responseData = new JSONObject();
        try {
            
            if (requestCode == REQUEST_CODE) {
                if (data == null) {
                    responseData.put("status", FAILURE);
                    responseData.put("message", "No action taken");
                    this.failureHandler.invoke(gson.toJson(responseData));
                    return;
                 }

                Bundle bundle = data.getExtras();
                if (data.getStringExtra("Status").equals("SUCCESS") || data.getStringExtra("Status").equals("Success") ) {
                    responseData.put("status", data.getStringExtra("Status"));
                    responseData.put("message", bundle.getString("response"));
                    this.successHandler.invoke(gson.toJson(responseData));

                } else {
                    responseData.put("status", data.getStringExtra("Status"));
                    responseData.put("message", bundle.getString("response"));
                    this.failureHandler.invoke(gson.toJson(responseData));      
                }
            } else {
                return;
            }

        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onNewIntent(Intent intent) {

    }
}
1

1 Answers

0
votes

Please raise a query on "Paytm Developer Support". We would be needing more information to get this checked