React Native wrapper to bridge PayPal iOS and Android SDK,
support only requestBillingAgreement
for the moment
Android Device | Android Emulator | iOS Device | iOS Simulator | Expo GO | Web |
---|---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
yarn add @bounceapp/react-native-paypal react-native-svg
// 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>
// app.json
{
"expo": {
"android": {
"intentFilters": [
{
"action": "VIEW",
"data": [
{
"scheme": "${applicationId}.braintree"
}
],
"category": ["BROWSABLE", "DEFAULT"]
}
]
}
}
}
// 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} />
}
See the contributing guide to learn how to contribute to the repository and the development workflow.
The source code is made available under the MIT license. Some of the dependencies can be licensed differently, with the BSD license, for example.