idci / payment-bundle
Symfony payment bundle
Installs: 3 226
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.1 || ^8.0
- doctrine/persistence: ^2.2 || ^3.0
- jwarkentin/flaky: ~0.0.9
- paypal/rest-api-sdk-php: ^1.13
- payplug/payplug-php: ~2.5
- payum/iso4217: ~1.0
- ramsey/uuid: ^4.0 || ^5.0 || ^6.0
- ramsey/uuid-doctrine: ^1.4
- stripe/stripe-php: ^6.7
- symfony/dependency-injection: ^4.0 || ^5.0 || ^6.0
- symfony/dom-crawler: ^4.0 || ^5.0 || ^6.0
- symfony/form: ^4.0 || ^5.0 || ^6.0
- symfony/framework-bundle: ^4.0 || ^5.0 || ^6.0
- symfony/monolog-bundle: ^3.3
- symfony/process: ^4.0 || ^5.0 || ^6.0
- symfony/templating: ^4.0 || ^5.0 || ^6.0
- symfony/twig-bundle: ^4.0 || ^5.0 || ^6.0
Requires (Dev)
- phpunit/phpunit: ^9.0
Suggests
- alma/alma-php-client: ^1.0
- idci/step-bundle: >=4.0
- symfony/cache: ^4.0 || ^5.0 || ^6.0
- dev-master
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v4.4.0
- v4.3.1
- v4.3.0
- v4.2.10
- v4.2.9
- v4.2.8
- v4.2.7
- v4.2.6
- v4.2.5
- v4.2.4
- v4.2.3
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.14
- v4.1.13
- v4.1.12
- v4.1.11
- v4.1.10
- v4.1.9
- v4.1.8
- v4.1.7
- v4.1.6
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- 4.0.x-dev
- v4.0.32
- v4.0.31
- v4.0.30
- v4.0.29
- v4.0.28
- v4.0.27
- v4.0.26
- v4.0.25
- v4.0.24
- v4.0.23
- v4.0.22
- v4.0.21
- v4.0.20
- v4.0.19
- 4.0.18
- v4.0.17
- v4.0.16
- v4.0.15
- v4.0.14
- v4.0.13
- v4.0.12
- v4.0.11
- v4.0.10
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- 3.4.x-dev
- v3.4.6
- v3.4.5
- v3.4.4
- v3.4.3
- v3.4.2
- v3.4.1
- v3.4.0
- dev-feat/mercanet-bin
- dev-hotfix/gateway-tag
- dev-feat/tests
This package is auto-updated.
Last update: 2024-10-24 13:03:17 UTC
README
This Symfony bundle provide help for integrating payments solutions by the normalization of payment process thanks to gateways. Each used gateway must have a configuration to set its parameters.
Example controller :
<?php $paymentContext = $this->paymentManager->createPaymentContextByAlias('stripe_test'); // raw alias $payment = $paymentContext->createPayment([ 'item_id' => 5, 'amount' => 500, 'currency_code' => 'EUR', ]); return $this->render('@IDCIPayment/payment.html.twig', [ 'view' => $paymentContext->buildHTMLView(), ]);
A list of commands is provided by this bundle to manage gateway configurations & transactions.
Installation
Add dependency in your composer.json
file:
"require": { ..., "idci/payment-bundle": "^4.0", }
Install this new dependency in your application using composer:
$ composer update
Enable bundle in your application kernel :
<?php // config/bundles.php return [ // ... new IDCI\Bundle\PaymentBundle\IDCIPaymentBundle(), ];
Add this to your config.yml
file
# config/packages/idci_payment.yaml imports: - {resource: '@IDCIPaymentBundle/Resources/config/config.yml'} # Enable monolog logging using event subscriber plugged on transaction state changes idci_payment: enabled_logger_subscriber: true
(Optional) If you want to customize the payment logger, by defaults, it will output into main handler
# config/packages/monolog.yaml monolog: handlers: # ... payment_log: type: stream path: "%kernel.logs_dir%/%kernel.environment%.log" channels: ['payment']
Install routes in your config/routes/idci_payment.yaml
file:
# config/routes/idci_payment.yaml idci_payment: resource: '@IDCIPaymentBundle/Resources/config/routing.yml' prefix: / idci_payment_api: resource: '@IDCIPaymentBundle/Resources/config/routing_api.yml' prefix: /api
These tutorials may help you to personalize yourself this bundle:
- Create a new payment gateway: incorporate new payment method to this bundle
- Create your own transaction manager : help you to retrieve transaction from other stockages methods (default: Doctrine)
- Use this bundle with step bundle: simple configuration to make this bundle work with step bundle
- Create your own event subscriber: learn how to work with transaction event
Supported Gateways
- Stripe (example)
- Paypal (example)
- Paybox (example)
- Monetico (Unsupported for now)
- Ogone (Unsupported for now)
- PayPlug (example)
- SystemPay (example)
- Sofinco (example)
- Sofinco CACF (example)
- Eureka/FloaBank (example)
- Alma (example)
- Atos Sips Bin
- Atos Sips POST
- Atos Sips JSON
For testing purpose:
Command
PaymentGatewayConfiguration
# To create a PaymentGatewayConfiguration $ php bin/console app:payment-gateway-configuration:create # To show the list of PaymentGatewayConfiguration $ php bin/console app:payment-gateway-configuration:list # To update a PaymentGatewayConfiguration $ php bin/console app:payment-gateway-configuration:update # To delete a PaymentGatewayConfiguration $ php bin/console app:payment-gateway-configuration:delete
Transaction
# Remove all the aborted transaction created 1 day ago
$ php bin/console app:transaction:clean
Tests
Add test routing :
# config/routes/dev/idci_payment.yaml _test_payment: resource: '@IDCIPaymentBundle/Resources/config/routing_test.yml' prefix: /_test/
You can now test gateways on /_test/payment-gateway/select
(be sure to have created one or more gateway configuration)