react-native-edfa-react
v0.1.1
Published
edfa
Downloads
5
Readme
react-native-edfa-react
edfa
Installation
npm install react-native-edfa-react
Usage
import { initialize , payWithCard} from 'react-native-edfa-react';
export default function App() {
React.useEffect(() => {
// initialize
initialize("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxx", "https://api.edfapay.com/payment/post")
.then((message: string) => {
console.log(message);
})
.catch((error: any) => console.error(error));
}, []);
const payWithCards = () => {
const amount = 100.0;
const orderId = "12345";
const currency = "USD";
const description = "Product Description";
const cardType = "success"; // Use cardType from cardDetails
const payerDetails = {
firstName: "John",
lastName: "Doe",
address: "123 Main St",
country: "US",
city: "New York",
zip: "XXXXX",
email: "[email protected]",
phone: "XXXXXXXXXX",
ip: "XXX.XXX.X.X",
middleName: "",
address2: "",
state: "XX", // Merge additional payer details from cardDetails
};
const recurring = false;
const channelId = ""; // Optional, based on your requirements
const isAuth = true; // Example flag
payWithCard(
amount,
orderId,
currency,
description,
cardType,
payerDetails,
recurring,
channelId,
isAuth
)
.then((message: string) =>{
console.log("Transactipn successed",message.toString());
return Alert.alert('Payment Success')})
.catch((error: any) => {
console.log(error.toString());
Alert.alert('Payment Error', error.toString());
});
};
return (
<View style={styles.container}>
<Button title='Click for pay' onPress={()=>{payWithCards()}} />
</View>
);
}
// ...
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