title: Implementing Google Pay Android Application using BlueSnap sdk
body: <p>I have downloaded BlueSnap Demo App from <a href="https://github.com/bluesnap/bluesnap-android-int" rel="nofollow noreferrer">https://github.com/bluesnap/bluesnap-android-int</a>. I have created sandbox account. I want Google Pay as a payment method. When I am selecting card payment through bluesnap it successfully charges amount and that amount is showing on BlueSnap sandbox dashboard, but when I click "GPay" button in BlueSnap App, it shows "Unexpected developer error, please try again later". I am stuck here and unable to understand what is going wrong.</p>
  
  <p><code>onPaySubmit()</code> is a method called when I click on the checkout button. I can provide more code and details.</p>
  
  <pre><code>public void onPaySubmit(View view) {
          if (shopperConfigSwitch.isChecked()) {
              SdkRequestShopperRequirements sdkRequest = new SdkRequestShopperRequirements(billingSwitch.isChecked(), emailSwitch.isChecked(), shippingSwitch.isChecked());
              try {
                  bluesnapService.setSdkRequest(sdkRequest);
                  Intent intent = new Intent(getApplicationContext(), BluesnapChoosePaymentMethodActivity.class);
                  startActivityForResult(intent, BluesnapChoosePaymentMethodActivity.REQUEST_CODE_DEFAULT);
              } catch (BSPaymentRequestException e) {
                  Log.e(TAG, "payment request not validated: ", e);
                  finish();
              }
          } else {
              String productPriceStr = AndroidUtil.stringify(productPriceEditText.getText());
              if (TextUtils.isEmpty(productPriceStr)) {
                  Toast.makeText(getApplicationContext(), "null payment", Toast.LENGTH_LONG).show();
                  return;
              }
  
              Double productPrice = Double.valueOf(productPriceStr);
              if (productPrice &lt;= 0D) {
                  Toast.makeText(getApplicationContext(), "0 payment", Toast.LENGTH_LONG).show();
                  return;
              }
  
              readCurencyFromSpinner(ratesSpinner.getSelectedItem().toString());
              Double taxAmount = 0D;
              // You can set the Amouut solely
              SdkRequest sdkRequest = new SdkRequest(productPrice, ratesSpinner.getSelectedItem().toString(), billingSwitch.isChecked(), emailSwitch.isChecked(), shippingSwitch.isChecked());
  
  //        // Or you can set the Amount with tax, this will override setAmount()
  //        // The total purchase amount will be the sum of both numbers
  //        if (taxAmountPrecentage &gt; 0D) {
  //            sdkRequest.setAmountWithTax(productPrice, productPrice * (taxAmountPrecentage / 100));
  //        } else {
  //            sdkRequest.setAmountNoTax(productPrice);
  //        }
  
              Switch googlePayTestModeSwitch = findViewById(R.id.googlePayTestModeSwitch);
              sdkRequest.setGooglePayTestMode(googlePayTestModeSwitch.isChecked());
  
              sdkRequest.setAllowCurrencyChange(allowCurrencyChangeSwitch.isChecked());
              try {
                  sdkRequest.verify();
              } catch (BSPaymentRequestException e) {
                  showDialog("SdkRequest error:" + e.getMessage());
                  Log.d(TAG, sdkRequest.toString());
                  finish();
              }
  
              // Set special tax policy: non-US pay no tax; MA pays 10%, other US states pay 5%
              sdkRequest.setTaxCalculator(new TaxCalculator() {
                  @Override
                  public void updateTax(String shippingCountry, String shippingState, PriceDetails priceDetails) {
                      if ("us".equalsIgnoreCase(shippingCountry)) {
                          Double taxRate = 0.05;
                          if ("ma".equalsIgnoreCase(shippingState)) {
                              taxRate = 0.1;
                          }
                          priceDetails.setTaxAmount(priceDetails.getSubtotalAmount() * taxRate);
                      } else {
                          priceDetails.setTaxAmount(0D);
                      }
                  }
              });
  
              try {
                  bluesnapService.setSdkRequest(sdkRequest);
                  Intent intent = new Intent(getApplicationContext(), BluesnapCheckoutActivity.class);
                  startActivityForResult(intent, BluesnapCheckoutActivity.REQUEST_CODE_DEFAULT);
              } catch (BSPaymentRequestException e) {
                  Log.e(TAG, "payment request not validated: ", e);
                  finish();
              }
          }
      }
  
  protected void startGooglePayActivityForResult() {
  
          Log.d(TAG, "start GooglePay flow");
  
          // Disables the button to prevent multiple clicks.
          LinearLayout googlePayButton = findViewById(R.id.googlePayButton);
          if (googlePayButton != null) {
              googlePayButton.setClickable(false);
          }
  
          Task&lt;PaymentData&gt; futurePaymentData = GooglePayService.getInstance().createPaymentDataRequest(googlePayClient);
  
          // Since loadPaymentData may show the UI asking the user to select a payment method, we use
          // AutoResolveHelper to wait for the user interacting with it. Once completed,
          // onActivityResult will be called with the result.
          AutoResolveHelper.resolveTask(futurePaymentData, this, GOOGLE_PAY_PAYMENT_DATA_REQUEST_CODE);
      }
  
  public Task&lt;PaymentData&gt; createPaymentDataRequest(PaymentsClient googlePayClient) {
  
          BlueSnapService blueSnapService = BlueSnapService.getInstance();
          SdkRequestBase sdkRequest = blueSnapService.getSdkRequest();
          Long merchantId = blueSnapService.getsDKConfiguration().getMerchantId();
          if (merchantId == null) {
              Log.e(TAG, "Missing merchantId from SDK init data");
              return null;
          }
  
          List&lt;Pair&lt;String, String&gt;&gt; GATEWAY_TOKENIZATION_PARAMETERS = Arrays.asList(
                  Pair.create("gatewayMerchantId", merchantId.toString())
          );
  
          PaymentMethodTokenizationParameters.Builder paramsBuilder =
                  PaymentMethodTokenizationParameters.newBuilder()
                          .setPaymentMethodTokenizationType(
                                  WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY)
                          .addParameter("gateway", GATEWAY_TOKENIZATION_NAME);
          for (Pair&lt;String, String&gt; param : GATEWAY_TOKENIZATION_PARAMETERS) {
              paramsBuilder.addParameter(param.first, param.second);
          }
  
          PaymentDataRequest request = createPaymentDataRequest(paramsBuilder.build(), sdkRequest);
          Task&lt;PaymentData&gt; futurePaymentData = googlePayClient.loadPaymentData(request);
          return futurePaymentData;
      }
  </code></pre>
  
  <p>I want Google pay payments to be processed by Bluesnap and those payments should reflect on Bluesnap sandbox dashboard.</p>