Android Paypal SDK 错误 : Merchant does not Accept payments of this type

标签 android paypal sdk

当我进入最后阶段并想在 Android 应用程序中使用 Android Paypal SDK 将钱支付给 Paypal 时,我将收到一个错误

"Merchant does not Accept payments of this type"

我正在使用 live id 凭据,但在最后阶段付款没有发生

我使用的代码如下

package com.coded.sandeep;

import java.math.BigDecimal;
import java.util.StringTokenizer;

import org.json.JSONException;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.paypal.android.sdk.payments.PayPalConfiguration;
import com.paypal.android.sdk.payments.PayPalPayment;
import com.paypal.android.sdk.payments.PayPalService;
import com.paypal.android.sdk.payments.PaymentActivity;
import com.paypal.android.sdk.payments.PaymentConfirmation;

public class PaypalActivity extends Activity {


    private static final String CONFIG_ENVIRONMENT = PayPalConfiguration.ENVIRONMENT_PRODUCTION;

    // note that these credentials will differ between live & sandbox environments.
    private static final String CONFIG_CLIENT_ID = "ASAHYxANvUGbBcXaLdhQWoDrO38JkUkYObXRaOF2FuOfa";



    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.paypal_main);

        Intent intent = new Intent(PaypalActivity.this, PayPalService.class);

        intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);

        startService(intent);
    }

    public void onBuyPressed(View pressed) {

        PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);

        Intent intent = new Intent(PaypalActivity.this, PaymentActivity.class);

        intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);

        startActivityForResult(intent, 0);

    }

     private PayPalPayment getThingToBuy(String paymentIntent) {

        Intent intent1 = getIntent();

        String message = "Freiends";
        String amount = "1.29";


        return new PayPalPayment(new BigDecimal(amount), "GBP", message,
                paymentIntent);

    }

    @Override
    protected void onActivityResult (int requestCode, int resultCode, Intent data) {
        if (resultCode == Activity.RESULT_OK) {
            PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
            if (confirm != null) {
                try {

                    Log.i("paymentExample", confirm.toJSONObject().toString(4));

                } catch (JSONException e) {
                    Log.e("paymentExample", "an extremely unlikely failure occurred: ", e);
                }
            }
        }
        else if (resultCode == Activity.RESULT_CANCELED) {
            Log.i("paymentExample", "The user canceled.");
        }
        else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
            Log.i("paymentExample", "An invalid payment was submitted. Please see the docs.");
        }
    }

    @Override
    public void onDestroy() {
        stopService(new Intent(this, PayPalService.class));
        super.onDestroy();
    }
}

如何更正上述错误并使支付成功到商户id。我正在使用商业商家 ID

刷卡支付后的Logcat:

06-20 01:10:22.402: W/DefaultRequestDirector(1295): Authentication error: Unable to respond to any of these challenges: {}
06-20 01:10:22.502: W/paypal.sdk(1295): U SN:14 PayPal Debug-ID: 406bd412549f4 [live, 2.2.2;release]
06-20 01:10:22.512: E/paypal.sdk(1295): request failure with http statusCode:401,exception:org.apache.http.client.HttpResponseException: Unauthorized
06-20 01:10:22.512: E/paypal.sdk(1295): request failed with server response:{"name":"UNAUTHORIZED_PAYMENT","message":"Unauthorized payment","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#UNAUTHORIZED_PAYMENT","debug_id":"406bd412549f4"}
06-20 01:10:22.732: I/Choreographer(1295): Skipped 61 frames!  The application may be doing too much work on its main thread.
06-20 01:10:22.842: E/PayPalService(1295): UNAUTHORIZED_PAYMENT

最佳答案

确保商家帐户具有 Pro 权限。此外,请确保该应用已通过开发者批准流程。

关于Android Paypal SDK 错误 : Merchant does not Accept payments of this type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24304302/

相关文章:

iPhone:如何实现波斯日历?

linux - 在哪里可以下载适用于 Linux 的 Java 6 JDK?

Android 最初使用网络提供商获取纬度和经度,然后使用 GPS

Android 后退导航 ParentActivityName 不起作用

html - 如何实现与 Paypal 的 "Add Item"按钮配合使用的购物篮

PayPal IPN 失败,发现 302

android - 如何使用 Android Studio 混淆 Proguard

java - 连接在远程 IP 上被拒绝,但在本地 IP 上被接受

php - 沙盒 Paypal 结帐(PHP,Laravel)

android - 为什么 flutter 版本不同