代码之家  ›  专栏  ›  技术社区  ›  Ankit Mehta

GooglePay不使用Braintree SDK

  •  0
  • Ankit Mehta  · 技术社区  · 6 年前

    我已经实施了Braintree SDK,支持支付使用贝宝,信用卡或借记卡和谷歌支付。

    除了google pay,所有的公司都在工作。 当选择付款方式作为Google支付时,我遇到了以下错误。

    此商家未启用google pay 甚至我也在Braintree控制台上启用了谷歌支付选项。

    以下是实施代码:

    支付按钮上的代码单击:

    DropInRequest dropInRequest = new DropInRequest()
                        .amount(strAmount)
                        .googlePaymentRequest(getGooglePaymentRequest())
                        .tokenizationKey("production_key_xxxxxxxxx");
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                    startActivityForResult(dropInRequest.getIntent(getActivity()), 399);
                }
    
    
    
    private GooglePaymentRequest getGooglePaymentRequest() {
                return new GooglePaymentRequest()
                        .transactionInfo(TransactionInfo.newBuilder()
                                .setTotalPrice(strAmount)
                                .setCurrencyCode("USD")
                                .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                                .build())
                        .emailRequired(true);
            }
    

    我们将感谢您的帮助。

    3 回复  |  直到 6 年前
        1
  •  0
  •   David    6 年前

    完全公开:我在Braintree工作。如果您还有任何问题,请随时联系 support .

    看起来你正试图通过Braintree将不正确的google pay对象传递给一个独立的google pay集成到你的嵌入式用户界面中。

    如果您还没有,您需要在您的 AndroidManifest.xml :

    <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true"/>
    

    然后,构造一个 GooglePaymentRequest 对象并将其传递给 DropInRequest 对象。对象可能看起来像:

    private void enableGooglePay(DropInRequest dropInRequest) {
        GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
          .transactionInfo(TransactionInfo.newBuilder()
            .setTotalPrice("1.00")
            .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
            .setCurrencyCode("USD")
            .build())
          .billingAddressRequired(true); // We recommend collecting and passing billing address information with all Google Pay transactions as a best practice.
    
        dropInRequest.googlePaymentRequest(googlePaymentRequest);
    }
    

    您可以在 our developer docs .

        2
  •  0
  •   fstanis    6 年前

    要在生产中使用Google Pay API,您还需要在Google端为您的应用程序启用它。

    他们 Integration checklist 是一个很好的开始的地方,特别是它有一个名为 Requesting production access

        3
  •  0
  •   Omer    6 年前

    您还需要添加谷歌商品ID(“Your-Merchant-ID”)。

    PaymentDataRequest中的MerchantID参数必须设置为Google Pay Developer配置文件中提供的值。

    https://developers.google.com/pay/api/web/support/troubleshooting#merchantId