sprypradeep/yii2-braintree

yii 2 braintree integration

Installs: 41

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 2

Open Issues: 0

Type:yii2-extension

1.0.1 2016-05-16 10:49 UTC

This package is not auto-updated.

Last update: 2024-05-06 11:23:21 UTC


README

braintree for yii 2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist sprypradeep/yii2-braintree "*"

or add

"sprypradeep/yii2-braintree": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, you should configure it in the application configuration like the following,

'components' => [
    'braintree' => [
        'class' => 'sprypradeep\braintree\Braintree',
        'environment' => 'sandbox',
        'merchantId' => 'your_merchant_id',
        'publicKey' => 'your_public_key',
        'privateKey' => 'your_private_key',
    ]
]

** Creating a customer

$braintree = Yii::$app->braintree;
$response = $braintree->call('Customer', 'create', [
    'firstName' => 'pradeep',
    ....
]);

$braintree = Yii::$app->braintree;
$response = $braintree->call('Transaction', 'sale', [
    'amount' => 25.00,
    'customerId' => 1,
    'paymentMethodToken' => 'some_token'
    ....
]);

braintree is using static methods for their API and to use the static methods for braintree. it should be like this Braintree_Transaction::sale($args) into $braintree->call('Transaction', 'sale', $args)