Skip to main content

React

React.js

Sample Code

import { SynapseSdk } from "synapse-js-sdk";

export default function Payment() {
var sdk = new SynapseSdk();

};

const initiatePayment = () => {
.then((res) => {
var request = {
merchantId: "MOCK-MERCHANT-101",
payload: res.data.payload,
};
var response = {
paymentStatus: "PAYMENT_SUCESS",
merchantPayload: "data",
};

sdk
.initiateSynapsePayment(JSON.stringify(request))
.then((val) => validateResponse(val));
})
.catch((error) => console.log(error));
};



return (
<div>
<Navbar bg="dark" variant="dark" expand="lg">
<Container>
<Navbar.Brand href="#home">
<Row>
<Col>
<BsFillArrowLeftCircleFill
onClick={() => {
navigate("/");
}}
/>
</Col>
<Col>Cart Review</Col>
</Row>
</Navbar.Brand>
</Container>
</Navbar>
<div
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
height: "100vh",
marginInline: "10px",
}}
>
<Container>
<Row className="mx-4 my-2">
<Button
size="lg"
variant="outline-primary"
onClick={initiatePayment}
>
Proceed To Pay
</Button>
</Row>
</Container>
</div>
</div>
);
}