Cloud ready Braintree payment provider for Shopware
With the “PayPal Braintree” app, you can now easily integrate one of the most popular solutions for credit card payments into your store. With “PayPal Braintree”, you also benefit from the acceptance, security and scalability of one of the world’s largest payment providers and reach more than 200 million customers.
The app adds the "Braintree" payment method to Shopware shops, allowing merchants to integrate credit card payments for their customers. It is intended to be used by US merchants.
This repository encompasses both the robust backend infrastructure and the corresponding app. The backend forms the core of the application, while the app seamlessly integrates into Shopware shops.
✅ Credit card payments via Braintree available as app for the first time
✅ Easy integration & maintenance
✅ Maximum security thanks to automatic 3-D Secure
If you are a merchant and want to install the app to your shop, you can find it here
- First setup devenv
- Clone the repository
git clone https://github.com/shopware/braintree-app
- Replace urls
- Run
devenv up
- Run
composer setup
- Install and activate the app
- Rebuild shopware's storefront js
Run composer setup:url
to replace hardcoded urls with your APP_URL
, e.g. http://localhost:8080
.
There are several hardcoded urls that need to be replaced when developing locally:
manifest.xml
assets/src/service/api.ts
Resources/app/storefront/src/checkout/swag-braintree.hosted-fields.js
Replace https://braintree.shopware.com
with your APP_URL
, e.g. http://localhost:8080
- Build dev:
npm run dev
- Build prod:
npm run build
- Watch dev:
npm run watch
- ESLint:
composer eslint
orcomposer eslint-fix
- ECS:
composer ecs-fix
- PHPStan:
composer phpstan
- PHPUnit:
composer phpunit
- Infection:
composer infection
To execute tests, run:
composer phpunit
This repository uses mutation testing to determine effectiveness of unit tests.
To test for mutations, run:
composer infection
Repository structure
└── braintree-app/
├── .env
├── .env.test
├── .envrc
├── .eslintrc.js
├── .github
│ ├── dependabot.yml
│ └── workflows
│ ├── js.yml
│ └── php.yml
├── .gitlab-ci.yml
├── .php-cs-fixer.dist.php
├── .platform
│ ├── routes.yaml
│ └── services.yaml
├── .platform.app.yaml
├── Resources
│ ├── app
│ │ └── storefront
│ ├── snippet
│ │ ├── braintree.de-DE.json
│ │ └── braintree.en-GB.json
│ └── views
│ └── storefront
├── bin
│ └── console
├── composer.json
├── config
│ ├── bundles.php
│ ├── packages
│ │ ├── cache.yaml
│ │ ├── debug.yaml
│ │ ├── dev
│ │ ├── doctrine.yaml
│ │ ├── doctrine_migrations.yaml
│ │ ├── framework.yaml
│ │ ├── http_discovery.yaml
│ │ ├── monolog.yaml
│ │ ├── nelmio_cors.yaml
│ │ ├── routing.yaml
│ │ ├── shopware_app.yaml
│ │ ├── twig.yaml
│ │ ├── uid.yaml
│ │ └── webpack_encore.yaml
│ ├── preload.php
│ ├── routes
│ │ ├── framework.yaml
│ │ ├── shopware_app.yaml
│ │ └── web_profiler.yaml
│ ├── routes.yaml
│ └── services.php
├── devenv.nix
├── devenv.yaml
├── ecs.php
├── infection.json5
├── migrations
│ ├── Version20230920084343AddShop.php
│ ├── Version20231002072740AddConfig.php
│ ├── Version20231002130113AddCurrencyMapping.php
│ └── Version20231024121459AddTransaction.php
├── package-lock.json
├── package.json
├── phpstan.neon
├── phpunit.xml.dist
├── public
│ └── index.php
├── src
│ ├── Braintree
│ │ ├── Dto
│ │ ├── Exception
│ │ ├── Gateway
│ │ ├── Payment
│ │ └── Util
│ ├── Command
│ │ └── SetupUrlCommand.php
│ ├── Controller
│ │ ├── AdminController.php
│ │ ├── BraintreeConfigurationController.php
│ │ ├── EntityController.php
│ │ ├── PaymentController.php
│ │ └── StorefrontController.php
│ ├── Doctrine
│ │ └── RespectfulUuidGenerator.php
│ ├── Entity
│ │ ├── ConfigEntity.php
│ │ ├── Contract
│ │ ├── CurrencyMappingEntity.php
│ │ ├── ShopEntity.php
│ │ └── TransactionEntity.php
│ ├── Framework
│ │ ├── ArgumentResolver
│ │ ├── Exception
│ │ ├── Request
│ │ ├── Response
│ │ └── Serializer
│ ├── Kernel.php
│ ├── Repository
│ │ ├── AbstractRepository.php
│ │ ├── ConfigRepository.php
│ │ ├── CurrencyMappingRepository.php
│ │ ├── ShopRepository.php
│ │ └── TransactionRepository.php
│ └── Tests
│ ├── Contract
│ ├── Entity.php
│ ├── IdsCollection.php
│ ├── Repository.php
│ └── Serializer
├── templates
│ └── admin-sdk.html.twig
├── tsconfig.json
└── webpack.config.js
Contributions are welcome! Here are several ways you can contribute:
- Submit Pull Requests: Review open PRs, and submit your own PRs.
- Report Issues: Submit bugs found or log feature requests for Braintree-app.
Pull request guideline
- Fork the Repository: Start by forking the project repository to your GitHub account.
- Clone Locally: Clone the forked repository to your local machine using a Git client.
git clone https://github.com/shopware/braintree-app
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to GitHub: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
Once your PR is reviewed and approved, it will be merged into the trunk branch.
The braintree app is completely free and released under the MIT License.