1.4.2 • Published 5 months ago

react-native-paypal-web-payments v1.4.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

react-native-paypal-web-payments

PayPal Web Payments native integration for React native and Expo.

Table of Contents

Installation

npm install react-native-paypal-web-payments

Setup

  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

    ```xml
    <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>
    ```
  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

1.4.2

5 months ago

1.4.1

5 months ago

1.4.0

5 months ago

1.3.1

5 months ago

1.3.0

5 months ago

1.2.7

5 months ago

1.2.6

5 months ago

1.2.5

5 months ago

1.2.4

5 months ago

1.2.3

5 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.2.0

6 months ago

1.0.0

6 months ago

1.1.0

6 months ago