0.1.17 • Published 1 year ago

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

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.16

1 year ago

0.1.8

1 year ago

0.1.17

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago