Skip to content

A Payum extension for Braintree gateway integration

License

Notifications You must be signed in to change notification settings

nfq-eta/payum-braintree

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payum_Braintree

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));

About

A Payum extension for Braintree gateway integration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 92.1%
  • HTML 7.9%