{"id":13989663,"url":"https://github.com/stripe-archive/stripe-stdlib-demo","last_synced_at":"2025-07-22T11:31:11.479Z","repository":{"id":146604528,"uuid":"135088391","full_name":"stripe-archive/stripe-stdlib-demo","owner":"stripe-archive","description":"Sample store accepting universal payments built with @Stripe and @StdLib.","archived":true,"fork":false,"pushed_at":"2021-06-03T15:30:56.000Z","size":3961,"stargazers_count":33,"open_issues_count":0,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-09T13:16:16.342Z","etag":null,"topics":["functions","functions-as-a-service","nodejs","payments","serverless","stdlib","stripe","stripe-api"],"latest_commit_sha":null,"homepage":"https://code.xyz/?github=stripe/stripe-stdlib-demo","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/stripe-archive.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}},"created_at":"2018-05-27T23:17:46.000Z","updated_at":"2023-08-28T01:30:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"b25e14c6-a847-4099-a1ce-54c800f6cec7","html_url":"https://github.com/stripe-archive/stripe-stdlib-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe-archive%2Fstripe-stdlib-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe-archive%2Fstripe-stdlib-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe-archive%2Fstripe-stdlib-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe-archive%2Fstripe-stdlib-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stripe-archive","download_url":"https://codeload.github.com/stripe-archive/stripe-stdlib-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227079539,"owners_count":17728031,"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":["functions","functions-as-a-service","nodejs","payments","serverless","stdlib","stripe","stripe-api"],"created_at":"2024-08-09T13:01:55.593Z","updated_at":"2024-11-29T08:32:01.445Z","avatar_url":"https://github.com/stripe-archive.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003e \u003cimg src=\"https://stripe.dev/images/badges/archived.png\" width=\"250\"\u003e\n\u003e\n\u003e This project is deprecated and is no longer being actively maintained.\n\n# Stripe on StdLib Demo\n\n\u003ca href=\"https://code.xyz/?github=stripe/stripe-stdlib-demo\"\u003e\u003cimg src=\"https://code.xyz/button/?format=svg\" alt=\"Open in Code.xyz\" height=\"32\"\u003e\u003c/a\u003e\n\nWelcome to the Stripe on StdLib demo! This repository shows how to build frictionless Stripe integrations on top of StdLib’s serverless platform and their browser-based API development environment, [Code.xyz](https://code.xyz).\n\nThis project extends our universal [Stripe Payments Demo](https://github.com/stripe/stripe-payments-demo), a sample e-commerce store that uses [Stripe Elements](https://stripe.com/docs/elements) and the [Sources API](https://stripe.com/docs/sources) to accept both card payments and additional payment methods on the web. Please refer to the main project to learn more and find backend code in more languages.\n\nStdLib allows anybody to quickly ship scalable and production-ready APIs. We’ve ported our payments demo from Express to a serverless-based approach on StdLib to serve API endpoints, the Stripe webhook integration, and the single-page app. You can [explore this repository on Code.xyz](https://code.xyz?github=stripe/stripe-stdlib-demo). We hope you enjoy!\n\n## Overview\n\n\u003cimg src=\"public/images/screenshots/demo-chrome.png\" alt=\"Demo on Google Chrome\" width=\"610\"\u003e\u003cimg src=\"public/images/screenshots/demo-iphone.png\" alt=\"Demo on Safari iPhone X\" width=\"278\"\u003e\n\nYou can read more about the features from this app on the [main payments repository](https://github.com/stripe/stripe-payments-demo#overview).\n\n## Stripe and StdLib Integration\n\nThis section gives you some details about how this Stripe and StdLib integration works.\n\n### API Endpoints\n\nThe `functions` directory contains the code for all the API endpoints consumed by the single-page demo. [FaaSlang](https://github.com/faaslang/faaslang#what-is-faaslang) defines semantics and rules for the deployment and execution of these serverless functions.\n\nThe ability to create orders via a POST request on `/orders` is defined in [`functions/orders/__main__.js`](functions/orders/__main__.js), and the ability to list products via a GET request on `/products` is defined in [`functions/products/__main__.js`](functions/products/__main__.js). These functions rely on the [`stripe/inventory.js`](stripe/inventory.js) library which helps with product and order management on Stripe.\n\nThe interesting thing to note is that for API endpoints which contain IDs in their path, such as `POST /orders/{id}/pay` to pay a specific order, the serverless function is defined in [`functions/orders/__notfound__.js`](functions/orders/__notfound__.js), which is called automatically since the endpoint has a variable. The same applies for fetch a specific product.\n\nThe Stripe webhook handler is defined in [`functions/webhook.js`](functions/webhook.js).\n\n### Single-Page App and Static Assets\n\nThe frontend code for the demo lives in the `public` directory. In particular, [`public/javascripts/payments.js`](public/javascripts/payments.js) creates the payment experience using Stripe Elements, and [`public/javascripts/store.js`](public/javascripts/store.js) handles the inventory and order management on Stripe.\n\nThe main app template is served by a function, specifically the main function defined in [`functions/__main__.js`](functions/__main__.js). All the static assets (scripts, stylesheets, and images) are also rendered by a function, specifically via the [`functions/public/__notfound__.js`](functions/public/__notfound__.js) function which relies on the [`fileio.js`](helpers/fileio.js) helper to read and map files from the `public` directory.\n\n## Getting Started\n\nYou’ll need the following:\n\n* [Node.js](http://nodejs.org) \u003e= 8.x.\n* Modern browser that supports ES6 (Chrome to see the Payment Request, and Safari to see Apple Pay).\n* Stripe account to accept payments ([sign up](https://dashboard.stripe.com/register) for free).\n* StdLib account to deploy the project ([sign up](https://stdlib.com/) for free).\n\nIn your Stripe Dashboard, you can [enable the payment methods](https://dashboard.stripe.com/payments/settings) you’d like to test with one click. Some payment methods require receiving a real-time webhook notification to complete a charge. This StdLib demo exposes an endpoint for webhooks which you can enter in your webhooks settings on Stripe (it should look like `https://\u003cusername\u003e.lib.id/\u003cservice\u003e@dev/webhook`).\n\n## Deploying to StdLib\n\nThe simplest way to test and deploy this project is to use the [Code.xyz](https://code.xyz/?github=stripe/stripe-stdlib-demo) development environment, but you can also clone this repository locally and use the StdLib command line tools.\n\nIn both cases, you’ll need to copy the file `env.example.json` to `env.json` and fill in your own [Stripe API keys](https://dashboard.stripe.com/account/apikeys) and any other configuration details.\n\nTo install StdLib command line tools, run the following command:\n\n    npm install lib.cli -g\n\nLogin or create a StdLib account from the command line:\n\n    lib login\n\nYou can now push the code to StdLib:\n\n    lib up dev\n\nThis Stripe demo should now be running at `https://\u003cusername\u003e.lib.id/\u003cservice\u003e@dev/`. You should also see in your Terminal the URL of your webhook endpoint to enter in your Stripe account if you’d like to try non-card payment methods which are asynchronous: `https://\u003cusername\u003e.lib.id/\u003cservice\u003e@dev/webhook`.\n\n## More about StdLib\n\nIf you want to join the StdLib community, you can visit [stdlib.com](https://stdlib.com) or [follow StdLib on Twitter](https://twitter.com/StdLibHQ).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstripe-archive%2Fstripe-stdlib-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstripe-archive%2Fstripe-stdlib-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstripe-archive%2Fstripe-stdlib-demo/lists"}