-
PayPal's library - onActivityResult -ANDROID
over 8 years ago
-
almost 8 years ago
Good
-
-
over 8 years ago
I implemented this, but there is that problem:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_PAYMENT) { if (resultCode == Activity.RESULT_OK) { PaymentConfirmation confirm = data .getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION); if (confirm != null) { try { Log.e("Show", "PAYPAL : " + confirm.toJSONObject().toString(4)); Log.e("Show", "PAYPAL : " + confirm.getPayment().toJSONObject() .toString(4)); /** * TODO: send 'confirm' (and possibly * confirm.getPayment() to your server for verification */ //totos.setText("Conferma di pagamento ricevuta da PayPal"); Toast.makeText(getApplicationContext(), "Conferma di pagamento ricevuta da PayPal", Toast.LENGTH_LONG).show(); String fromEmail = "xxxxx@gmail.com"; String fromPassword = "xxxxx"; String toEmails = "xxxxxxxx@hotmail.it"; String emailSubject = "ORDINE"; String emailBody = "testo di prova dell'ordine"; new SendMailTask(MainActivity.this).execute(fromEmail, fromPassword, toEmails, emailSubject, ordine); } catch (JSONException e) { Toast.makeText(getApplicationContext(), "Errore nel server di PayPal : ", Toast.LENGTH_LONG).show(); } } } else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) { Toast.makeText(getApplicationContext(), "Pagamento non valido.", Toast.LENGTH_LONG).show(); } } }
-
-
over 8 years ago
the problem is that if I send money and I disconnect internet before it gets the RESULT_OK , I cannot intercept the answer because I'm not connected, so I did not realize whether the payment succeded or not.
-
-
over 8 years ago
What can i do to fix this?
-
-
over 8 years ago
The problem is that if I unplug the connection during the transfer, an alert blocks the progress dialog that says "Transfer in progress", and does not return the RESULT_OK (even if the payment succeeded!).
-
-
over 8 years ago
I think for that moment if payment is transferred ,you must get the result in onActivityResult Because If there is no internet payment will not be successful.
-
6 Answer(s)