I’m using the new Native Checkout SDK for Android with Java and I’ve been following every step in the documentation but this keeps happening and I don’t know why
This is on my public class app extends Application
CheckoutConfig checkoutConfig = new CheckoutConfig( this, ID, Environment.SANDBOX, String.format("%s://paypalpay", BuildConfig.APPLICATION_ID), CurrencyCode.MXN, UserAction.PAY_NOW, new SettingsConfig( true, false ) );
On my fragment where the button is implemented
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(); } );
Advertisement
Answer
Just Solved It by adding this line in the extends application file:
PayPalCheckout.setConfig(checkoutConfig);