react-native-edfa-react
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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: "john.doe@example.com",
      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

Package Sidebar

Install

npm i react-native-edfa-react

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

46 kB

Total Files

24

Last publish

Collaborators

  • deep9824