2017 © Pedro Peláez
 

yii2-extension yii2-braintree

Braintree for Yii2

image

tuyakhov/yii2-braintree

Braintree for Yii2

  • Tuesday, May 27, 2014
  • by tuyakhov
  • Repository
  • 4 Watchers
  • 4 Stars
  • 222 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 3 Open issues
  • 4 Versions
  • 2 % Grown

The README.md

Yii2-braintree

Integrate a credit card payment form with Braintree's API into Yii2. Inspired by braintreeapi, (*1)

Latest Stable Version Scrutinizer Code Quality Code Coverage Build Status Total Downloads, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

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

or add, (*5)

"tuyakhov/yii2-braintree": "*"

to the require section of your composer.json file., (*6)

Usage

You should add Braintree component to your yii config first:, (*7)

'components' => [
    'braintree' => [
        'class' => 'tuyakhov\braintree\Braintree',
        'merchantId' => 'YOUR_MERCHANT_ID',
        'publicKey' => 'YOUR_PUBLIC_KEY',
        'privateKey' => 'YOUR_PRIVATE_KEY',
    ],
]

Once the extension is installed, simply use it in your code by :, (*8)

BraintreeForm provide all basic operations for sales and stores customer info. Operation name equals scenario name. Available scenarios:, (*9)

creditCard - create a credit card doc
address - create an address doc
customer - create a customer doc
sale - create a transaction doc
saleFromVault - create a transaction from your Vault doc, (*10)

Action example:, (*11)

public function actionSale() {
    $model = new BraintreeForm();
    $model->setScenario('sale');
    if ($model->load(Yii::$app->request->post()) && $model->send()) {
        // do something
    }
    return $this->render('purchase', ['model' => $model]);
}

Form widget for your view:, (*12)

    <?php $form = \tuyakhov\braintree\ActiveForm::begin() ?>
    <?= $form->field($model, 'creditCard_number'); ?>
    <?= $form->field($model, 'creditCard_cvv'); ?>
    <?= $form->field($model, 'creditCard_expirationDate')->widget(\yii\widgets\MaskedInput::className(), [
           'mask' => '99/9999',
       ]) ?>
    <?= $form->field($model, 'amount'); ?>
    <?= \yii\helpers\Html::submitButton()?>
    <?php \tuyakhov\braintree\ActiveForm::end(); ?>

The Versions

27/05 2014

dev-master

9999999-dev https://github.com/tuyakhov/yii2-braintree

Braintree for Yii2

  Sources   Download

MIT

The Requires

 

by Anton Tuyakhov

yii2 yii braintree

27/05 2014

dev-tests

dev-tests https://github.com/tuyakhov/yii2-braintree

Braintree for Yii2

  Sources   Download

MIT

The Requires

 

by Anton Tuyakhov

yii2 yii braintree

27/05 2014

1.0.1

1.0.1.0 https://github.com/tuyakhov/yii2-braintree

Braintree for Yii2

  Sources   Download

MIT

The Requires

 

by Anton Tuyakhov

yii2 yii braintree

27/05 2014

1.0.2

1.0.2.0 https://github.com/tuyakhov/yii2-braintree

Braintree for Yii2

  Sources   Download

MIT

The Requires

 

by Anton Tuyakhov

yii2 yii braintree