How to handle error mesage from Credit card activity?
Expected behavior
I am using Credit Card Activity, and as far I know, I should handle the result in here
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_CANCELED) {
// handle the cancellation
return
}
if (requestCode == REQUEST_CC) {
val token = data?.getParcelableExtra<Token>(EXTRA_TOKEN_OBJECT)
// process your token here
}
}
I have two questions.
- how to distinguish if I get error or paid successfully using credit card? because it seems like I still get the token id event if I test Insufficent Fund Case
on iOS SDK, I can differentiate very easily using the code below
extension ViewController: CreditCardFormViewControllerDelegate {
func creditCardFormViewController(_ controller: CreditCardFormViewController, didSucceedWithToken token: Token) {
dismissCreditCardForm()
// Sends `Token` to your server to create a charge, or a customer object.
}
func creditCardFormViewController(_ controller: CreditCardFormViewController, didFailWithError error: Error) {
dismissCreditCardForm()
// Only important if we set `handleErrors = false`.
// You can send errors to a logging service, or display them to the user here.
}
}
- How to get the string error message?
Actual behavior
this is not a bug actually
Steps to reproduce the issue
this is not a bug actually
Logs
No response
Screenshots
No response
Name and version information
implementation 'co.omise:omise-android:4.+'
@AgungLaksana Thanks for reaching out. We appreciate your inquiry and look into this. We will provide you with an update soon.
Hello @AgungLaksana ,
The token creation for insufficient funds test card will be successful as the token will be used to create a charge and then the charge status will be failed. So the api calls will not fail, it will just have a different status at the charge level. The error processing is handled by the SDK side so you will receive the token only when the process is successful.
We’re going to close this since there hasn’t been any activity for a while. If this issue is still relevant, please feel free to reopen it with more details and we’ll take another look.