nfq-eta / payum-braintree
A Payum extension for Braintree gateway integration
v1.0.0
2018-02-01 15:24 UTC
Requires
- braintree/braintree_php: ^3.21.0
- payum/core: ^1.3
Requires (Dev)
- payum/core: ^1.3@dev
- php-http/guzzle6-adapter: ^1.0
- phpunit/phpunit: ^5.7.6
README
A Payum extension for Braintree gateway integration
Configuration
Register a gateway factory to the payum's builder and create a gateway:
<?php use Payum\Core\PayumBuilder; $defaultConfig = []; $payum = (new PayumBuilder) ->addGatewayFactory('braintree', new Payum\Braintree\BraintreeGatewayFactory($defaultConfig)) ->addGateway('braintree', [ 'factory' => 'braintree', 'sandbox' => true, 'merchantId' => '123123', 'publicKey' => '999999', 'privateKey' => '777888', ]) ->getPayum() ;
Or, if your are working on the bases of Symfony, you can define it in a service that way :
acme.braintree_gateway_factory: class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder arguments: [Payum\Braintree\BraintreeGatewayFactory] tags: - { name: payum.gateway_factory_builder, factory: braintree }
and in config.yml
payum: gateways: braintree: factory: braintree payum.http_client: '@payum.http_client' merchantId: 123123 publicKey: 999999 privateKey: 777888
Using the gateway:
<?php use Payum\Core\Request\Capture; /** @var \Payum\Core\Payum $payum */ $paypal = $payum->getGateway('braintree'); $model = new \ArrayObject([ // ... ]); $paypal->execute(new Capture($model));