0.5.0 • Published 10 months ago

@bounceapp/react-native-paypal v0.5.0

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

@bounceapp/react-native-paypal

Package version MIT license PRs Welcome

React Native wrapper to bridge PayPal iOS and Android SDK, support only requestBillingAgreement for the moment

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorExpo GOWeb

Documentation

API Reference.

Installation

yarn add @bounceapp/react-native-paypal react-native-svg

Bare Workflow

// android/app/src/main/AndroidManifest.xml
<activity
  android:name=".MainActivity"
  // ...
  >
  // ...
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="${applicationId}.braintree" />
  </intent-filter>
</activity>

Expo

// app.json
{
  "expo": {
    "android": {
      "intentFilters": [
        {
          "action": "VIEW",
          "data": [
            {
              "scheme": "${applicationId}.braintree"
            }
          ],
          "category": ["BROWSABLE", "DEFAULT"]
        }
      ]
    }
  }
}

Usage example

// App.tsx
import React, { useState } from "react"
import { Button } from "react-native"
import {
  requestBillingAgreement,
  PaypalButton,
} from "@bounceapp/react-native-paypal"

export default function App() {
  const [loading, setLoading] = useState(false)

  const onPress = async () => {
    const res = await requestBillingAgreement({
      clientToken: "CLIENT_TOKEN",
    })

    if (res?.error) {
      console.error(res?.error)
      return
    }

    setLoading(false)
  }

  return <PaypalButton onPress={onPress} disabled={loading} />
}

👏 Contributing

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

License

The source code is made available under the MIT license. Some of the dependencies can be licensed differently, with the BSD license, for example.

0.5.0

10 months ago

0.4.0

11 months ago

0.3.4

1 year ago

0.3.3

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago