{"id":15002295,"url":"https://github.com/prabapro/payhere-with-netlify-functions","last_synced_at":"2026-03-17T15:02:48.177Z","repository":{"id":220334197,"uuid":"751341141","full_name":"prabapro/payhere-with-netlify-functions","owner":"prabapro","description":"A Jamstack demo app using payhere.lk payment gateway with Netlify Functions \u0026 Fauna DB","archived":false,"fork":false,"pushed_at":"2024-02-05T04:19:17.000Z","size":142,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T03:47:42.615Z","etag":null,"topics":["faunadb","jamstack","netlify-functions","payhere-javascript-sdk","payherelk"],"latest_commit_sha":null,"homepage":"https://payhere-with-netlify-functions.nfapps.prabapro.me","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prabapro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-01T12:20:31.000Z","updated_at":"2024-02-02T03:49:20.000Z","dependencies_parsed_at":"2024-02-01T14:41:45.855Z","dependency_job_id":"f4eca5e8-8b0a-46c4-9545-7f2c3bd1a68c","html_url":"https://github.com/prabapro/payhere-with-netlify-functions","commit_stats":null,"previous_names":["prabapro/payhere-with-netlify-functions"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prabapro%2Fpayhere-with-netlify-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prabapro%2Fpayhere-with-netlify-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prabapro%2Fpayhere-with-netlify-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prabapro%2Fpayhere-with-netlify-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prabapro","download_url":"https://codeload.github.com/prabapro/payhere-with-netlify-functions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243141264,"owners_count":20242827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["faunadb","jamstack","netlify-functions","payhere-javascript-sdk","payherelk"],"created_at":"2024-09-24T18:49:28.065Z","updated_at":"2025-12-24T14:28:25.005Z","avatar_url":"https://github.com/prabapro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Payhere Payment Gateway with Netlify Functions \u0026 Fauna DB\n\n[![Netlify Status](https://api.netlify.com/api/v1/badges/2980db89-af0d-47f1-84f0-ef19414bead6/deploy-status)](https://app.netlify.com/sites/praba-payhere-with-netlify-functions/deploys)\n\nA Node.js app to integrate Payhere.lk payment gateway using Netlify Functions \u0026 Fauna DB.\n\n- [Payhere JavaScript SDK](https://support.payhere.lk/api-\u0026-mobile-sdk/javascript-sdk)\n- [Payhere Test Cards](https://support.payhere.lk/sandbox-and-testing)\n\n## 🚀 Getting started\n\n1. Clone the repo \u0026 run `npm install` to install the dependencies.\n2. Setup the [Fauna DB](#fauna-db) connection \u0026 create the collection \u0026 index.\n3. Add [Environment Variables](#environment-variables) to `.env` file.\n\n## 👨‍💻 Development Environment\n\nTo ensure the seamless functioning of the entire funnel, follow these steps:\n\n- Execute both `netlify dev` and set up `ngrok` to examine the complete process. This is necessary as Payhere requires a public-facing URL for the `notify_url`.\n- If the repository is already linked to a Netlify site, simply run `netlify dev --live` without the need for ngrok. You can use `netlify link` to connect the repository and the Netlify site efficiently.\n\n### Fauna DB\n\n- Create a Database in US Region Group.\n- Go to the Database \u003e Security \u003e Create a secret key with the server role.\n- Add the key to the `.env` file as `FAUNA_SECRET_KEY`\n- Run below to create the collection `payhere-demo-orders` \u0026 index `orders_by_order_id`\n  ```shell\n  node faunadb/faunaSetup.js\n  ```\n\n### Environment Variables\n\n- Generate `.env` file from `.env.example` and add your env variables.\n  ```shell\n  cp .env.example .env\n  ```\n- If new keys are added to the `.env` file, run below command to update the example file with new keys.\n  ```shell\n  sed 's/=.*/=/' .env \u003e .env.example\n  ```\n\n## FAQ\n\n**1. Why Netlify Functions?**\n\n- 🔐 **Security**: The Payhere Merchant Secret is required for generating the hash. Performing this operation on the front-end poses security risks. Netlify Functions act as a secure backend for handling the hash generation process.\n- 📡 **Server Callback**: Netlify Functions listen to payment notifications from PayHere, facilitating the passing of relevant information to the front-end.\n\n**2. Why Fauna DB?**\n\n- 🏦 **Payment Status Handling**: Since PayHere doesn't provide payment status parameters to the `return_url` during customer redirection, updating the database upon fetching payment status via your `notify_url` script is crucial.\n- 🏢 **Modern Database Solution**: Fauna DB is a cloud-native database with a flexible document data model. It seamlessly integrates semi-structured data with powerful relational features, including foreign keys, views, and joins.\n- 🔁 **Efficient Data Retrieval:** Integration with Fauna DB allows you to efficiently retrieve payment status \u0026 display to customers on the `return_url` page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprabapro%2Fpayhere-with-netlify-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprabapro%2Fpayhere-with-netlify-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprabapro%2Fpayhere-with-netlify-functions/lists"}