Skip to content

youedd/react-native-paypal-web-payments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

react-native-paypal-web-payments

PayPal Web Payments native integration for React native and Expo.

Preview

Table of Contents

Installation

npm install react-native-paypal-web-payments

Setup

Bare React Native
  1. Add onNewIntent to the MainActivity in your app:

    import android.content.Intent
    // ...
    
    class MainActivity : ReactActivity() {
    
      // ...
      
      override fun onNewIntent(newIntent: Intent?) {
        super.onNewIntent(newIntent)
        intent = newIntent
      }
  2. Update your app's AndroidManifest.xml with your custom URL scheme in the intent-filter

    <activity
      android:name=".MainActivity"
      ...>
      ...
      <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="custom-url-scheme" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
      </intent-filter>
    </activity>
Expo
  1. Update expo config
    {
      "expo": {
        "scheme": "custom-url-scheme",
        "plugins": [
          "react-native-paypal-web-payments"
        ]
      }
    }

Usage

import {
  startCheckout,
  PaypalEnvironment,
  PayPalWebCheckoutFundingSource,
} from 'react-native-paypal-web-payments';
import { PayPalButton } from "react-native-paypal-buttons";
// ...
  <PayPalButton
    onPress={() => {
      startCheckout({
        clientID: "client-id",
        environment: PaypalEnvironment.sandbox,
        urlScheme: "url-scheme",
        orderID: "order-id",
        fundingSource: PayPalWebCheckoutFundingSource.paypal,
        onEvent: (result) => {
          console.log(result);
        },
      })
    }}
  />

Useful Links

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

About

Paypal Web Payments integration for React Native and Expo

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published