This is a Next.js project bootstrapped with create-next-app
.
This repo contains an example integration of a Next.js project with the PayHere Javascript SDK.
- Development and production versions of the
payhere.js
file are available in the "public" folder.
- public
- payhere.js
- payhere.dev.js
- In
index.js
, the appropriate script is loaded from this method:
function payHereURL(){
if (process && process.env.NODE_ENV == "production")
return '/payhere.js';
else
return '/payhere.dev.js';
}
- Include the PayHere Script as follows:
<script src={payHereURL()}></script>
- Check the
startPayment()
method inindex.js
to see how PayHere is integrated.
Run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.