【发布时间】: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();
}
);
【问题讨论】: