Skip to content

Instantly share code, notes, and snippets.

@SeraphimSerapis
Created November 19, 2012 15:56
Show Gist options
  • Save SeraphimSerapis/4111427 to your computer and use it in GitHub Desktop.
Save SeraphimSerapis/4111427 to your computer and use it in GitHub Desktop.
Activity result after payment
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_PAY) {
switch (resultCode) {
case RESULT_OK:
String payKey = data
.getStringExtra(PayPalActivity.EXTRA_PAY_KEY);
showToast("Payment succeeded - Key: " + payKey);
break;
case RESULT_CANCELED:
showToast("Payment got canceled");
break;
case PayPalActivity.RESULT_FAILURE:
String errorID = data
.getStringExtra(PayPalActivity.EXTRA_ERROR_ID);
String errorMessage = data
.getStringExtra(PayPalActivity.EXTRA_ERROR_MESSAGE);
showToast("Error (" + errorID + "): " + errorMessage);
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment