paypal android sdk,Android Paypal SDK错误:商家不接受此类付款

当我进入最后阶段并希望使用Android应用程序中的Android Paypal SDK向Paypal付款时,我将收到错误

"Merchant does not Accept payments of this type"

我正在使用实时身份凭证,但在最后阶段付款没有发生

我使用的代码如下

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值