Coder Social home page Coder Social logo

mrhlf1 / react-native-payment-alipay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from myoula/react-native-payment-alipay

0.0 0.0 0.0 7.6 MB

优先建议使用 https://www.npmjs.com/package/react-native-yunpeng-alipay

Java 40.69% JavaScript 2.51% Objective-C 56.80%

react-native-payment-alipay's Introduction

react-native-payment-alipay

React Native Module for alipay.com

install

npm install react-native-payment-alipay --save

Android

With rnpm

rnpm link react-native-payment-alipay

Manually

  • android/settings.gradle
include ':react-native-payment-alipay'
project(':react-native-payment-alipay').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-payment-alipay/android')
  • android/app/build.gradle
dependencies {
    compile project(':react-native-payment-alipay')
}
  • register module (in MainActivity.java)
...

import com.payment.alipay.AlipayPackage; // <--- IMPORT

public class MainActivity extends ReactActivity {

    ...

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new AlipayPackage() // <--- ADD HERE
        );
    }
}

iOS

With rnpm

rnpm link react-native-payment-alipay

Manually

Link AlipayModule library from your node_modules/react-native-payment-alipay/ios folder like its described here. Don't forget to add it to "Build Phases" of project.

Config

  • Added the following libraries to your "Link Binary With Libraries":

    • CoreMotion.framework
    • CoreTelephony.framework
    • libc++
    • libz
  • add URL Schema as your app id for URL type in Targets - info

  • Make sure you have these code in AppDelegate.m to enable callback

#import "AlipayModule.h"
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  [AlipayModule handleCallback:url];
  return YES;
}

General Usage

import Alipay from 'react-native-payment-alipay';
Alipay.pay("signed pay info string").then(function(data){
                    console.log(data);
                }, function (err) {
                    console.log(err);
                });

react-native-payment-alipay's People

Contributors

davidruisinger avatar gameboyvito avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.