Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop in ui not showing #7

Closed
jin9393 opened this issue Dec 5, 2016 · 8 comments
Closed

Drop in ui not showing #7

jin9393 opened this issue Dec 5, 2016 · 8 comments

Comments

@jin9393
Copy link

jin9393 commented Dec 5, 2016

I used async to fetch token from my server and at the end of the async i call the dropin function and nothing happen after that. However, when i hard coded the token into a string and place it into the dropin function the ui appear. Any way to solve this?

@quinnjn
Copy link
Contributor

quinnjn commented Dec 5, 2016

It sounds like fetching the token from the server is the issue since Drop-in launches fine with a hard coded client token.

You can verify your client token is correct by following these steps:

When Drop-in is passed a malformed authorization it finishes with an error.

This example usage in our README shows where that error is referenced back to your activity.

That exception will clue into why Drop-in is not starting.

@quinnjn
Copy link
Contributor

quinnjn commented Dec 13, 2016

@jin9393 I'm going to close this. Feel free to reopen it if you are still having issues.

@quinnjn quinnjn closed this as completed Dec 13, 2016
@jin9393
Copy link
Author

jin9393 commented Dec 13, 2016

Sorry I forget I posted here as i have been on email with braintree support team. Yes i am still facing the same error since that day.

onActivityResult, i cant cast data to exception. The drop-in ui is still not loading. I have sent over the whole code to the support team and still waiting for their feedback.

@quinnjn
Copy link
Contributor

quinnjn commented Dec 13, 2016

You shouldn't cast Intent data to an Exception. See our Usage example.

If some serializable extra exists under DropInActivity.EXTRA_ERROR then the exception will be there.

@jin9393
Copy link
Author

jin9393 commented Dec 14, 2016

My bad, I did exactly what is stated on the example and i got this when i try to log the exception.
"Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Exception".

@jin9393
Copy link
Author

jin9393 commented Dec 14, 2016

Another thing to take note is the onActivityResult resultCode. The resultCode is returning 1 and its not loading into resultCode == Activity.RESULT_OK, even though the drop-in is not loading

@quinnjn quinnjn reopened this Dec 14, 2016
@quinnjn
Copy link
Contributor

quinnjn commented Dec 14, 2016

when i try to log the exception.
"Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Exception"

Hmm, we do pass a string as a value for DropInActivity.EXTRA_ERROR when BraintreeFragment has an invalid argument which sounds like it would be the Client Token mentioned in your first comment. We should be passing the Exception back and not the String though so we'll work on a fix for that! This would be unrelated to the invalid argument that is being passed in though.

resultCode is returning 1 and its not loading into resultCode == Activity.RESULT_OK, even though the drop-in is not loading

This makes sense, Activity.RESULT_OK == -1. RESULT_OK would be used when Drop-in finishes successfully. If it has an issue it would not return RESULT_OK Activity.RESULT_FIRST_USER == 1 which is the value we use to represent that an error has happened when using Drop-in.

Please check the value you're getting back for DropInActivity.EXTRA_ERROR. If the error is Tokenization Key or client token was invalid we will know that the client token is malformed, and there is some issue with passing the String from your server.

@jin9393
Copy link
Author

jin9393 commented Dec 15, 2016

Yes client token was invalid. Thing have been solved. The token from the server pass in with a extra double quote and it was insert into the drop-in ui token. Was solved after removing it. Thanks you very much

@jin9393 jin9393 closed this as completed Dec 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants