wepay

所属分类:支付接口
开发工具:kotlin
文件大小:0KB
下载次数:0
上传日期:2017-11-27 08:26:03
上 传 者sh-1993
说明:  易于集成微信支付和支付宝。,
(Simple to integrate wechat pay and alipay.,)

文件列表:
.idea/ (0, 2017-11-27)
.idea/dictionaries/ (0, 2017-11-27)
.idea/dictionaries/Threshold.xml (225, 2017-11-27)
.idea/gradle.xml (675, 2017-11-27)
.idea/misc.xml (1611, 2017-11-27)
.idea/modules.xml (444, 2017-11-27)
.idea/runConfigurations.xml (564, 2017-11-27)
LICENSE (11358, 2017-11-27)
app/ (0, 2017-11-27)
app/build.gradle (1306, 2017-11-27)
app/proguard-rules.pro (753, 2017-11-27)
app/src/ (0, 2017-11-27)
app/src/androidTest/ (0, 2017-11-27)
app/src/androidTest/java/ (0, 2017-11-27)
app/src/androidTest/java/com/ (0, 2017-11-27)
app/src/androidTest/java/com/threshold/ (0, 2017-11-27)
app/src/androidTest/java/com/threshold/wepay/ (0, 2017-11-27)
app/src/androidTest/java/com/threshold/wepay/ExampleInstrumentedTest.kt (640, 2017-11-27)
app/src/main/ (0, 2017-11-27)
app/src/main/AndroidManifest.xml (1802, 2017-11-27)
app/src/main/java/ (0, 2017-11-27)
app/src/main/java/com/ (0, 2017-11-27)
app/src/main/java/com/threshold/ (0, 2017-11-27)
app/src/main/java/com/threshold/wepay/ (0, 2017-11-27)
app/src/main/java/com/threshold/wepay/AliH5PayDemoActivity.java (5094, 2017-11-27)
app/src/main/java/com/threshold/wepay/AlipayFragment.kt (5839, 2017-11-27)
app/src/main/java/com/threshold/wepay/App.kt (808, 2017-11-27)
app/src/main/java/com/threshold/wepay/MainActivity.kt (1326, 2017-11-27)
app/src/main/java/com/threshold/wepay/MainActivityFragment.kt (955, 2017-11-27)
app/src/main/java/com/threshold/wepay/MainFragmentViewPageAdapter.kt (580, 2017-11-27)
app/src/main/java/com/threshold/wepay/WechatPayFragment.kt (2451, 2017-11-27)
app/src/main/java/com/threshold/wepay/util/ (0, 2017-11-27)
app/src/main/java/com/threshold/wepay/util/ToastUtil.kt (2163, 2017-11-27)
app/src/main/res/ (0, 2017-11-27)
app/src/main/res/drawable/ (0, 2017-11-27)
app/src/main/res/drawable/ic_launcher_background.xml (3703, 2017-11-27)
... ...

# WePay [![](https://jitpack.io/v/wind0ws/wepay.svg)](https://jitpack.io/#wind0ws/wepay) English|[中文](https://github.com/wind0ws/wepay/blob/master/README-zh.md) # Features * Support wechat pay and alipay in one library. * Easy to listen pay status and result. * Easy to config and easy to use. ## [Getting started](https://jitpack.io/#wind0ws/wepay) The first step is to include WePay into your project, for example, as a Gradle compile dependency: Because of using [jitpack.io](https://jitpack.io/),so we need add the jitpack.io repository in your root project gradle: ```groovy allprojects { repositories { jcenter() //...some other repo. maven { url "https://jitpack.io" } } } ``` and then add wepay dependency in your module gradle: ```groovy implementation "com.github.wind0ws:wepay:1.0.0" ``` > for gradle version below 3.0, just replace keyword ```implementation``` to ```compile``` We are done for integration. ## Now we write the [hello world app](https://github.com/wind0ws/wepay/blob/master/app/src/main/java/com/threshold/wepay). First and foremost: You should apply appId,appSecret for alipay and wechat pay. You can apply it on there official website. The flow of pay is : 1. Create your [order object](https://github.com/wind0ws/wepay/blob/master/pay/src/main/java/com/threshold/pay/order/OrderInfo.kt). 2. Create your pay config: AlipayConfig and WechatPayConfig. 3. Let your activity or fragment implement [PayStatusListener](https://github.com/wind0ws/wepay/blob/master/pay/src/main/java/com/threshold/pay/PaymentConfig.kt) for listen pay status and result. 4. Start [PayEntryActivity](https://github.com/wind0ws/wepay/blob/master/pay/src/main/java/com/threshold/pay/PayEntryActivity.kt) for pay. >The full of demo is in this project app module. * ### [Alipay](https://github.com/wind0ws/wepay/blob/master/app/src/main/java/com/threshold/wepay/AlipayFragment.kt) ```Kotlin PayEntryActivity.payStatusListener = this val payConfig = AliPayConfig(alipayAppId, rsaPrivateKey,false) val orderInfo = OrderInfo("admin",OrderUtils.createOutTradeNo(),123,"OrderTitle-admin-2017.10.11", "Order detail", Date()) PayEntryActivity.startAliPay(context,orderInfo,payConfig) ``` * ### [Wechat](https://github.com/wind0ws/wepay/blob/master/app/src/main/java/com/threshold/wepay/WechatPayFragment.kt) > Attention please: > because of wechat pay sdk restrict app pay entry activity name, so you should set this library PayEntryActivity alias to your manifest. such as: ```groovy ``` Now we write code for wechat pay. ```Kotlin PayEntryActivity.payStatusListener = this val payConfig = WechatPayConfig("appid","appSecret","corpId","merchantId", "http://www.notifyUrl") val orderInfo = OrderInfo("admin", OrderUtils.createOutTradeNo(),123,"OrderTitle-admin-2017.10.11", "Order detail", Date()) PayEntryActivity.startWeChatPay(context,orderInfo,payConfig) ``` ## Proguard See library [proguard-rules.pro](https://github.com/wind0ws/wepay/blob/master/pay/proguard-rules.pro) file. ## LICENSE Copyright (c) 2017-present, WePay Contributors. 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.

近期下载者

相关文件


收藏者