Skip to content

sprypradeep/yii2-braintree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Yii 2 Braintree Integration

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)

About

latest braintree-php usage with yii2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages