https://github.com/droiddevgeeks/nextjscapacitorcashfreesample
https://github.com/droiddevgeeks/nextjscapacitorcashfreesample
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/droiddevgeeks/nextjscapacitorcashfreesample
- Owner: droiddevgeeks
- Created: 2024-08-16T11:35:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-09T18:16:32.000Z (10 months ago)
- Last Synced: 2025-08-09T20:27:46.909Z (10 months ago)
- Language: JavaScript
- Size: 520 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CashFree NextJs Capacitor SDK Sample
## **Description**
Sample integration project for CashFree Payment Gateway's in NextJs Capacitor platform.
## Installation:
Install the plugin
```bash
npm i @awesome-cordova-plugins/cashfree-pg@latest
npm i @awesome-cordova-plugins/core@latest
npm i cordova-plugin-cashfree-pg@capacitor
npx cap sync
npx cap sync android
npx cap run android
```
### Issue in awesome-cordova-plugins
https://github.com/danielsogl/awesome-cordova-plugins/issues/4284
``Cannot use import statement outside a module``
We have work around for this by using lazy loading
https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#with-external-libraries
```
const loadCashfreePg = () => import('@awesome-cordova-plugins/cashfree-pg');
const initiateWebPayment = async () => {
const {CFEnvironment, CFPaymentGateway, CFSession, CFWebCheckoutPayment} = await loadCashfreePg();
const callbacks = {
onVerify: function (result) {
console.log("This is in the SDK Verify: " + JSON.stringify(result));
},
onError: function (error) {
console.log("This is in the SDK Error: " + JSON.stringify(error));
}
};
CFPaymentGateway.setCallback(callbacks)
CFPaymentGateway.doWebCheckoutPayment(
new CFWebCheckoutPayment(
new CFSession("session_jOkl-xetsUdUiuVFxhPMhbIHh6UTI8hM_dOxgI3HBiCkjxGHkFHetws8ijujFDe3En3kiKLrYNZQEODPkr62bpS3kb7zufM1b5FzVnEncSFy",
"order_101024392kjkZw8fi4dAkMlUChfG9TYpHsI",
CFEnvironment.SANDBOX
),
null)
)
};
CashFree Payment
Start Payment
```
### Sample Video
https://github.com/user-attachments/assets/476d8655-a0e9-4647-a5ce-17d316966425