bryglen / yii2-braintree
yii 2 braintree integration
Installs: 1 160
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 5
Open Issues: 2
Type:yii2-extension
Requires
- braintree/braintree_php: 2.30.0
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-12-21 17:43:23 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 bryglen/yii2-braintree "*"
or add
"bryglen/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' => 'bryglen\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' => 'bryan', .... ]); $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)