当前位置: 首页 > 知识库问答 >
问题:

沙盒测试模式下Android系统中Paypal支付网关的集成问题

淳于亦
2023-03-14

此外,我尝试了生产模式,改变所有需要的设置,但在本例中得到
429-多次击中问题。

我花了一整天的时间和我的朋友一起解决这个问题,但没有找到成功。

1-贝宝限制沙箱测试模式还是只在印度限制此服务?
2-解决此问题的解决方案是什么?

还是贝宝删除沙箱测试服务,或者我需要为贝宝集成实现BrainTree SDK?

开始我的活动课

公共类MainActivity扩展AppCompatActivity{private static final String TAG=“paymentexample”;private static final String CONFIG_ENVIRONMENT=paypalconfiguration.environment_sandbox;private static final String PAYMENT_TYPE=“usd”;private static final String CONFIG_CLIENT_ID=“here

private static final int REQUEST_CODE_PAYMENT = 1;
private static PayPalConfiguration config = new PayPalConfiguration()
        .environment(CONFIG_ENVIRONMENT)
        .clientId(CONFIG_CLIENT_ID);

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Intent intent = new Intent(this, PayPalService.class);
    intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
    startService(intent);
}

public void onBuyPressed(View pressed) {
    PayPalPayment thingToBuy = getThingToBuy();
    Intent intent = new Intent(MainActivity.this, PaymentActivity.class);
    intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
    intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
    startActivityForResult(intent, REQUEST_CODE_PAYMENT);
}

private PayPalPayment getThingToBuy() {
    return new PayPalPayment(new BigDecimal("0.1"), PAYMENT_TYPE, "eSIM",
            PayPalPayment.PAYMENT_INTENT_SALE);
}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.i(TAG, data.toString());
    if (requestCode == REQUEST_CODE_PAYMENT) {
        if (resultCode == Activity.RESULT_OK) {
            PaymentConfirmation confirm =
                    data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
            if (confirm != null) {
                try {
                    Log.i(TAG, confirm.toJSONObject().toString(4));
                    Log.i(TAG, confirm.getPayment().toJSONObject().toString(4));
                } catch (JSONException e) {
                    Log.e(TAG, "an extremely unlikely failure occurred: ", e);
                }
            }
        } else if (resultCode == Activity.RESULT_CANCELED) {
            Log.i(TAG, "The user canceled.");
        } else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
            Log.i(
                    TAG,
                    "An invalid Payment or PayPalConfiguration was submitted. Please see the docs.");
        }
    } 
}

@Override
public void onDestroy() {
    // Stop service when done
    stopService(new Intent(this, PayPalService.class));
    super.onDestroy();
}

}活动课结束

错误堆栈日志

E/paypal.sdk: request failure with http statusCode:404,exception:Not Found
2021-02-15 21:48:22.046 3106-3200/com.claytech.paypaldemoapplication E/paypal.sdk: Exception parsing server response
org.json.JSONException: End of input at character 0 of 
at org.json.JSONTokener.syntaxError(JSONTokener.java:460)
at org.json.JSONTokener.nextValue(JSONTokener.java:101)
at com.paypal.android.sdk.cw.m(Unknown Source:7)
at com.paypal.android.sdk.fm.d(Unknown Source:0)
at com.paypal.android.sdk.ci.a(Unknown Source:21)
at com.paypal.android.sdk.cm.a(Unknown Source:58)
at com.paypal.android.sdk.cq.onResponse(Unknown Source:45)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
2021-02-15 21:48:22.057 3106-3200/com.claytech.paypaldemoapplication E/paypal.sdk: request failed with server response:
2021-02-15 21:48:22.075 3106-3106/com.claytech.paypaldemoapplication E/paypal.sdk: INTERNAL_SERVER_ERROR

共有1个答案

丁长卿
2023-03-14

PayPal Android SDK是不推荐的,所以看起来你使用的是一个不推荐的解决方案。如果您需要一个本地SDK,通过Braintree快速结账是唯一可用的。但是,您确实需要一个服务器或webservice来使用Braintree,因为该集成有一个服务器端部分。

或者,您可以在服务器或webservice上集成v2 Create Order API,并使用rel:Approve URL从本机应用程序打开浏览器,并将返回URL设置为应用程序的deeplink,然后从服务器触发捕获命令调用。

正如您所看到的,所有解决方案都需要一个服务器或WebService。

 类似资料:
  • 在沙盒上测试快速结账时,买家无法找到信用卡的付款方式。 在页面的某个地方,我们找到了以下信息。 很抱歉,您的某些付款方式不适用于此次购买。 无法使用的付款方式: 信用卡、借记卡或即时银行转账 卖家帐户已启用为商务专业版。 我们是否缺少买方或卖方帐户的任何配置?

  • 我正在开发Android应用程序,我必须集成PayPal,我已经按照MPL PayPal教程在应用程序中集成PalPal。我明白了。但我的问题是 我无法创建个人和业务测试帐户,因为当我创建帐户时,它会询问我帐户详细信息。 我住在非美国国家。 我跟着沙箱TestAccount做帐号。 如果我在这一点上忽略了信用卡信息,那么在下一步我必须添加它。

  • web支付是正常的,在app唤起支付,提示“您已经有一段时间没有进行任何操作,为保护您的账户,我们已帮您退出。返回商家页面并重新进行付款。”,在ios、安卓都测试了,都一样,有人遇过吗?

  • 我正在我的Android应用程序中集成贝宝支付。人们不能使用,因为它是不推荐的。文档 根据文档,印度不支持,他们建议使用 和。 当我单击此处的Express Checkout链接时,他们要求我创建一个只支持印度以外的国家的生产帐户(沙箱运行良好)。 那么,在印度,我如何将贝宝支付集成到我的Android应用程序中呢?为了测试,我在这里创建了一个沙盒帐户,它运行良好,但对于生产来说,可以做什么呢?

  • 本文向大家介绍SpringBoot集成支付宝沙箱支付(支付、退款),包括了SpringBoot集成支付宝沙箱支付(支付、退款)的使用技巧和注意事项,需要的朋友参考一下 前言 支付宝推出一个沙箱环境,能够很好的模拟支付宝支付,并且还提供了demo,但demo是一个普通web项目,怎么整合到Spring Boot项目呢,其实很简单 简单配置请参照支付宝沙箱支付开发文档 一、支付部分 AlipayCon

  • 一位客户报告说,在他创建贝宝账户之前,他无法使用贝宝支付我们的服务。因为我们启用了必要的设置,所以需要调试。 我想把这个问题复制到计算机上https://developer.paypal.com/ 但我不知道如何在不登录帐户或在那里创建帐户的情况下“支付”。 如何在PayPal沙盒网站上测试“没有PayPal账户的结账”?