PingPlusPlus / pingpp-android

414 stars 190 forks source link

微信支付问题,demo只能在微信第一次安装完的时候才能调起微信支付页面 #47

Closed sunkeding closed 6 years ago

sunkeding commented 7 years ago

微信支付问题,demo只能在微信第一次安装完的时候才能调起微信支付页面,后面无法再调起,都是返回-1。 D/PingActivity: doInBackground方法json={"amount":1,"channel":"wx"} 03-28 19:32:29.560 19809-20293/com.example.skd.myapp D/PingActivity: doInBackground方法返回的={ "id": "ch_5qHWTOnfzf109ibLG4XH8GiP", "object": "charge", "created": 1490700749, "livemode": true, "paid": false, "refunded": false, "app": "app_1azb18LK84u5iDSW", "channel": "wx", "order_no": "9b5248c014d6dc9c", "client_ip": "60.191.47.90", "amount": 1, "amount_settle": 1, "currency": "cny", "subject": "测试订单 by afon 20170328-193229", "body": "Your Body & 订单详情", "extra": {}, "time_paid": null, "time_expire": 1490701049, "time_settle": null, "transaction_no": null, "refunds": { "object": "list", "url": "/v1/charges/ch_5qHWTOnfzf109ibLG4XH8GiP/refunds", "has_more": false, "data": [] }, "amount_refunded": 0, "failure_code": null, "failure_msg": null, "metadata": { "ori_channel": "wx" }, "credential": { "object": "credential", "wx": { "appId": "wx452efc73f9397542", "partnerId": "1224524301", "prepayId": "3201033000170328eb5f0a3c65ebfc77", "nonceStr": "f2e512f3428863c6fcefc3caa74bfba0", "timeStamp": 1490700749, "packageValue": "Sign=WXPay", "sign": "117e0970657b09a1d2cbbb0e9dcfff28441b2c6b" } }, "description": null } 03-28 19:32:29.560 19809-19809/com.example.skd.myapp D/PingActivity: onPostExecute方法data={ "id": "ch_5qHWTOnfzf109ibLG4XH8GiP", "object": "charge", "created": 1490700749, "livemode": true, "paid": false, "refunded": false, "app": "app_1azb18LK84u5iDSW", "channel": "wx", "order_no": "9b5248c014d6dc9c", "client_ip": "60.191.47.90", "amount": 1, "amount_settle": 1, "currency": "cny", "subject": "测试订单 by afon 20170328-193229", "body": "Your Body & 订单详情", "extra": {}, "time_paid": null, "time_expire": 1490701049, "time_settle": null, "transaction_no": null, "refunds": { "object": "list", "url": "/v1/charges/ch_5qHWTOnfzf109ibLG4XH8GiP/refunds", "has_more": false, "data": [] }, "amount_refunded": 0, "failure_code": null, "failure_msg": null, "metadata": { "ori_channel": "wx" }, "credential": { "object": "credential", "wx": { "appId": "wx452efc73f9397542", "partnerId": "1224524301", "prepayId": "3201033000170328eb5f0a3c65ebfc77", "nonceStr": "f2e512f3428863c6fcefc3caa74bfba0", "timeStamp": 1490700749, "packageValue": "Sign=WXPay", "sign": "117e0970657b09a1d2cbbb0e9dcfff28441b2c6b" } }, "description": null } 03-28 19:32:30.530 19809-19809/com.example.skd.myapp D/PingActivity: result=fail 03-28 19:32:30.530 19809-19809/com.example.skd.myapp D/PingActivity: errorMsg=channel_returns_fail 03-28 19:32:30.530 19809-19809/com.example.skd.myapp D/PingActivity: extraMsg=wx_err_code:-1

dong11 commented 7 years ago

@sunkeding 是打包签名之后测的吗? 微信支付需要打包签名 包名和签名需和微信平台上一致

sunkeding commented 7 years ago

