我在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的最新版本。我建議你這樣做(對你的整合稍做改動)。 –