android - Paypal native checkout sdk android paypal按钮在一次付款完成或取消后不呈现
问题描述
我目前正在使用 Paypal Native Checkout SDK https://developer.paypal.com/docs/business/native-checkout/android/。第一次一切正常,但如果我完成或取消贝宝付款,按钮不会再次呈现,日志返回错误 I/PaymentButtonEligibility:资格:错误。
有谁知道解决方案?
class App: Application() {
override fun onCreate() {
super.onCreate()
val config = CheckoutConfig(
application = this,
clientId = "....",
environment = Environment.SANDBOX,
returnUrl = "my.com.testpaypal://paypalpay",
currencyCode = CurrencyCode.MYR,
userAction = UserAction.PAY_NOW,
paymentButtonIntent = PaymentButtonIntent.CAPTURE,
settingsConfig = SettingsConfig(
loggingEnabled = true
)
)
PayPalCheckout.setConfig(config)
}
}
class TestActivity : AppCompatActivity() {
private lateinit var binding: ActivityTestBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityTestBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.btnPay.setup(
createOrder = CreateOrder { createOrderActions ->
val order = Order(
intent = OrderIntent.CAPTURE,
appContext = AppContext(
userAction = UserAction.PAY_NOW
),
purchaseUnitList = listOf(
PurchaseUnit(
//items = List<Items>(1) { _ -> },
amount = Amount(
currencyCode = CurrencyCode.MYR,
value = "12"
)
)
)
)
createOrderActions.create(order)
},
onApprove = OnApprove { approval ->
approval.orderActions.capture { captureOrderResult ->
Log.i("CaptureOrder", "CaptureOrderResult: $captureOrderResult")
}
},
onCancel = OnCancel {
Log.i("OnCancel", "Buyer canceled the PayPal experience.")
},
onError = OnError { errorInfo ->
Log.i("OnError", "Error: $errorInfo")
}
)
}
}
解决方案
推荐阅读
- r - 如何在 R Markdown 中自动化文本和代码块之间的不同间距?
- r - 需要合作伙伴特定级别的份额
- css - 如何将 div 附加到可折叠的导航栏
- java - 如何使用spring批处理仅解析XML的选定部分并将其转换为java POJO
- python - .在没有按我预期的那样运作之后
- android - 2019 年针对较旧的移动设备
- android - 强制显示级别选择器
- angular - Angular - 错误类型错误:无法读取未定义的属性“标题”
- java - 有没有办法将 ArrayList 的特定元素复制到另一个空/不同的 ArrayList 中?
- react-native - 使用 Expo 隐藏虚拟按钮后的空白