{"id":28515964,"url":"https://github.com/keygen-sh/example-moonclerk-integration","last_synced_at":"2026-07-15T20:02:36.178Z","repository":{"id":92546922,"uuid":"107432282","full_name":"keygen-sh/example-moonclerk-integration","owner":"keygen-sh","description":"An example Node.js app that integrates Keygen with MoonClerk for accepting payments.","archived":false,"fork":false,"pushed_at":"2017-10-29T20:48:16.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-02T13:23:14.453Z","etag":null,"topics":["keygen","license-keys","licensing","moonclerk","platform-example","sample-code","software-licensing"],"latest_commit_sha":null,"homepage":"https://keygen.sh/integrate/moonclerk","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keygen-sh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-10-18T16:11:10.000Z","updated_at":"2023-07-25T14:12:13.000Z","dependencies_parsed_at":"2023-03-07T02:15:13.017Z","dependency_job_id":null,"html_url":"https://github.com/keygen-sh/example-moonclerk-integration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/keygen-sh/example-moonclerk-integration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keygen-sh%2Fexample-moonclerk-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keygen-sh%2Fexample-moonclerk-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keygen-sh%2Fexample-moonclerk-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keygen-sh%2Fexample-moonclerk-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keygen-sh","download_url":"https://codeload.github.com/keygen-sh/example-moonclerk-integration/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keygen-sh%2Fexample-moonclerk-integration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35519051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-15T02:00:06.706Z","response_time":131,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["keygen","license-keys","licensing","moonclerk","platform-example","sample-code","software-licensing"],"created_at":"2025-06-09T03:31:28.891Z","updated_at":"2026-07-15T20:02:36.173Z","avatar_url":"https://github.com/keygen-sh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example Keygen + MoonClerk integration\nThe following web app is written in Node.js and shows how to integrate\n[Keygen](https://keygen.sh) and [MoonClerk](https://moonclerk.com) together\nusing an embed form \"redirect\". Much more could be done to automate e.g.\nlicense revocation when a subscription is canceled, etc. by utilizing [the\nfull suite of webhooks offered by Stripe](https://github.com/keygen-sh/example-stripe-integration).\n\n\u003e **This example application is not 100% production-ready**, but it should\n\u003e get you 90% of the way there. You may need to add additional logging,\n\u003e error handling, validation, features, etc.\n\n## Running the app locally\n\nFirst up, configure a few environment variables:\n```bash\n# Your MoonClerk API key\nexport MOONCLERK_API_KEY=\"YOUR_MOONCLERK_API_KEY\"\n\n# Keygen product token (don't share this!)\nexport KEYGEN_PRODUCT_TOKEN=\"YOUR_KEYGEN_PRODUCT_TOKEN\"\n\n# Your Keygen account ID\nexport KEYGEN_ACCOUNT_ID=\"YOUR_KEYGEN_ACCOUNT_ID\"\n\n# The Keygen policy to use when creating licenses for new customers\n# after they successfully purchase your product\nexport KEYGEN_POLICY_ID=\"YOUR_KEYGEN_POLICY_ID\"\n```\n\nYou can either run each line above within your terminal session before\nstarting the app, or you can add the above contents to your `~/.bashrc`\nfile and then run `source ~/.bashrc` after saving the file.\n\nNext, install dependencies with [`yarn`](https://yarnpkg.comg):\n```\nyarn\n```\n\nThen start the app:\n```\nyarn start\n```\n\n## Testing redirects locally\n\nFor local development, create an [`ngrok`](https://ngrok.com) tunnel:\n```\nngrok http 8080\n```\n\n## Creating a MoonClerk form\n\nIn order to utilize this integration, you need to set up a purchase confirmation\n\"redirect\" for your form to redirect to the `/success` route, which will create\na license for your customer after a successful purchase.\n\n**Please note that the query parameters `customer_id` and `payment_id` within\nthe URL are required and are filled by MoonClerk**. For example: `https://example.com/success?customer_id={{customer_id}}\u0026payment_id={{payment_id}}` will be transformed to `https://example.com/success?customer_id=01234\u0026payment_id=56789` on redirect.\n\nHere's a screenshot of what that looks like when creating a new form,\n\n![image](https://user-images.githubusercontent.com/6979737/31795591-0ef4a78e-b4ec-11e7-83a8-25ca742abb26.png)\n\n**During development and local testing, you can use the `ngrok` URL that you\ngenerated above**, e.g. `https://{YOUR_NGROK_URL}/success?customer_id={{customer_id}}\u0026payment_id={{payment_id}}`\nfor the redirect (note the required query parameters).\n\n## Adding your MoonClerk form\n\nYou'll need to edit the `/views/index.ejs` file and update the MoonClerk embed\ncode with your own embed code.\n\n## Testing the integration\n\nVisit the following url: http://localhost:8080 and fill out the purchase form.\n\n## Questions?\n\nReach out at [support@keygen.sh](mailto:support@keygen.sh) if you have any\nquestions or concerns!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeygen-sh%2Fexample-moonclerk-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeygen-sh%2Fexample-moonclerk-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeygen-sh%2Fexample-moonclerk-integration/lists"}