GithubHelp home page GithubHelp logo

olympikesoft / react-native-paypal-wrapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taessina/react-native-paypal-wrapper

0.0 1.0 0.0 26.9 MB

React Native PayPal wrapper for iOS and Android

License: MIT License

Java 28.37% JavaScript 0.20% Objective-C 69.75% C++ 1.68%

react-native-paypal-wrapper's Introduction

react-native-paypal-wrapper

React Native PayPal wrapper for iOS and Android

Note: No longer maintained, happy to accept PR or takeover

Getting started

$ yarn add react-native-paypal-wrapper

Installation

$ react-native link react-native-paypal-wrapper

Extra steps for iOS ๐Ÿ™„ see here

Usage

Payment

import PayPal from 'react-native-paypal-wrapper';

// 3 env available: NO_NETWORK, SANDBOX, PRODUCTION
PayPal.initialize(PayPal.NO_NETWORK, "<your-client-id>");
PayPal.pay({
  price: '40.70',
  currency: 'MYR',
  description: 'Your description goes here',
}).then(confirm => console.log(confirm))
  .catch(error => console.log(error));

FuturePayment

import PayPal from 'react-native-paypal-wrapper';

// Required for Future Payments
const options = {
  merchantName : "Merchant name",
  merchantPrivacyPolicyUri: "https://example.com/privacy",
  merchantUserAgreementUri: "https://example.com/useragreement",
}
// 3 env available: NO_NETWORK, SANDBOX, PRODUCTION
PayPal.initializeWithOptions(PayPal.NO_NETWORK, "<your-client-id>", options);

PayPal.obtainConsent().then(authorization => console.log(authorization))
  .catch(error => console.log(error));

// To decrease payment declines, you must specify a metadata ID header (PayPal-Client-Metadata-Id) 
// in the payment call. See docs: 
// https://developer.paypal.com/docs/integration/mobile/make-future-payment/#required-best-practices-for-future-payments

const metadataID = await PayPal.getClientMetadataId();

Disclaimer

This project is created solely to suit our requirements, no maintenance/warranty are provided. Feel free to send in pull requests.

Acknowledgement

This project is inspired by MattFoley (which does not support both Android and iOS simultaneously, and shovelapps a fork of the former repo (which we had some problems trying to integrate due to React Native version).

react-native-paypal-wrapper's People

Contributors

alvinthen avatar

Watchers

James Cloos 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.