All Projects → Cuieney → Rxpay

Cuieney / Rxpay

一个集成支付宝微信的支付工具

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Rxpay

Bilibili Android Client
An unofficial bilibili client for android http://www.jianshu.com/p/f69a55b94c05 -- 该项目已停止维护!
Stars: ✭ 4,430 (+669.1%)
Mutual labels:  rxjava
Payumbundle
Payum offers everything you need to work with payments. From simplest use cases to very advanced ones.
Stars: ✭ 509 (-11.63%)
Mutual labels:  payment
Rxjava2 Android Samples
RxJava 2 Android Examples - Migration From RxJava 1 to RxJava 2 - How to use RxJava 2 in Android
Stars: ✭ 4,950 (+759.38%)
Mutual labels:  rxjava
Rxanimations
Repository for android animations Rx wrapper
Stars: ✭ 488 (-15.28%)
Mutual labels:  rxjava
Traceur
Easier RxJava2 debugging with better stacktraces
Stars: ✭ 502 (-12.85%)
Mutual labels:  rxjava
Android Starter
[Android Architecture] Android starter based on MVP/Dagger2/RxJava2/Robolectric/Espresso/Mockito. It provides a generator to fast create a Android template project.
Stars: ✭ 522 (-9.37%)
Mutual labels:  rxjava
Reprint
A unified fingerprint library for android.
Stars: ✭ 467 (-18.92%)
Mutual labels:  rxjava
Effective Rxjava
Effective RxJava
Stars: ✭ 563 (-2.26%)
Mutual labels:  rxjava
Rxfirebase
Rxjava 2.0 wrapper on Google's Android Firebase library.
Stars: ✭ 509 (-11.63%)
Mutual labels:  rxjava
Rxblur
用RxJava处理和操作高斯模糊效果的简单用例。
Stars: ✭ 541 (-6.08%)
Mutual labels:  rxjava
Rxjavafx
RxJava bindings for JavaFX
Stars: ✭ 489 (-15.1%)
Mutual labels:  rxjava
Vertx Guide For Java Devs
Vert.x 3 guide for Java developers
Stars: ✭ 500 (-13.19%)
Mutual labels:  rxjava
Hello Rxjava
可能是学习Rxjava最好的教程之一,另一个是《给Android开发者RxJava的详解》,这个毫无疑问。
Stars: ✭ 526 (-8.68%)
Mutual labels:  rxjava
Viabus Architecture
让 Android 开发可以像流水线一样高效的,职责分离架构 ⚡ 不同于 MVP 的配置解耦,也不能和 似是而非 的 MVVM - Clean 同日而语。VIABUS 是世界范围内首个明确提出,通过职责分离,来真正实现 UI 和 业务并行开发的 Android 项目级开发架构和设计模式理念。
Stars: ✭ 485 (-15.8%)
Mutual labels:  rxjava
Pay
个人网站即时到账收款解决方案 / Personal website instant payment solution
Stars: ✭ 558 (-3.12%)
Mutual labels:  payment
Payment
💰 A jQuery-free general purpose library for building credit card forms, validating inputs and formatting numbers.
Stars: ✭ 467 (-18.92%)
Mutual labels:  payment
Flutter Dribbble Challenge
A Flutter ui kit made with designs from dribbble.
Stars: ✭ 514 (-10.76%)
Mutual labels:  payment
Rxweather
Architecting Android with RxJava
Stars: ✭ 570 (-1.04%)
Mutual labels:  rxjava
Omnipay Alipay
Alipay driver for the Omnipay PHP payment processing library
Stars: ✭ 559 (-2.95%)
Mutual labels:  payment
Retrofitclient
基于Retrofit2.x和Rxjava2.x封装的请求工具类(内含Retrofit2.x & rxjava1.x)
Stars: ✭ 532 (-7.64%)
Mutual labels:  rxjava

What's RxPay ?

让支付从此简单下去,一键支付功能,支持支付宝支付,微信支付

集成步骤

Java 项目配置

dependencies {
    compile 'com.cuieney:rxpay-api:2.2.3'
    annotationProcessor 'com.cuieney:rxpay-compiler:2.1.1'
    //如果你项目配置了kotlin请忽略下面这行的配置
    //否则会报错 Failed resolution of: Lkotlin/jvm/internal/Intrinsics
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}

Kotlin 项目配置

apply plugin: 'kotlin-kapt'

dependencies {
    compile 'com.cuieney:rxpay-api:2.2.3'
    kapt 'com.cuieney:rxpay-compiler:2.1.1'
}

添加权限

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

支付宝

清单文件注册支付宝相关 Activity