是打包之后测的,我们APP是这样的,之前的微信支付就已经集成进去了,现在有个单独的模块,需要接入ping++,打包之后,之前的微信支付方式还是正常的,可以无限次调用,但是ping++就不行; <activity android:name="com.pingplusplus.android.PaymentActivity" android:configChanges="orientation|screenSize" android:launchMode="singleTop" android:theme="@android:style/Theme.Translucent.NoTitleBar" >

        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>

            <category android:name="android.intent.category.BROWSABLE"/>
            <category android:name="android.intent.category.DEFAULT"/>

            <data android:scheme="qwalletcom.pingplusplus.demoapp"/>
        </intent-filter>

    </activity>

android:scheme 这里是填写qwallet+applicationId吧?
调用的时候: Pingpp.createPayment(PrivateCoachDetailActivity.this, data, "qwallet+applicationId");依旧不行额

dong11 commented 7 years ago

@sunkeding `

        <category android:name="android.intent.category.BROWSABLE"/>
        <category android:name="android.intent.category.DEFAULT"/>

        <data android:scheme="qwalletcom.pingplusplus.demoapp"/>
    </intent-filter>`这个是QQ钱包的  并不是微信的 
sunkeding commented 7 years ago

我这个已经删掉了,现在用的是 Pingpp.createPayment(PrivateCoachDetailActivity.this, data);,还是不行哦

dong11 commented 7 years ago

@sunkeding 你确定你的包名和签名是和微信平台上是对应的 在log中看你的应用包名为com.example.skd.myapp 应该是你测试用的吧

sunkeding commented 7 years ago

我现在用的是正式的APP的,等下,我日志给你看

sunkeding commented 7 years ago

03-29 10:26:48.316 18108-18152/com.leoao.fitness D/skd: doInBackground json={"amount":1,"channel":"wx"} 03-29 10:26:51.886 18108-18108/com.leoao.fitness D/skd: onPostExecute data={ "id": "ch_HqLivP9WbTKCP0a1C0bj90uH", "object": "charge", "created": 1490754412, "livemode": true, "paid": false, "refunded": false, "app": "app_1azb18LK84u5iDSW", "channel": "wx", "order_no": "999811ff537f21b2", "client_ip": "60.191.47.90", "amount": 1, "amount_settle": 1, "currency": "cny", "subject": "测试订单 by afon 20170329-102651", "body": "Your Body & 订单详情", "extra": {}, "time_paid": null, "time_expire": 1490754711, "time_settle": null, "transaction_no": null, "refunds": { "object": "list", "url": "/v1/charges/ch_HqLivP9WbTKCP0a1C0bj90uH/refunds", "has_more": false, "data": [] }, "amount_refunded": 0, "failure_code": null, "failure_msg": null, "metadata": { "ori_channel": "wx" }, "credential": { "object": "credential", "wx": { "appId": "wx452efc73f9397542", "partnerId": "1224524301", "prepayId": "320103300017032911567b15e4a4baf0", "nonceStr": "59b53fb579ee5b6d3c63eb7c5eeaf89a", "timeStamp": 1490754412, "packageValue": "Sign=WXPay", "sign": "2f44ecdea3ce3e6edc82bc81ed14735f017e9982" } }, "description": null }

dong11 commented 7 years ago

@sunkeding 这个charge是你们自己的?? 怎么感觉不是你们的???

sunkeding commented 7 years ago

是demo的

dong11 commented 7 years ago

@sunkeding 微信支付需要你自己的 wx的charge适合客户端关联的 不能用别人的

sunkeding commented 7 years ago

好的,我跟后台对接下- - -

faith-hb commented 7 years ago

按照这个思路在坚果pro7.0的系统上测试这个问题还是存在的,但换了个6.0的letv的手机,这个问题神奇的不见的,难道sdk不支持7.0了?但以前的版本还是可以的,动态换了包名就不行了

faith-hb commented 7 years ago

神奇,不断的在登入登出微信居然就可以了

dong11 commented 7 years ago

@faith-hb 核对包名和签名 把微信缓存清一下 之后再试试 微信可能会缓存apk的信息