react native paymob sdk
yarn add https://github.com/a-eid/react-native-paymob
IOS installation is almost automatic, the one thing you need to do is to create an empty Swift
file in your project.
file name does not matter ( I think )
choose create bridging header.
there should be a swift file and a bridging header in your project.
1- in AndroidManifest.xml
- add
xmlns:tools="http://schemas.android.com/tools"
tomanifest
tag - make sure to have these 2 attributes in the
application
tagandroid:supportsRtl="false"
tools:replace="android:supportsRtl, android:allowBackup"
- make sure to have the following values in
android/app/res/values/colors.xml
( create the file if you don't have it already )
<resources>
<color name="white">#FFF</color>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#03DAC5</color>
<color name="colorAccent">#03DAC5</color>
<color name="ThemeColor"> #FF0000 </color>
</resources>
import { Paymob, useDidDismissPaymob } from 'react-native-paymob';
useDidDismissPaymob(
// make sure to not use destruction here to get proper typing.
// & use React.useCallback
React.useCallback((data) => {
console.log(data);
}, [])
);
// some event handler
Paymob.presentPayVC({
billingData: {
apartment: 'NA',
email: 'NA',
floor: 'NA',
first_namae: 'NA',
street: 'NA',
building: 'NA',
phone_number: 'NA',
shipping_method: 'NA',
postal_code: 'NA',
city: 'NA',
country: 'NA',
last_name: 'NA',
state: 'NA',
},
paymentKey: "your payment key",
saveCardDefault: false,
showSaveCard: false,
showAlerts: false,
isEnglish: true,
showScanCardButton: false,
});
the library was created to cover our use case only, but we are open to adding more features if we have the time.
All Pull Requests are welcome See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT