PHP code example of bryglen / yii2-braintree

1. Go to this page and download the library: Download bryglen/yii2-braintree library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bryglen / yii2-braintree example snippets


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

$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'
    ....
]);

php composer.phar