android - Unlocks app even after payment decline -
i develop app in app version 2 , publish on developers google 1 download app , try purchase it. on purchasing message showed him "your card decline" after message app got "unlock" . difficult situation payment not made while app got unlock. issue in app billing method(logic) in app or google.
if in app there method check person card "declined card" in method can restrict app not unlock app.
any app appreciated.
i have code in billingreceviver:
@override public void onreceive(context context, intent intent) { string action = intent.getaction(); if (consts.action_purchase_state_changed.equals(action)) { string signeddata = intent.getstringextra(consts.inapp_signed_data); string signature = intent.getstringextra(consts.inapp_signature); purchasestatechanged(context, signeddata, signature); } else if (consts.action_notify.equals(action)) { string notifyid = intent.getstringextra(consts.notification_id); if (consts.debug) { log.i(tag, "notifyid: " + notifyid); } notify(context, notifyid); } else if (consts.action_response_code.equals(action)) { long requestid = intent.getlongextra(consts.inapp_request_id, -1); int responsecodeindex = intent.getintextra(consts.inapp_response_code, responsecode.result_error.ordinal()); checkresponsecode(context, requestid, responsecodeindex); } else { log.w(tag, "unexpected action: " + action); } }
after making action_purchase_state_changed matches action purchsedstatechanged calls in file billingservice
private void purchasestatechanged(int startid, string signeddata, string signature) { arraylist<security.verifiedpurchase> purchases; databasehandler db=new databasehandler(this); purchases = security.verifypurchase(signeddata, signature); if (purchases == null) { return; } arraylist<string> notifylist = new arraylist<string>(); (verifiedpurchase vp : purchases) { if (vp.notificationid != null) { notifylist.add(vp.notificationid); } responsehandler.purchaseresponse(this, vp.purchasestate, vp.productid, vp.orderid, vp.purchasetime, vp.developerpayload); db.adduser("com.example.app", "111", "1222"); log.i("usgdgfer",""+db.isuserpresent("com.example.app")); } if (!notifylist.isempty()) { string[] notifyids = notifylist.toarray(new string[notifylist.size()]); confirmnotifications(startid, notifyids); } }
usually, card has mapped google wallet account before purchase made. if card invalid, show error while map card google account.
seems strange card being validated during purchase. then, if payment not made , should error response
billing_response_result_user_canceled = 1; billing_response_result_billing_unavailable = 3;
check if handle these errors after receive them in iabresult. make sure unlock app when receive proper response.
Comments
Post a Comment