Moru Payment Gateway web sdk Read Full Documentation.
yarn add moru-web-sdk
npm install moru-web-sdk
import { MoruCheckout } from 'moru-web-sdk';
function App() {
const options = {
access_key: 'test_9425294388834bdface7d1b58fd538bf67627d9408fe4f2589820cf550a5003d',
transaction_id: '1',
additional_fields: {
name: 'Shubham Dhakal',
email: 'shubham@gmail.com',
},
callback_handler: {
onSuccess: (response) => {
console.log(response);
// call your api
alert('success');
},
onError: (error) => {
console.log(error);
alert('failure');
},
onClose: (error) => {
console.log(error);
},
},
};
const checkout = new MoruCheckout(options);
const handleMoruPayment = () => {
checkout.open({ amount: 100 });
};
return (
<div>
<button onClick={handleMoruPayment}>Pay with Moru</button>
</div>
);
}
export default App;