我在PayPal中创建帐户,并且我已经下载了Paypal sdk。我已经提出申请,并从网站获得客户端ID。现在,我无法通过开发人员ID登录到PayPal网关后,我的应用程序集成。无法通过开发人员在PayPal登录用户名密码
请帮我,我要去哪里错了
我的代码
try{
Double amount=Double.parseDouble(amnt.getText().toString());
if(amount>=62 && amount!=null && amount!=0.0){
amount=amount/62;
PayPalPayment thingToBuy = new PayPalPayment(new BigDecimal(""+amount), "USD", "Cab Rent");
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);
// It's important to repeat the clientId here so that the SDK has it if Android restarts your
// app midway through the payment UI flow.
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, "AXJjcRB6yUtJghGBgdDHmOgkL8a9Jnd0RVARU9XPGqZ_lSstEhDSkh7D9AL2");
intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "");//from ui we have to design
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, 0);
}
else{
Toast.makeText(getApplicationContext(), " An invalid payment was submitted. 1$ minimum", Toast.LENGTH_LONG).show();
}}
catch(Exception e){
Log.d("Paypal_Activity", ""+e); //BLUE
}
上的活动结果
@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));
// TODO: send 'confirm' to your server for verification.
// see https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
// for more details.
} 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_PAYMENT_INVALID) {
Log.i("paymentExample", "An invalid payment was submitted. Please see the docs.");
}
}
它看起来并不像你所使用的SDK的最新版本。我建议你这样做(对你的整合稍做改动)。 –