{"id":19622138,"url":"https://github.com/commercetools/connect-payment-integration-template","last_synced_at":"2025-04-28T03:32:24.409Z","repository":{"id":222356403,"uuid":"743927683","full_name":"commercetools/connect-payment-integration-template","owner":"commercetools","description":"Toolkit for developing a PSP integration with commercetools","archived":false,"fork":false,"pushed_at":"2025-04-18T20:42:38.000Z","size":2560,"stargazers_count":10,"open_issues_count":4,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-20T15:17:56.578Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/commercetools.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-16T09:33:29.000Z","updated_at":"2025-04-14T06:58:39.000Z","dependencies_parsed_at":"2024-02-19T09:43:27.082Z","dependency_job_id":"05bae232-5383-45c7-98fc-1859d1442171","html_url":"https://github.com/commercetools/connect-payment-integration-template","commit_stats":null,"previous_names":["commercetools/connect-payment-integration-template"],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fconnect-payment-integration-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fconnect-payment-integration-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fconnect-payment-integration-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fconnect-payment-integration-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commercetools","download_url":"https://codeload.github.com/commercetools/connect-payment-integration-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251246340,"owners_count":21558762,"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-11T11:26:10.662Z","updated_at":"2025-04-28T03:32:24.403Z","avatar_url":"https://github.com/commercetools.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# connect-payment-integration-template\n\nThis repository provides a [connect](https://docs.commercetools.com/connect) template for payment integration connector. This boilerplate code acts as a starting point for integration with external payment service provider.\n\n## Template Features\n\n- Typescript language supported.\n- Uses Fastify as web server framework.\n- Uses [commercetools SDK](https://docs.commercetools.com/sdk/js-sdk-getting-started) for the commercetools-specific communication.\n- Uses [connect payment SDK](https://github.com/commercetools/connect-payments-sdk) to manage request context, sessions and JWT authentication.\n- Includes local development utilities in npm commands to build, start, test, lint \u0026 prettify code.\n\n## Prerequisite\n\n#### 1. commercetools composable commerce API client\n\nUsers are expected to create API client responsible for payment management in composable commerce project. Details of the API client are taken as input as environment variables/ configuration for connect such as `CTP_PROJECT_KEY` , `CTP_CLIENT_ID`, `CTP_CLIENT_SECRET`. For details, please read [Deployment Configuration](./README.md#deployment-configuration).\nIn addition, please make sure the API client should have enough scope to be able to manage payment. For details, please refer to [Running Application](./processor/README.md#running-application)\n\n#### 2. various URLs from commercetools composable commerce\n\nVarious URLs from commercetools platform are required to be configured so that the connect application can handle session and authentication process for endpoints.\nTheir values are taken as input as environment variables/ configuration for connect with variable names `CTP_API_URL`, `CTP_AUTH_URL` and `CTP_SESSION_URL`.\n\n## Getting started\n\nThe template contains two modules :\n\n- Enabler: Acts as a wrapper implementation in which frontend components from PSPs embedded. It gives control to checkout product on when and how to load the connector frontend based on business configuration. In cases connector is used directly and not through Checkout product, the connector library can be loaded directly on frontend than the PSP one.\n- Processor : Acts as backend services which is middleware to 3rd party PSPs to be responsible for managing transactions with PSPs and updating payment entity in composable commerce. `connect-payment-sdk` will be offered to be used in connector to manage request context, sessions and other tools necessary to transact.\n\nRegarding the development of processor module, please refer to the following documentations:\n\n### Currencies\n\nA special note regarding the usage of currencies and working with them. commercetools provides monetary values in cent amounts which adheres to the \u003chttps://en.wikipedia.org/wiki/ISO_4217\u003e standard.\n\nThis means that for the currency `EUR` the minor units will be expressed with fraction digits of 2. I.e. a value of 1 euro and 50 cents will be expressed as `150`. Some currencies have 0 or even 4 fraction digits.\n\nIt's important to note that individual PSP could differ from this standard and/or require special attention when passing data between the connector and psp. So it's important to convert properly on the input and output layer when interacting with PSP.\n\ncommercetools provides the library [connect-payments-sdk](https://github.com/commercetools/connect-payments-sdk) which includes various utility function to help with these conversions.\n\n- [Development of Processor](./processor/README.md)\n\n#### 1. Develop your specific needs\n\nTo proceed payment operations via external PSPs, users need to extend this connector with the following task\n\n- API communication: Implementation to communicate between this connector application and the external system using libraries provided by PSPs. Please remember that the payment requests might not be sent to PSPs successfully in a single attempt. It should have needed retry and recovery mechanism.\n\n#### 2. Register as connector in commercetools Connect\n\nFollow guidelines [here](https://docs.commercetools.com/connect/getting-started) to register the connector for public/private use.\n\n## Deployment Configuration\n\nIn order to deploy your customized connector application on commercetools Connect, it needs to be published. For details, please refer to [documentation about commercetools Connect](https://docs.commercetools.com/connect/concepts)\nIn addition, in order to support connect, the tax integration connector template has a folder structure as listed below\n\n```\n├── enabler\n│   ├── src\n│   ├── test\n│   └── package.json\n├── processor\n│   ├── src\n│   ├── test\n│   └── package.json\n└── connect.yaml\n```\n\nConnect deployment configuration is specified in `connect.yaml` which is required information needed for publishing of the application. Following is the deployment configuration used by Enabler and Processor modules\n\n```\ndeployAs:\n  - name: enabler\n    applicationType: assets\n  - name: processor\n    applicationType: service\n    endpoint: /\n    configuration:\n      standardConfiguration:\n        - key: CTP_PROJECT_KEY\n          description: commercetools project key\n          required: true\n        - key: CTP_CLIENT_ID\n          description: commercetools client ID with manage_payments, manage_orders, view_sessions, view_api_clients, manage_checkout_payment_intents \u0026 introspect_oauth_tokens scopes\n          required: true\n        - key: CTP_AUTH_URL\n          description: commercetools Auth URL\n          required: true\n          default: https://auth.europe-west1.gcp.commercetools.com\n        - key: CTP_API_URL\n          description: commercetools API URL\n          required: true\n          default: https://api.europe-west1.gcp.commercetools.com\n        - key: CTP_SESSION_URL\n          description: Session API URL\n          required: true\n          default: https://session.europe-west1.gcp.commercetools.com\n        - key: CTP_JWKS_URL\n          description: JWKs url (example - https://mc-api.europe-west1.gcp.commercetools.com/.well-known/jwks.json)\n          required: true\n          default: https://mc-api.europe-west1.gcp.commercetools.com/.well-known/jwks.json\n        - key: CTP_JWT_ISSUER\n          description: JWT Issuer for jwt validation (example - https://mc-api.europe-west1.gcp.commercetools.com)\n          required: true\n          default: https://mc-api.europe-west1.gcp.commercetools.com\n      securedConfiguration:\n        - key: CTP_CLIENT_SECRET\n          description: commercetools client secret\n          required: true\n```\n\nHere you can see the details about various variables in configuration\n\n- `CTP_PROJECT_KEY`: The key of commercetools composable commerce project.\n- `CTP_CLIENT_ID`: The client ID of your commercetools composable commerce user account. It is used in commercetools client to communicate with commercetools composable commerce via SDK. Expected scopes are: `manage_payments` `manage_orders` `view_sessions` `view_api_clients` `manage_checkout_payment_intents` `introspect_oauth_tokens` `manage_types` `view_types`.\n- `CTP_CLIENT_SECRET`: The client secret of commercetools composable commerce user account. It is used in commercetools client to communicate with commercetools composable commerce via SDK.\n- `CTP_AUTH_URL`: The URL for authentication in commercetools platform. It is used to generate OAuth 2.0 token which is required in every API call to commercetools composable commerce. The default value is `https://auth.europe-west1.gcp.commercetools.com`. For details, please refer to documentation [here](https://docs.commercetools.com/tutorials/api-tutorial#authentication).\n- `CTP_API_URL`: The URL for commercetools composable commerce API. Default value is `https://api.europe-west1.gcp.commercetools.com`.\n- `CTP_SESSION_URL`: The URL for session creation in commercetools platform. Connectors relies on the session created to be able to share information between enabler and processor. The default value is `https://session.europe-west1.gcp.commercetools.com`.\n- `CTP_JWKS_URL`: The URL which provides JSON Web Key Set. Default value is `https://mc-api.europe-west1.gcp.commercetools.com/.well-known/jwks.json`\n- `CTP_JWT_ISSUER`: The issuer inside JSON Web Token which is required in JWT validation process. Default value is `https://mc-api.europe-west1.gcp.commercetools.com`\n\n## Development\n\nIn order to get started developing this connector certain configuration are necessary, most of which involve updating environment variables in both services (enabler, processor).\n\n#### Configuration steps\n\n#### 1. Environment Variable Setup\n\nNavigate to each service directory and duplicate the .env.template file, renaming the copy to .env. Populate the newly created .env file with the appropriate values.\n\n```bash\ncp .env.template .env\n```\n\n#### 2. Spin Up Components via Docker Compose\n\nWith the help of docker compose, you are able to spin up all necessary components required for developing the connector by running the following command from the root directory;\n\n```bash\ndocker compose up\n```\n\nThis command would start 3 required services, necessary for development\n\n1. JWT Server\n2. Enabler\n3. Processor\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fconnect-payment-integration-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommercetools%2Fconnect-payment-integration-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fconnect-payment-integration-template/lists"}