A Payum extension for Braintree gateway integration

A Payum extension for Braintree gateway integration

README

A Payum extension for Braintree gateway integration

Configuration

Register a gateway factory to the payum’s builder and create a gateway:

<?php

use PayumCorePayumBuilder;

$defaultConfig = ;

$payum = (new PayumBuilder)
    ->addGatewayFactory('braintree', new PayumBraintreeBraintreeGatewayFactory($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: PayumCoreBridgeSymfonyBuilderGatewayFactoryBuilder
        arguments: [PayumBraintreeBraintreeGatewayFactory]
        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 PayumCoreRequestCapture;

/** @var PayumCorePayum $payum */
$paypal = $payum->getGateway('braintree');

$model = new ArrayObject([
  // ...
]);

$paypal->execute(new Capture($model));

Source

Add a Comment

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *