Paypal android checkout sdk 在实时模式下提供无效范围

时间:2021-07-20 21:21:04

标签: android paypal

我正在开发一个 android 应用程序,其中包括用于购买硬币的应用程序内 Paypal 付款。 我使用的是最新版本 0.3.0 的官方 sdk https://github.com/paypal/android-checkout-sdk。 在实时模式下单击 Paypal 按钮时,我遇到以下错误 enter image description here

我的代码中有以下配置

val environment: Environment = if (resources.getBoolean(R.bool.production)) Environment.LIVE else Environment.SANDBOX
val config = CheckoutConfig(
      this,
      getString(R.string.paypal_client_id), environment,
      "by.the.way://paypalpay", CurrencyCode.USD, UserAction.PAY_NOW,
      SettingsConfig(
                true,
                false
     )
)
setConfig(config)

这是购买硬币的代码:

btnPaymentPayPal.setup(object : CreateOrder {
            override fun create(createOrderActions: CreateOrderActions) {
                val purchaseUnits = ArrayList<PurchaseUnit>()
                purchaseUnits.add(
                        PurchaseUnit.Builder()
                                .amount(
                                        Amount.Builder()
                                                .currencyCode(CurrencyCode.USD)
                                                .value(coinsPakageModel.price.toString())
                                                .build()
                                )
                                .description(coinsPakageModel.name)
                                .build()
                )
                val order: Order = Order.Builder().appContext(
                        AppContext.Builder()
                                .userAction(UserAction.PAY_NOW)
                                .build()
                ).intent(OrderIntent.CAPTURE)
                        .purchaseUnitList(purchaseUnits).build()
                createOrderActions.create(order)
            }
        },
                object : OnApprove {
                    override fun onApprove(approval: Approval) {
                        approval.orderActions.capture(object : OnCaptureComplete {
                            override fun onCaptureComplete(result: captureOrderResult) {
                              //...
                            }
                        })
                    }
                },
                object : OnCancel {
                    override fun onCancel() {
                        //...
                    }
                },
                object : OnError {
                    override fun onError(errorInfo: ErrorInfo) {
                        //...
                    }
                }
        )

这是我在开发者仪表板中的 Paypal 配置。我的帐户是企业帐户: enter image description here

enter image description here

enter image description here

enter image description here

0 个答案:

没有答案
相关问题