{"id":18577499,"url":"https://github.com/ecomplus/app-paypal","last_synced_at":"2025-07-06T16:36:38.046Z","repository":{"id":61991008,"uuid":"208269768","full_name":"ecomplus/app-paypal","owner":"ecomplus","description":"E-Com Plus app to integrate PayPal checkout","archived":false,"fork":false,"pushed_at":"2024-02-26T21:50:03.000Z","size":655,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-15T16:06:08.722Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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":"2019-09-13T13:25:25.000Z","updated_at":"2024-06-26T18:43:07.000Z","dependencies_parsed_at":"2024-11-06T23:32:44.686Z","dependency_job_id":"c27b7977-cdae-44c1-ad85-3f9ff6956783","html_url":"https://github.com/ecomplus/app-paypal","commit_stats":null,"previous_names":[],"tags_count":130,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fapp-paypal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fapp-paypal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fapp-paypal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fapp-paypal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecomplus","download_url":"https://codeload.github.com/ecomplus/app-paypal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254453464,"owners_count":22073608,"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-11-06T23:29:28.540Z","updated_at":"2025-05-16T01:32:35.892Z","avatar_url":"https://github.com/ecomplus.png","language":"JavaScript","readme":"# App PayPal\n\n[![License MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nE-Com Plus app to integrate PayPal SPB \u0026 Plus\n\n[CHANGELOG](https://github.com/ecomclub/app-paypal/blob/master/CHANGELOG.md)\n\n## About\n\nThis application will:\n\n1. Integrate PayPal business account;\n2. Add payment methods and create transactions with\n[Modules API (**List payments \u0026 Create transaction**)](https://developers.e-com.plus/modules-api/);\n3. Receive PayPal Webhooks to update transaction status on created orders;\n\n[App](https://developers.e-com.plus/docs/api/#/store/applications/) `hidden_data`\nwill store [PayPal App credentials](https://developer.paypal.com/developer/applications/),\n`data` will store discount, installments and custom PayPal SPB/Plus options.\n\n`data`/`hidden_data` expected object model is defined (JSON Schema) on\n[app `admin_settings`](https://github.com/ecomclub/app-paypal/blob/master/assets/application.json).\n\nIt's based on\n[E-Com Plus Express App Boilerplate](https://github.com/ecomclub/express-app-boilerplate),\napplication installation and authentication was kept as is\nwith original endpoints from boilerplate source:\n\n- [`/bin/web.js`](https://github.com/ecomclub/app-paypal/blob/master/bin/web.js):\nExpress web server setup;\n- [`/routes/ecom/auth-callback.js`](https://github.com/ecomclub/app-paypal/blob/master/routes/ecom/auth-callback.js):\nEndpoint for\n[E-Com Plus Authentication Callback](https://developers.e-com.plus/docs/api/#/store/authenticate-app/authenticate-app);\n\n### List payments module endpoint\n\nAdditional endpoint was created to handle `list_payments`\n([`/ecom/modules/list-payments`](https://github.com/ecomclub/app-paypal/blob/master/routes/ecom/modules/list-payments.js))\nmodule, it receives requests from Modules API on stores with this app installed.\n\nIt'll receive POST with body _like_:\n\n```javascript\n{\n  \"params\": {\n    \"items\": [\n      {\n        \"name\": \"Monitor Gamer Asus ROG Swift LED 24\\\" Widescreen FHD PG248Q\",\n        \"sku\": \"HUJ1471\",\n        \"price\": 2995.36,\n        \"quantity\": 1,\n        \"currency_id\": \"BRL\",\n        \"currency_symbol\": \"R$\",\n        \"product_id\": \"5c705802c626be23430d5053\",\n        \"final_price\": 2995.36\n      }\n    ],\n    \"amount\": {\n      \"freight\": 50.39,\n      \"discount\": 0,\n      \"total\": 3045.75,\n      \"subtotal\": 2995.36\n    },\n    \"currency_id\": \"BRL\",\n    \"currency_symbol\": \"R$\"\n  },\n  \"application\": {\n    \"hidden_data\": {\n      \"paypal_client_id\": \"1234\",\n      \"paypal_secret\": \"123456\"\n    },\n    \"data\": {\n      \"enable_paypal_plus\": true\n    }\n  }\n}\n```\n\nThen:\n\n1. Check for\n[SPB (new version)](https://developer.paypal.com/docs/checkout/),\n[checkout.js](https://developer.paypal.com/docs/archive/checkout/) and/or\n[PayPal Plus](https://developer.paypal.com/docs/integration/paypal-plus/mexico-brazil/paypal-plus-integration-guide-mexico-brazil/) enabled;\n\n2. Setup payment methods clients\n([onload expressions](https://github.com/ecomclub/app-paypal/tree/master/assets))\nto run on [Storefront App](https://github.com/ecomclub/storefront-app);\n\n3. Check/apply discount option by payment method;\n\n4. Create [Payment](https://developer.paypal.com/docs/api/payments/v1/)\nfor PayPal Plus or checkout.js if used;\n\n5. Return response with configured payment methods objects;\n\n\u003e [Full `params` object reference](https://apx-mods.e-com.plus/api/v1/list_payments/schema.json?store_id=100)\nfrom Modules API docs.\n\n\u003e Full `data`/`hidden_data` object referece on\n[application.json](https://github.com/ecomclub/app-paypal/blob/master/assets/application.json) `admin_settings`.\n\n\u003e [Full `response` object reference](https://apx-mods.e-com.plus/api/v1/list_payments/response_schema.json?store_id=100)\nfrom Modules API docs.\n\n### Create transaction module endpoint\n\nAdditional endpoint was created to handle `create_transaction`\n([`/ecom/modules/create-transaction`](https://github.com/ecomclub/app-paypal/blob/master/routes/ecom/modules/create-transaction.js))\nmodule, it receives requests from Modules API to:\n\n1. Executed PayPal Payment or read created PayPal Order (new SPB);\n2. Save PayPal Payment/Order ID associated to E-Com Plus Order ID for status synchronization (SQLite3);\n3. Send response to confirm/cancel E-Com Plus order;\n\n### PayPal Webhooks endpoint\n\nCustom endpoint to handle PayPal Webhooks\n([`/paypal/webhook`](https://github.com/ecomclub/app-paypal/blob/master/routes/paypal/webhook.js)):\n\n1. Validate and read PayPal Webhook event;\n2. Read local database (SQLite3) to match Payment/Order ID of respective even\n(saved on [create transaction](#create-transaction-module-endpoint));\n3. Check new transaction status and parse to PayPal enum to E-Com Plus enum;\n4. Update E-Com Plus order adding new `payment_history` with current status;\n\n## Environment variables sample\n\nVariable              | Value\n---                   | ---\n`LOGGER_OUTPUT`       | `~/app/log/logger.out`\n`LOGGER_ERRORS`       | `~/app/log/logger.err`\n`LOGGER_FATAL_ERRORS` | `~/app/log/_stderr`\n`PORT`                | `3000`\n`APP_NAME`            | `PayPal`\n`APP_BASE_URI`        | `https://paypal.ecomplus.biz`\n`DB_PATH`             | `~/app/db.sqlite`\n`ECOM_AUTH_DB`        | `~/app/db.sqlite`\n`ECOM_AUTH_UPDATE`    | `enabled`\n`DAEMON_SERVICES`     | `true`\n`PAYPAL_PARTNER_ID`   | `EcomPartnerId`\n\n## Production server\n\nPublished at https://paypal.ecomplus.biz\n\n### Continuous deployment\n\nWhen new version is **production ready**,\n[create a new release](https://github.com/ecomclub/app-paypal/releases)\n(or `npm run release`) to run automatic deploy from _master_ branch\nand (re)publish the app.\n","funding_links":["https://developer.paypal.com/developer/applications/","https://developer.paypal.com/docs/checkout/","https://developer.paypal.com/docs/archive/checkout/","https://developer.paypal.com/docs/integration/paypal-plus/mexico-brazil/paypal-plus-integration-guide-mexico-brazil/","https://developer.paypal.com/docs/api/payments/v1/"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomplus%2Fapp-paypal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecomplus%2Fapp-paypal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomplus%2Fapp-paypal/lists"}