react-native-paypal-web-payments
TypeScript icon, indicating that this package has built-in type declarations

1.4.3 • Public • Published

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-button";
// ...
  <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

Package Sidebar

Install

npm i react-native-paypal-web-payments

Weekly Downloads

289

Version

1.4.3

License

MIT

Unpacked Size

54.5 kB

Total Files

54

Last publish

Collaborators

  • youedd