This is a connect application to integrate PayPal payment methods and package tracking into Commercetools. It follows the folder structure to ensure certification & deployment from commercetools connect team as stated here.
PayPal commercetools connector is available in the commercetools marketplace.
The payments demo can be seen at https://poc-mediaopt2.frontend.site/.
The latest version of the connector is available in commercetools Merchant Center and under tag 1.1.14.
The connector is supposed to be used together with the PayPal client app. The client is available at npm and github. The connector is responsible for the backend integration with commercetools and PayPal, while the client is responsible for the frontend. If for some reasons the PayPal client app can't be used, the PayPal JS SDK should be used instead. The example of the integration with commercetools frontend is covered in docs/usecases/README.md and the code can be seen in github.
To use the connector you need to have the following:
- commercetools Composable Commerce account and API client credentials, namely:
| credential | environmental variable | description |
|---|---|---|
| region | CTP_REGION | region, in which your commercetools project is hosted |
| project key | CTP_PROJECT_KEY | the key of your commercetools project |
| client ID | CTP_CLIENT_ID | the ID of your commercetools API client |
| client secret | CTP_CLIENT_SECRET | the secret of your commercetools API client |
| scope | CTP_SCOPE | the scope of your commercetools API client |
- PayPal business customer account and API client credentials,namely:
| credential | environmental variable | description |
|---|---|---|
| client ID | PAYPAL_CLIENT_ID | the ID of your PayPal API client |
| client secret | PAYPAL_CLIENT_SECRET | the secret of your PayPal API client |
| environment | PAYPAL_ENVIRONMENT | the environment of your PayPal API client (production or sandbox) |
Optionally for sending PayPal Pay Upon Invoice custom emails please provide SMTP credentials:
- SMTP_HOST
- SMTP_PORT
- SMTP_USERNAME
- SMTP_SENDER
- SMTP_PASSWORD
If you already use custom types for commercetools payment, customer or payment_interaction please consider using the corresponding types keys for PAYMENT_TYPE_KEY, CUSTOMER_TYPE_KEY and PAYMENT_INTERACTION_TYPE_KEY. Please see the corresponding commercetools tutorial for details.
This step is required if the connector is deployed through the commercetools Merchant Center or through the commercetools Connect API.
- create a custom application draft. The connector app later will be hosted by commercetools, so no valid application url is actually needed.
- use the entry point URI path that you selected and custom application id (available after registering the app) to deploy the connector.
- after the connector is deployed, the application can be accessed in the custom applications installations.
The connector can be installed directly from the commercetools marketplace or deployed from github repository via commercetools Connect API.
To run the connector locally for test purposes:
cd paypal-commercetools-extensionorcd paypal-commercetools-events- run
yarnto install the dependencies - insert commercetools and PayPal credentials to
.envfile - for paypal-commercetools-extension run
./bin/ngrok.shto start ngrok and insert the dynamic url in the.envfile as specified in post-deploy script - for paypal-commercetools-extension run
yarn connector:post-deployto register the extension with the public ngrok url - run
yarn start:devto build the application
Please set your application url (see the example in ngrok.sh) in the .env file and run post-deploy script. The url should be accessible externally.
The connector is written in TypeScript and yarn is used as the package manager.
Feel free to contribute to the project by opening an issue.
In the docs folder you can find:
- description of each application included (README.md)
- architecture of the connector (Architecture.pdf)
- documented PayPal Commercetools API Postman collection (PayPal.md, paypal.postman_collection.json)
- workflows folder with examples how to use the connector individually or together with PayPal client and commercetools frontend