Closed davingss closed 4 years ago
Hello @Davingsdev can you share how you initiated the sdk, live or staging and what sdk version are you using?
Alright
Build.gradle (app)
implementation 'com.github.Flutterwave.rave-android:rave_android:2.1.1'
Build.gradle
maven { url 'https://jitpack.io' }
Live Mode
On Fragment.kt
val double: Double = amount.toDouble() RaveUiManager(this@MyFragment) .setAmount(double) .setCurrency("NGN") .setEmail("test@mail.com") .setfName("Tester") .setlName("Tester") .setNarration("Narration") .setPublicKey(publicKey) .setEncryptionKey(encryptKey) .setTxRef("12345") .acceptCardPayments(true) .onStagingEnv(false) .shouldDisplayFee(true) .showStagingLabel(false) .initialize()
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == RaveConstants.RAVE_REQUEST_CODE && data != null) { val message = data.getStringExtra("response") when (resultCode) { RavePayActivity.RESULT_SUCCESS -> { Log.i("tag", message!!) Toast.makeText(requireContext(), "SUCCESS $message", Toast.LENGTH_LONG).show() } RavePayActivity.RESULT_ERROR -> { Log.i("tag", message!!) Toast.makeText(requireContext(), "ERROR $message", Toast.LENGTH_LONG).show() } RavePayActivity.RESULT_CANCELLED -> { Log.i("tag", message!!) Toast.makeText(requireContext(), "CANCELLED $message", Toast.LENGTH_LONG).show() } } } }
The payment worked the first time...Then after the second try I got that error
According to the message you shared, the transaction failed because of "invalid token supplied", which means wrong otp or pin. Can you check that and ensure you passing the right thing
Before I put the OTP or pin this error comes up in the log message box (which is when the readymade Drop In UI comes up).
W/System.err: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $ W/System.err: at com.google.gson.Gson.fromJson(Gson.java:944) at com.google.gson.Gson.fromJson(Gson.java:897) W/System.err: at com.google.gson.Gson.fromJson(Gson.java:846) at com.flutterwave.raveandroid.rave_java_commons.NetworkRequestExecutor$1.onResponse(NetworkRequestExecutor.java:40) at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda$onResponse$0$DefaultCallAdapterFactory$ExecutorCallbackCall$1(DefaultCallAdapterFactory.java:89) W/System.err: at retrofit2.-$$Lambda$DefaultCallAdapterFactory$ExecutorCallbackCall$1$3wC8FyV4pyjrzrYL5U0mlYiviZw.run(Unknown Source:6) at android.os.Handler.handleCallback(Handler.java:790) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6524) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888) W/System.err: Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $ at com.google.gson.stream.JsonReader.nextString(JsonReader.java:826) W/System.err: at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:402) at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:390) W/System.err: at com.google.gson.Gson.fromJson(Gson.java:932) ... 12 more D/rave logger tag: Error parsing server response
Then after making payment I get that invalid token supplied
and I also got debited... I tried it more than 5 times and I got debited each time it happened...
@Davingsdev I tried replicating this, but I have not gotten this error. Please could you try again, and this time search your logs for "okhttp" and share the content of the logs as in the picture below.
I need to see the network calls made and the responses to them.
Okay @jeremiahAI I'll check it out
It works now after i made payment it showed a success response :
The funny thing is that I didn't make any changes to the code :
D/rave logger tag: Error parsing server response I/okhttp.OkHttpClient: <-- 200 OK https://api.ravepay.co/flwv3-pug/getpaidx/api/charge (4766ms) I/okhttp.OkHttpClient: Server: nginx/1.16.1 Date: Tue, 14 Jul 2020 16:28:13 GMT I/okhttp.OkHttpClient: Content-Type: application/json; charset=utf-8 I/okhttp.OkHttpClient: Content-Length: 1183 I/okhttp.OkHttpClient: Connection: keep-alive I/okhttp.OkHttpClient: x-powered-by: Express I/okhttp.OkHttpClient: access-control-allow-origin: * I/okhttp.OkHttpClient: access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, Authorization, v3-xapp-id, flw-auth-token, mra-auth-token, alt_mode_auth, mid access-control-allow-methods: PUT, POST, GET, DELETE, OPTIONS I/okhttp.OkHttpClient: etag: **W/"49f-p/Hp4ISOp6AUgOof1vPwDA"** I/okhttp.OkHttpClient: x-envoy-upstream-service-time: 4429 x-envoy-decorator-operation: rave-api.rave.svc.cluster.local:80/* I/okhttp.OkHttpClient: {"status":"success","message":"V-COMP","data":{"id":287838895,"txRef":"ref","orderRef":"URF_1594744089155_2572335","flwRef":"MindofworldNige/FLW274480402","redirectUrl":"https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint":"9edea****bf7d5","settlement_token":null,"cycle":"one-time","amount":1,"charged_amount":1,"appfee":0.02,"merchantfee":0,"merchantbearsfee":1,"chargeResponseCode":"02","raveRef":"RV31594744088893B60103F6BD","chargeResponseMessage":"Kindly enter the OTP sent to the mobile registered with your bank","authModelUsed":"PIN","currency":"NGN","IP":"::ffff:127.0.0.1","narration":"CARD Transaction ","status":"success-pending-validation","modalauditid":"163cc50b9e68a695d5dac677093ebec3","vbvrespmessage":"N/A","authurl":"N/A","vbvrespcode":"N/A","acctvalrespmsg":null,"acctvalrespcode":null,"paymentType":"card","paymentPlan":null,"paymentPage":null,"paymentId":"6420300","fraud_status":"ok","charge_type":"normal","is_live":0,"retry_attempt":null,"getpaidBatchId":null,"createdAt":"2020-07-14T16:28:09.000Z","updatedAt":"2020-07-14T16:28:12.000Z","deletedAt":null,"customerId":216429082, "AccountId":79409,"customercandosubsequentnoauth":false}} <-- END HTTP (1183-byte body) D/Surface: Surface::disconnect(this=0x8e363800,api=1)
But there's one problem that persists:
Once the default drop-in UI opens this error comes up
W/System.err: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $ W/System.err: at com.google.gson.Gson.fromJson(Gson.java:944) at com.google.gson.Gson.fromJson(Gson.java:897) at com.google.gson.Gson.fromJson(Gson.java:846) at com.flutterwave.raveandroid.rave_java_commons.NetworkRequestExecutor$1.onResponse(NetworkRequestExecutor.java:40) at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda$onResponse$0$DefaultCallAdapterFactory$ExecutorCallbackCall$1(DefaultCallAdapterFactory.java:89) at retrofit2.-$$Lambda$DefaultCallAdapterFactory$ExecutorCallbackCall$1$3wC8FyV4pyjrzrYL5U0mlYiviZw.run(Unknown Source:6) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6524) W/System.err: at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888) Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $ at com.google.gson.stream.JsonReader.nextString(JsonReader.java:826) at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:402) at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:390) at com.google.gson.Gson.fromJson(Gson.java:932) ... 12 more D/rave logger tag: Error parsing server response
I would like to know why this error still comes up even before making payment...Thanks
Hey @Davingsdev, it's probably a problem with parsing a background call. Will check it out.
Glad to hear you're no longer having the issue now. I'll be closing this issue. Cheers.
W/System.err: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $ W/System.err: at com.google.gson.Gson.fromJson(Gson.java:944) at com.google.gson.Gson.fromJson(Gson.java:897) W/System.err: at com.google.gson.Gson.fromJson(Gson.java:846) at com.flutterwave.raveandroid.rave_java_commons.NetworkRequestExecutor$1.onResponse(NetworkRequestExecutor.java:40) at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda$onResponse$0$DefaultCallAdapterFactory$ExecutorCallbackCall$1(DefaultCallAdapterFactory.java:89) W/System.err: at retrofit2.-$$Lambda$DefaultCallAdapterFactory$ExecutorCallbackCall$1$3wC8FyV4pyjrzrYL5U0mlYiviZw.run(Unknown Source:6) at android.os.Handler.handleCallback(Handler.java:790) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6524) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888) W/System.err: Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $ at com.google.gson.stream.JsonReader.nextString(JsonReader.java:826) W/System.err: at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:402) at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:390) W/System.err: at com.google.gson.Gson.fromJson(Gson.java:932) ... 12 more D/rave logger tag: Error parsing server response
{ "status":"success", "message":"Charge Complete", "data":{ "data":{ "responsetoken":null, "responsecode":"RR-T1" ,"responsemessage":"invalid token supplied", "transactionreference":"MindofworldNige/FLW273732546", "otptransactionidentifier":null, "responsehtml":null, "redirecturl":null, "avsresponsecode":null, "avsresponsemessage":null, "provider":null ,"dcc":null },"tx":{ "id":287529514,"txRef":"ref", "orderRef":"URF_1594654855629_1454535","flwRef":"MindofworldNige/FLW273732546" ,"redirectUrl":"https://rave-webhook.herokuapp.com/receivepayment", "device_fingerprint":"9******9bf7d5", "settlement_token":null,"cycle":"one-time","amount":1,"charged_amount":1,"appfee":0.02,"merchantfee":0,"merchantbearsfee":1,"chargeResponseCode":"02","raveRef":"RV3159****50320780***","chargeResponseMessage":"Kindly enter the OTP sent to the mobile registered with your bank","authModelUsed":"PIN","currency":"NGN","IP":"::ffff:127.0.0.1","narration":"CARD Transaction ","status":"failed","modalauditid":"47da3afaad126fdeec07f258ff9dfeff","vbvrespmessage":"invalid token supplied","authurl":"N/A","vbvrespcode":"RR-T1","acctvalrespmsg":null,"acctvalrespcode":null,"paymentType":"card", "paymentPlan":null,"paymentPage":null,"paymentId":"6420300","fraud_status":"ok","charge_type":"normal","is_live":0,"retry_attempt":null,"getpaidBatchId":null,"createdAt":"2020-07-13T15:40:55.000Z","updatedAt":"2020-07-13T15:42:56.000Z","deletedAt":null,"customerId":216323467,"AccountId":79409}}}
Please solving this issue early enough would be greatly appreciated...Thanks!!!