Reputation: 81
I am trying to integrate payapal into my mobile app. I have been following this tutorial that I found. But when I try to make a payment I get an error saying Login failed: System error. Please try again. I'm not sure what the problem is. My login information is correct so I know that's not the problem. Can I get some help about this. Thanks in advance. Here is my code by the way
//Main activity
private static final int PAYPAL_REQUEST_CODE=7171;
private static PayPalConfiguration config=new PayPalConfiguration().environment(PayPalConfiguration.ENVIRONMENT_PRODUCTION)
.clientId(Config.PAYPAL_CLIENT_ID);
@Override
protected void onDestroy() {
stopService(new Intent(this, PayPalService.class));
super.onDestroy();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_all_in_one);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
overridePendingTransition(R.anim.fragment_close_exit, R.anim.fragment_fade_enter);
getWindow().setStatusBarColor(ContextCompat.getColor(this,R.color.black));
//start paypal service
Intent intent=new Intent(this,PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION,config);
startService(intent);
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==PAYPAL_REQUEST_CODE){
if(resultCode==RESULT_OK){
PaymentConfirmation confirmation=data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
if(confirmation!=null){
try {
String paymentDetails=confirmation.toJSONObject().toString(4);
startActivity(new Intent(this, PayPalPaymentDetails.class).
putExtra("Payment Details",paymentDetails)
.putExtra("Amount","5.00")
);
} catch (JSONException e) {
e.printStackTrace();
}
}
}else if(resultCode== Activity.RESULT_CANCELED){
Toast.makeText(this, "Cancel", Toast.LENGTH_SHORT).show();
}else if(resultCode==PaymentActivity.RESULT_EXTRAS_INVALID){
Toast.makeText(this, "Invalid", Toast.LENGTH_SHORT).show();
}
}
Upvotes: 0
Views: 1040