【问题标题】:Paypal Native Checkout Button keeps loading and then disappears on AndroidPaypal Native Checkout Button 不断加载,然后在 Android 上消失
【发布时间】:2021-08-12 12:48:59
【问题描述】:

我正在使用新的 Native Checkout SDK for Android with Java,我一直在关注文档中的每一步,但这种情况一直在发生,我不知道为什么

这是在 我的公共类应用扩展了应用程序

        CheckoutConfig checkoutConfig = new CheckoutConfig(
            this,
            ID,
            Environment.SANDBOX,
            String.format("%s://paypalpay", BuildConfig.APPLICATION_ID),
            CurrencyCode.MXN,
            UserAction.PAY_NOW,
            new SettingsConfig(
                    true,
                    false
            )
    );

在我的实现按钮的片段上

payPalButton.setup(
            createOrderActions -> {
                ArrayList purchaseUnits = new ArrayList<>();
                purchaseUnits.add(
                        new PurchaseUnit.Builder()
                                .amount(
                                        new Amount.Builder()
                                                .currencyCode(CurrencyCode.MXN)
                                                .value(amount)
                                                .build()
                                )
                                .build()
                );
                Order order = new Order(
                        OrderIntent.CAPTURE,
                        new AppContext.Builder()
                                .userAction(UserAction.PAY_NOW)
                                .build(),
                        purchaseUnits
                );
                createOrderActions.create(order, (CreateOrderActions.OnOrderCreated) null);
            },
            approval -> approval.getOrderActions().capture(result -> {
                Log.i("CaptureOrder", String.format("CaptureOrderResult: %s", result));
                 }),
            () -> {
                Log.d("OnCancel", "Buyer cancelled the PayPal experience.");
                Snackbar snackbar = Snackbar.make(requireView(), R.string.la_donacion_no_fue_realizada, Snackbar.LENGTH_LONG);
                snackbar.getView().setBackgroundColor(ContextCompat.getColor(requireContext(),android.R.color.holo_red_light));
                snackbar.show();
            },
            errorInfo -> {
                Log.d("OnError", String.format("Error: %s", errorInfo));
                Snackbar snackbar = Snackbar.make(requireView(), R.string.la_donacion_no_fue_realizada, Snackbar.LENGTH_LONG);
                snackbar.getView().setBackgroundColor(ContextCompat.getColor(requireContext(),android.R.color.holo_red_light));
                snackbar.show();
            }

    );

【问题讨论】:

    标签: java android paypal


    【解决方案1】:

    通过在扩展应用程序文件中添加这一行来解决它:

     PayPalCheckout.setConfig(checkoutConfig);
    

    【讨论】:

      猜你喜欢
      • 2018-05-06
      • 2021-07-10
      • 2020-05-27
      • 2021-09-07
      • 2015-10-10
      • 2021-07-04
      • 1970-01-01
      • 2016-03-15
      • 1970-01-01
      相关资源
      最近更新 更多