kdn/yii2-braintree 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kdn/yii2-braintree

最新稳定版本:2.0.0

Composer 安装命令:

composer require kdn/yii2-braintree

包简介

Braintree for Yii 2.

README 文档

README

Integrate a credit card payment form with Braintree's API into Yii 2. Inspired by braintreeapi.

License Latest Stable Version Code Coverage Scrutinizer Code Quality Code Climate

Requirements

  • PHP 7.2 or later;
  • Yii framework 2.

Installation

The preferred way to install this extension is through Composer.

To install, either run

php composer.phar require kdn/yii2-braintree "*"

or add

"kdn/yii2-braintree": "*"

to the require section of your composer.json file.

Usage

You should add Braintree component to your Yii configuration first:

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

BraintreeForm provides all basic operations for sales and stores customer info. Operation name equals scenario name. Available scenarios:

Action example:

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 a view:

use tuyakhov\braintree\ActiveForm;
use yii\helpers\Html;
use yii\widgets\MaskedInput;

$form = ActiveForm::begin();
?>

<?= $form->field($model, 'creditCard_number'); ?>
<?= $form->field($model, 'creditCard_cvv'); ?>
<?=
$form->field($model, 'creditCard_expirationDate')
    ->widget(MaskedInput::class, ['mask' => '99/9999']);
?>
<?= $form->field($model, 'amount'); ?>
<?= Html::submitButton(); ?>

<?php
ActiveForm::end();

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固