<!-- 支付宝 -->
<activity
    android:name="com.alipay.sdk.app.H5PayActivity"
    android:configChanges="orientation|keyboardHidden|navigation|screenSize"
    android:exported="false"
    android:screenOrientation="behind"
    android:windowSoftInputMode="adjustResize|stateHidden"/>
<activity
    android:name="com.alipay.sdk.app.H5AuthActivity"
    android:configChanges="orientation|keyboardHidden|navigation"
    android:exported="false"
    android:screenOrientation="behind"
    android:windowSoftInputMode="adjustResize|stateHidden"/>

发起支付宝支付

new RxPay(this)
        .requestAlipay("服务器产生的订单信息")
        .subscribe(new Consumer<Boolean>() {
            @Override
            public void accept(Boolean aBoolean) throws Exception {
                payState.setText("阿里支付状态:"+aBoolean);
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {
                payState.setText("阿里支付状态:"+throwable.getMessage());
            }
        });

微信

在 Application 类中添加支付节点

@WX(packageName = "微信支付注册keystore时候的包名")
public class XXActivity extends Activity {
	
}

在AndroidManifest添加你微信支付的appid 和PARTNER_ID商户号(固定不变的),apiKey(商户平台设置的密钥key获取方法,可以问后台要可以到微信商户平台(pay.weixin.qq.com)-->账户设置-->API安全-->密钥设置)

<!-- WX_APPID必填项 -->
<meta-data
    android:name="WX_APPID"
    android:value="xxxxx" />

<!-- 非必填项,此处填写后,请求json的partnerId字段就可以不填  -->
<meta-data
    android:name="PARTNER_ID"
    android:value="xxxx" />

<!-- 非必填项,此处填写后,请求json的sign字段就可以不填(即App端签名)  -->
<meta-data
    android:name="API_KEY"
    android:value="xxxxx" />

在清单文件中注册微信相关的Activity,添加完之后会报错,使用 ReBuild 或者重新运行就不会了,这个 Activity 会被自动生成

<activity
    android:name=".wxapi.WXPayEntryActivity"
    android:exported="true"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustPan" />

发起微信支付

new RxPay(this)
        .requestWXpay(("服务器生成订单的后拼接成下面这种json字符串"))
        .subscribe(new Consumer<Boolean>() {
            @Override
            public void accept(Boolean aBoolean) throws Exception {
                payState.setText("微信支付状态:"+aBoolean);
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {
                payState.setText("微信支付状态:"+throwable.getMessage());
            }
        });

对应的json格式参考

1.格式一(Manifest三个参数全设置了)
{
    "prepayId": "必填项",
}
2.格式二(Manifest设置了PARTNER_ID 没有设置API_KEY)
{
    "nonceStr": "必填项",
    "partnerId": "必填项",
    "packageValue": "必填项",
    "prepayId": "必填项",
    "sign": "必填项",
    "timeStamp": "必填项"
}

示例代码

混淆规则

-keep class com.alipay.android.app.IAlixPay{*;}
-keep class com.alipay.android.app.IAlixPay$Stub{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
-keep class com.alipay.sdk.app.PayTask{ public *;}
-keep class com.alipay.sdk.app.AuthTask{ public *;}
-keep class com.alipay.sdk.app.H5PayCallback {
    <fields>;
    <methods>;
}
-keep class com.alipay.android.phone.mrpc.core.** { *; }
-keep class com.alipay.apmobilesecuritysdk.** { *; }
-keep class com.alipay.mobile.framework.service.annotation.** { *; }
-keep class com.alipay.mobilesecuritysdk.face.** { *; }
-keep class com.alipay.tscenter.biz.rpc.** { *; }
-keep class org.json.alipay.** { *; }
-keep class com.alipay.tscenter.** { *; }
-keep class com.ta.utdid2.** { *;}
-keep class com.ut.device.** { *;}

-dontwarn com.alipay.**

其他问题

  • 对于调起微信支付的json的字段请参考以上的json

  • 以下的过度版本可以解决依赖包冲突问题

    • com.cuieney:rxpay-api:2.1.11 版本 阿里jar包 微信依赖 都已剔除

    • com.cuieney:rxpay-api:2.1.12 版本只剔除 阿里jar包

    • com.cuieney:rxpay-api:2.2.2 版本只剔除 微信依赖

  • 如果项目中还有Rxjava版本1的话为了防止代码冲突 请在build.gradle里面添加一下代码

packagingOptions {
    exclude 'META-INF/rxjava.properties'
}

问题

发现bug或好的建议欢迎 issues or Email [email protected] 感谢大家的支持

微信交流群

二维码过期加我微信拉你入群(love418107357)

License

Copyright 2017 Cuieney

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].