2017 © Pedro Peláez
 

library yii2-stripe

Yii2 Stripe Wrapper

image

davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  • Tuesday, August 2, 2016
  • by davidjeddy
  • Repository
  • 2 Watchers
  • 0 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

Yii2 Stripe Wrapper.

Badges

SensioLabsInsight, (*1)

Installation

The preferred way to install this extension is through http://getcomposer.org/download/., (*2)

Either run, (*3)

php composer.phar require davidjeddy/yii2-stripe "dev-master"

or add, (*4)

"davidjeddy/yii2-stripe": "~1.0"

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

Usage

Add a new component in main.php, (*6)

'components' => [
...
'stripe' => [
    'class' => 'davidjeddy\stripe\Stripe',
    'publicKey' => "pk_test_xxxxxxxxxxxxxxxxxxx",
    'privateKey' => "sk_test_xxxxxxxxxxxxxxxxxx",
],
...

To render simple checkout form just call the widget in the view, it will automatically register the scripts. Check stripe documentation for more options., (*7)

use davidjeddy\stripe\StripeCheckout;

= 
StripeCheckout::widget([
    'action' => '/',
    'name' => 'Demo test',
    'description' => '2 widgets ($20.00)',
    'amount' => 2000,
    'image' => '/128x128.png',
]);
?>

Custom checkout form is an extended version of simple form, but you can customize the button (see buttonOptions) and handle token as you want (tokenFunction)., (*8)

use davidjeddy\stripe\StripeCheckoutCustom;

= 
StripeCheckoutCustom::widget([
    'action' => '/',
    'name' => 'Demo test',
    'description' => '2 widgets ($20.00)',
    'amount' => 2000,
    'image' => '/128x128.png',
    'buttonOptions' => [
        'class' => 'btn btn-lg btn-success',
    ],
    'tokenFunction' => new JsExpression('function(token) { 
                alert("Here you should control your token."); 
    }'),
    'openedFunction' => new JsExpression('function() { 
                alert("Model opened"); 
    }'),
    'closedFunction' => new JsExpression('function() { 
                alert("Model closed"); 
    }'),
]);
?>

Example of a custom form. StripeForm is an extended ActiveForm so you can perform validation of amount and other attributes you want. Use of Jquery Payment library is optional, you can disable format and validation and write your own implementation. You can also change JsExpression for response and request handlers., (*9)

use davidjeddy\stripe\StripeForm;

  'stripeToken',
             'errorContainerId' => 'payment-errors',
             'brandContainerId' => 'cc-brand',
             'errorClass' => 'has-error',
             'applyJqueryPaymentFormat' => true,
             'applyJqueryPaymentValidation' => true,
             'options' => ['autocomplete' => 'on']
 ]);
 ?>



= $form->numberInput() ?>
= $form->cvcInput() ?>
= $form->monthAndYearInput() ?>
= $form->monthInput() ?>
= $form->yearInput() ?>
= Html::submitButton('Submit'); ?>

Contribution / Credit

Forked From: https://github.com/ruskid/yii2-stripe I would like to give the original author all due credit, great package., (*10)

The Versions

02/08 2016

dev-master

9999999-dev https://github.com/davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GPL-2.0

The Requires

 

by Victor Demin

yii2 stripe

02/08 2016

dev-patch-3

dev-patch-3 https://github.com/davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GPL-2.0

The Requires

 

by Victor Demin

yii2 stripe

27/06 2016

1.2.5

1.2.5.0 https://github.com/davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GPL-2.0

The Requires

 

by Victor Demin

yii2 stripe

27/06 2016

1.2.4

1.2.4.0 https://github.com/davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GPL-2.0

The Requires

 

by Victor Demin

yii2 stripe

27/06 2016

1.2.3

1.2.3.0 https://github.com/davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GNU

The Requires

 

by Victor Demin

yii2 stripe

27/06 2016

1.2.2

1.2.2.0 https://github.com/davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GNU

The Requires

 

by Victor Demin

yii2 stripe

27/06 2016

1.2.1

1.2.1.0 https://github.com/davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GNU

The Requires

 

by Victor Demin

yii2 stripe

27/06 2016

1.2.0

1.2.0.0 https://github.com/davidjeddy/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GNU

The Requires

 

by Victor Demin

yii2 stripe

17/06 2016

dev-patch-2

dev-patch-2 https://github.com/ruskid/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GNU

The Requires

 

by Victor Demin

yii2 stripe

17/06 2016

dev-patch-1

dev-patch-1 https://github.com/ruskid/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GNU

The Requires

 

by Victor Demin

yii2 stripe

15/04 2015

1.1

1.1.0.0 https://github.com/ruskid/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GNU

The Requires

 

by Victor Demin

yii2 stripe

24/03 2015

v1.0

1.0.0.0 https://github.com/ruskid/yii2-stripe

Yii2 Stripe Wrapper

  Sources   Download

GNU

The Requires

 

by Victor Demin

yii2 stripe