PayPal Web Payments native integration for React native and Expo.
npm install react-native-paypal-web-payments
import {
startCheckout,
PaypalEnvironment,
PayPalWebCheckoutFundingSource,
} from 'react-native-paypal-web-payments';
// ...
startCheckout({
clientID: "client-id",
environment: PaypalEnvironment.sandbox,
urlScheme: "url-scheme",
orderID: "order-id",
fundingSource: PayPalWebCheckoutFundingSource.paypal,
onEvent: (result) => {
console.log(result);
},
});
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
}
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>
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library