0.1.17 • Published 2 years ago

mu.mips.react-native-sdk v0.1.17

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Installation

npm i mu.mips.react-native-sdk

Usage

1. import required classes

import {
  StartPayment,
  Amount,
  MerchantDetails,
  MerchantCredentials,
  Currency,
} from 'mu.mips.react-native-sdk';

2. create order data and merchant data models

const orderID = "YOUR_ORDER_ID";

const amount = new Amount(Currency.Mauritian_Rupee, 100);
// replace currency and amount with required values

const detail = new MerchantDetails(
	"XXXXX", //sIdMerchant
	"XXXXX", //id_entity
	"XXXXX", //id_operator
	"XXXXX", //operator_password
);

const cred = new MerchantCredentials(
	"XXXXX", //username
	"XXXXX". //password
);
// above info will be provided by MIPS admin

3. Finally call StartPayment function to start the payment flow

StartPayment(
	detail , cred , amount , orderID
).then((paymentMode) => {
	console.log("payment success with payment mode " + paymentMode)
}).catch( (error) => {
	console.log("payment failed with error " , error)
})

// StartPayment will show the payment screen and notify once payment status changes

for eg:- we can call StartPayment on click of a button

export default function App() {
  return (
    <View style={styles.container}>
      <Button
        onPress={() => {
          console.log('payment flow started');
          StartPayment(detail, cred, amount, orderID)
            .then((paymentMode) => {
              // payment completed
            })
            .catch((error) => {
              // payment failed
            });
        }}
        title="click to pay"
        color="#841584"
      />
    </View>
  );
}
0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.8

2 years ago

0.1.17

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago