{"id":27948422,"url":"https://github.com/twilio-labs/sample-pay-service","last_synced_at":"2026-03-13T07:34:27.492Z","repository":{"id":40337710,"uuid":"228863496","full_name":"twilio-labs/sample-pay-service","owner":"twilio-labs","description":"Payment over the phone","archived":false,"fork":false,"pushed_at":"2024-12-06T16:01:58.000Z","size":357,"stargazers_count":11,"open_issues_count":27,"forks_count":6,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-07T14:58:33.268Z","etag":null,"topics":["code-exchange","nodejs","payment","twilio","voice"],"latest_commit_sha":null,"homepage":null,"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/twilio-labs.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}},"created_at":"2019-12-18T15:00:29.000Z","updated_at":"2024-12-08T07:19:13.000Z","dependencies_parsed_at":"2025-05-07T14:58:35.950Z","dependency_job_id":"646cb2cb-5c1d-463b-bc78-de4514c01d04","html_url":"https://github.com/twilio-labs/sample-pay-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"twilio-labs/sample-template-nodejs","purl":"pkg:github/twilio-labs/sample-pay-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio-labs%2Fsample-pay-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio-labs%2Fsample-pay-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio-labs%2Fsample-pay-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio-labs%2Fsample-pay-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twilio-labs","download_url":"https://codeload.github.com/twilio-labs/sample-pay-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio-labs%2Fsample-pay-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30460939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T06:34:02.089Z","status":"ssl_error","status_checked_at":"2026-03-13T06:33:49.182Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["code-exchange","nodejs","payment","twilio","voice"],"created_at":"2025-05-07T14:58:27.138Z","updated_at":"2026-03-13T07:34:27.486Z","avatar_url":"https://github.com/twilio-labs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca  href=\"https://www.twilio.com\"\u003e\n\u003cimg  src=\"https://static0.twilio.com/marketing/bundles/marketing/img/logos/wordmark-red.svg\"  alt=\"Twilio\"  width=\"250\"  /\u003e\n\u003c/a\u003e\n \n# Payment over the phone with TwiML\\\u003cPay\u003e\n\n[![Actions Status](https://github.com/twilio-labs/sample-pay-service/workflows/Node%20CI/badge.svg)](https://github.com/twilio-labs/sample-pay-service/actions)\n\n## About\n\nThis sample application shows how to do a bill payment over the phone using TwiML\\\u003cPay\u003e with a credit card.\n\nImplementations in other languages:\n\n| .NET | Java | Python | PHP | Ruby |\n| :--- | :--- | :----- | :-- | :--- |\n| TBD  | TBD  | TBD    | TBD | TBD  |\n\n### How it works\n\nIt uses the TwiML\\\u003cPay\u003e to prompt the user to enter a credit card's information to pay a bill that can be configured on the UI, then it will process the payment through Stripe (which needs to be added as a connector on the Twilio console) and will let the user know if the payment was successful or not.\n\n![Pay Diagram](./pay-diagram-1-final.width-1600.png)\n\n## Features\n\n- Node.js web server using [Express.js](https://npm.im/express)\n- Basic web user interface using [Pug](https://npm.im/pug) for templating and Bootstrap for UI\n- User interface to configure payment details.\n- Payment details can be stored in a JSON database using lowdb.\n- Unit tests using [`mocha`](https://npm.im/mocha) and [`chai`](https://npm.im/chai)\n- [Automated CI testing using GitHub Actions](/.github/workflows/nodejs.yml)\n- Linting and formatting using [ESLint](https://npm.im/eslint) and [Prettier](https://npm.im/prettier)\n- Project specific environment variables using `.env` files and [`dotenv-safe`](https://npm.im/dotenv-safe) by comparing `.env.example` and `.env`.\n- One click deploy buttons for Heroku and Glitch\n\n## Set up\n### Requirements\n\n- [Node.js](https://nodejs.org/)\n- A Twilio account - [sign up](https://www.twilio.com/try-twilio)\n\nIt is recommended to follow the tutorial on [how to capture your first payment using \\\u003cPay\u003e](https://www.twilio.com/docs/voice/tutorials/how-capture-your-first-payment-using-pay) as it already describes in detail all of the following steps:\n\n1. Create a [Stripe's account](https://dashboard.stripe.com/register).\n2. [Purchase a voice-enabled Twilio phone number](https://www.twilio.com/console/phone-numbers/incoming) (or use one of yours if you already have it).\n3. Configure [Stripe \\\u003cPay\u003e Connector](https://www.twilio.com/console/voice/pay-connectors) on the your Twilio console.\n\n### Twilio Account Settings\n\nThis application should give you a ready-made starting point for writing your\nown payment over the phone application. Before we begin, we need to collect\nall the config values we need to run the application:\n\n| Config\u0026nbsp;Value | Description                                                                                                                                                  |\n| :---------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Auth\u0026nbsp;Token   | Used to authenticate - [You'll find it on your Twilio's console](https://www.twilio.com/console).                                                         |\n| Payment\u0026nbsp;connector | This has to be configured on your [Twilio's console](https://www.twilio.com/console/voice/pay-connectors). There you should select the Stripe connector and link it to your Stripe's account                                                         |\n\n**NOTE:** The Auth token will validate the requests are coming from the authorized account, otherwise you will get a `403 Forbidden` response.\n\n### Local development\n\nAfter the above requirements have been met:\n\n1. Clone this repository and `cd` into it\n\n```bash\ngit clone git@github.com:twilio-labs/sample-pay-service.git\n\ncd sample-pay-service\n```\n\n2. Install dependencies\n\n```bash\nnpm install\n```\n\n3. Install Twilio CLI\n\n\u003e See [Twilio CLI Quickstart](https://www.twilio.com/docs/twilio-cli/quickstart) for installation guide for Linux and to learn how to use the Twilio CLI.\n\nMac OS X\n```bash\nbrew tap twilio/brew \u0026\u0026 brew install twilio\n```\n\nWindows\n ```bash\n npm install twilio-cli -g\n ```\n\n4. Log in to Twilio CLI\n```bash\ntwilio login\n```\n\nSee [Twilio Account Settings](#twilio-account-settings) to locate the necessary environment variables.\n\n5. List and purchase an available phone number by area code\n\n```bash\ntwilio phone-numbers:buy:local --country-code US --area-code=\"208\"\n```\n\n6. Set your environment variables\n\n```bash\nnpm run setup\n```\n\nSee [Twilio Account Settings](#twilio-account-settings) to locate the necessary environment variables.\n\n7. Run the application\n\n```bash\nnpm start\n```\n\nAlternatively, you can use this command to start the server in development mode. It will reload whenever you change any files.\n\n```bash\nnpm run dev\n```\n\n8. Once you have your server running, you need to expose your `localhost` to a public domain so the Twilio webhook can reach the expected endpoint. This is easy [using the Twilio CLI](https://www.twilio.com/docs/twilio-cli/general-usage#proxying-your-localhost).\n```\ntwilio phone-numbers:update [PN sid or E.164] --sms-url http://localhost:3000/pay\n```\n\nThis will generate a url similar to: `https://cd2ef758.ngrok.io`.\n\n9. Navigate to [http://localhost:3000](http://localhost:3000) to see some sample credit card details to test the payment.\n\n10. You can also navigate to [http://localhost:3000/config](http://localhost:3000/config) to override the default payment details.\n\n11. That's it! Now call the Twilio phone number you configured and follow the instructions to complete the payment.\n\n12. You can see if the payment was charged on your Stripe dashboard. [Learn how to capture your first payment](https://www.twilio.com/docs/voice/tutorials/how-capture-your-first-payment-using-pay#test-your-application) for more details.\n\n### Tests\n\nYou can run the tests locally by typing:\n\n```bash\nnpm test\n```\n\n### Cloud deployment\n\nAdditionally to trying out this application locally, you can deploy it to a variety of host services. Here is a small selection of them.\n\nPlease be aware that some of these might charge you for the usage or might make the source code for this application visible to the public. When in doubt research the respective hosting service first.\n\n*Don't forget to set the environmental variables on each hosting service!*\n\n| Service                           |                                                                                                                                                                                                                           |\n| :-------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| [Heroku](https://www.heroku.com/) | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://www.heroku.com/deploy/?template=https://github.com/twilio-labs/sample-pay-service/tree/master)                                                                                                                                       |\n| [Glitch](https://glitch.com)      | [![Remix on Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button.svg)](https://glitch.com/edit/#!/remix/clone-from-repo?REPO_URL=https://github.com/twilio-labs/sample-pay-service.git) |\n\nHere are some notes about the services:\n- **Heroku**: Very straightforward, just create an account and after clicking the deploy button you need to follow the instructions and that's it.\n- **Glitch**: It requirers an additional step. Once you click on the deploy button, you need to manually create the file `.env` and add set `TWILIO_AUTH_TOKEN` variable. You can duplicate the `.env.example` file and edit it accordingly.\n\n## Resources\n- This project was generated using this [sample NodeJS template](https://github.com/twilio-labs/sample-template-nodejs)\n\n- [GitHub's repository template](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) functionality\n\n## Contributing\n\nThis template is open source and welcomes contributions. All contributions are subject to our [Code of Conduct](https://github.com/twilio-labs/.github/blob/master/CODE_OF_CONDUCT.md).\n\n[Visit the project on GitHub](https://github.com/twilio-labs/sample-pay-service)\n\n## License\n\n[MIT](http://www.opensource.org/licenses/mit-license.html)\n\n## Disclaimer\n\nNo warranty expressed or implied. Software is as is.\n\n[twilio]: https://www.twilio.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilio-labs%2Fsample-pay-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwilio-labs%2Fsample-pay-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilio-labs%2Fsample-pay-service/lists"}