{"id":13575051,"url":"https://github.com/ecomplus/app-custom-payment","last_synced_at":"2025-04-10T09:30:48.202Z","repository":{"id":37033976,"uuid":"247818876","full_name":"ecomplus/app-custom-payment","owner":"ecomplus","description":" E-Com Plus app for simple custom payment methods","archived":false,"fork":false,"pushed_at":"2025-03-07T16:25:32.000Z","size":543,"stargazers_count":0,"open_issues_count":17,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T19:11:24.327Z","etag":null,"topics":[],"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/ecomplus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-03-16T21:21:56.000Z","updated_at":"2021-10-21T16:43:33.000Z","dependencies_parsed_at":"2023-10-15T14:55:55.443Z","dependency_job_id":"cdcc0068-e97f-4325-8a65-108064270a5d","html_url":"https://github.com/ecomplus/app-custom-payment","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":"ecomplus/application-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fapp-custom-payment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fapp-custom-payment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fapp-custom-payment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fapp-custom-payment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecomplus","download_url":"https://codeload.github.com/ecomplus/app-custom-payment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248191638,"owners_count":21062541,"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":[],"created_at":"2024-08-01T15:00:57.790Z","updated_at":"2025-04-10T09:30:47.762Z","avatar_url":"https://github.com/ecomplus.png","language":"JavaScript","readme":"# App custom payment\n\n[![Deploy](https://github.com/ecomplus/app-custom-payment/workflows/Deploy/badge.svg)](https://github.com/ecomplus/app-custom-payment/actions?workflow=Deploy)  [![Deploy](https://github.com/ecomplus/app-custom-payment/workflows/Publish/badge.svg)](https://github.com/ecomplus/app-custom-payment/actions?workflow=Publish) [![License MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nE-Com Plus app for custom payment methods\n\n[CHANGELOG](https://github.com/ecomplus/app-custom-payment/blob/master/CHANGELOG.md)\n\n# E-Com Plus Application Starter\n\n:dog: Boilerplate for E-Com Plus apps with [Firebase](https://firebase.google.com/) Cloud Functions and GitHub Actions.\n\n## Getting started\n\n1. Start creating a [Firebase project](https://console.firebase.google.com/):\n    - Analytics is not needed;\n    - Set a nice project name (ID) and remember it;\n\n2. Enter the project, go to _databases_ page (on menu) and _create database_:\n    - Just bypass with default production mode and rules;\n\n3. Get your Firebase token from CLI:\n```bash\nnpm install -g firebase-tools\nfirebase login:ci\n```\n\n4. [Use this template](https://github.com/ecomplus/application-starter/generate) to generate a new repository for your application;\n\n5. Go to your repository _settings_ tab and set the following _secrets_:\n    - `FIREBASE_PROJECT_ID`: The ID (name) of your Firebase project;\n    - `FIREBASE_TOKEN`: The token generated with `firebase-tools`;\n    - `SERVER_OPERATOR_TOKEN`: Random (at least 16 bytes) admin token generated from CLI or [here](https://randomkeygen.com/);\n    - `MARKET_TOKEN` (optional): Your E-Com Plus Market [personal token](https://market.e-com.plus/partners/account) to publish the app automatically;\n\n## Next steps\n\nAlmost ready, time to :coffee: and code!\n\nEdit [`functions/ecom.config.js`](functions/ecom.config.js) to set correct `app_id`, `title` and optionally more fields on base app body.\n\nIf you're not yet familiarized with this boilerplate, **read with attention the comments and instructions at the configuration file**. You can also setup procedures from there to specify the web-hooks your app should receive.\n\n### E-Com common routes\n\nAll endpoints inside [`/ecom/`](functions/routes/ecom) path **MUST BE PRIVATE** (trey are by default), accessible only for E-Com Plus official servers or with `X-Operator-Token` header (equal to `SERVER_OPERATOR_TOKEN` env).\n\nRequests to E-Com routes must have `X-Store-ID` header or `store_id` parameter on URL query string.\n\n#### [`auth-callback`](functions/routes/ecom/auth-callback.js)\n\nHandle [authentication callback request](https://developers.e-com.plus/docs/api/#/store/authenticate-app/authenticate-app) and save tokens to database, also create Store API procedures if configured.\n\n\u003e You can edit it to send custom requests to external server notifying new store installation or setup.\n\n#### [`get-auth`](functions/routes/ecom/get-auth.js)\n\nReturns Store API authentication data based on received Store ID, for external usage.\n\nSample response:\n\n```json\n{\n  \"application_id\": \"a00000000000000000000012\",\n  \"application_app_id\": 9000,\n  \"store_id\": 1011,\n  \"authentication_id\": \"120000000000000000000012\",\n  \"access_token\": \"eyJhbGciOi.eyYzdWIi.ZEONFh7HgQ\"\n}\n```\n\n\u003e You should consume it if you want to use this boilerplate as an _authentication backend_ only. By getting this data (HTTP GET) you'll be able to run authenticated requests to [Store API](https://developers.e-com.plus/docs/api/#/store/) from your own server, with your preferred language, framework...\n\n#### [`refresh-tokens`](functions/routes/ecom/refresh-tokens.js)\n\nCall update service to start refreshing old access tokens.\n\n#### [`webhook`](functions/routes/ecom/webhook.js)\n\nReceives E-Com Plus notification POSTs for configured procedures.\n\n\u003e You may want to edit it to properly treat trigger body and do your custom stuff for each notification type.\n\n#### [`modules/*`](functions/routes/ecom/modules)\n\nEndpoints for [E-Com Plus Mods API](https://developers.e-com.plus/modules-api/).\n\n\u003e You should edit the respective ones for enabled modules (on `ecom.config.js`).\n\n### Additional Store API handlers\n\nIf the app works with `admin_settings` (configuration), use [`getAppData`](functions/lib/store-api/get-app-data.js) to get the application `data`/`hidden_data` configured by merchant from dashboard through Store API ([Application Object](https://developers.e-com.plus/docs/api/#/store/applications/)).\n\nWe recommend treating Store API clients (40x) and server (50x) errors with [`errorHandling`](functions/lib/store-api/error-handling.js) abstraction.\n\n### Application SDK\n\nYou may want to use [`appSdk`](https://github.com/ecomplus/application-sdk) to make custom authenticated requests to [Store API](https://developers.e-com.plus/docs/api/#/store/) or deeper coding out of our examples.\n\n### Custom integration scripts\n\n- Add third party libraries to [`functions/package.json`](functions/package.json) dependencies;\n- Add custom web app routes by creating new files to [`functions/routes`](functions/routes) folder;\n- Add new methods/handlers at [`functions/lib`](functions/lib) folder;\n\n### Optional setup for [Market](https://market.e-com.plus/)\n\nYou may want to make your app public and available to install within E-Com Plus dashboard, to do this:\n\n- Edit [`ecomplus-market.json`](ecomplus-market.json) to set a short description and category between _shipping_, _sales_, _tools_, _customer-service_, _marketing_, _inventory_ or _product-sourcing_;\n- Overwrite the default PNG icon at [`functions/public/icon.png`](functions/public/icon.png);\n- Write a good markdown description for the app at [`functions/public/description.md`](functions/public/description.md);\n- Take note about [publication](#publication);\n\n\u003e If you are not yet a registered partner, start by filling out [this form](https://docs.google.com/forms/d/e/1FAIpQLSfd8uUsMG6N_rSFi2blGuk3Rfqi_BPp6fxschkmkdhEBVDsyw/viewform) and wait a little for our response :handshake:\n\n## Examples\n\n:sunglasses: [Awesome E-Com Plus applications](https://github.com/ecomplus/awesome#applications) to get inspired!\n\n## Continuous integration\n\nEvery commit will trigger a new **deploy** (with [GitHub Actions](.github/workflows)), then your app will be accessible at:\n\n`https://us-central1-\u003cproject-id\u003e.cloudfunctions.net/app/` :blush:\n\nThe `assets/application.json` will be updated automatically with some package info and current Cloud Function endpoints, you can use it as body to [_Create new Application_](https://developers.e-com.plus/docs/api/#/store/applications/new-application) on Store API.\n\n\u003e You can skip deploy workflow by adding `[skip ci]` to the commit message.\n\nAlso, your app's access tokens to Store API will be **automatically refreshed** every 8 hours by scheduled workflow.\n\n### Publication\n\nIf `MARKET_TOKEN` secret is set, the app will be **automatically published to [Market](https://market.e-com.plus/)** every time `assets/application.json` is changed, then merchants will be able to install it with up to date version.\n\n## Developing and testing locally\n\nSetup the project normally by cloning your repository and installing npm dependencies:\n\n```bash\ngit clone git@github.com:$username/$app_repository.git\ncd $app_repository\nnpm i\ncd functions\nnpm i\n```\n\nThen you can call `npm run deploy` locally getting configuration from `.env` file on project root. You can also set a different `FIREBASE_PROJECT_ID` locally for test purpose only.\n\nWhen you're done, you can publish the app by running `npm run publish:market`.\n\n### Firebase tools\n\nYou can also use [`firebase-tools` CLI](https://firebase.google.com/docs/cli) to run tests/deploy with custom config or scripts.\n","funding_links":[],"categories":["Applications"],"sub_categories":["Payments"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomplus%2Fapp-custom-payment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecomplus%2Fapp-custom-payment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomplus%2Fapp-custom-payment/lists"}