Android应用中的GPay付款网关集成

时间:2020-07-05 17:51:36

标签: android-studio payment-gateway

我正在Android应用中使用G Pay付款网关,我需要知道如何将金额从活动编辑文本定向到G Pay以支付输入的金额。

pay.setOnClickListener(new View.OnClickListener(){
  @Override
  public void onClick(View view) 
  {
     Uri uri = new Uri.Builder()
                    .scheme("upi")
                    .authority("pay")
                    .appendQueryParameter("pa", upiId)
                    .appendQueryParameter("pn", holder_name)
                 // .appendQueryParameter("mc", "your-merchant-code")
                 // .appendQueryParameter("tr", "your-transaction-ref-id")
                    .appendQueryParameter("tn", "Test Payment")
                    .appendQueryParameter("am", amount)
                    .appendQueryParameter("cu", "INR")
                 // .appendQueryParameter("url", "your-transaction-url")
                     .build();

          Intent upiPay = new Intent(Intent.ACTION_VIEW);
          upiPay.setData(uri);

          Intent chooser = Intent.createChooser(upiPay,"Pay with");

          if(null != chooser.resolveActivity(getPackageManager()))
          {
              startActivityForResult(chooser,UPI_PAYMENT);
          }
          else
          {
              Toast.makeText(Paymant.this, "No app found to make payment",
                      Toast.LENGTH_SHORT).show();
          }
}

0 个答案:

没有答案