T
T
teodor7teodor72018-03-29 15:05:38
Yii
teodor7teodor7, 2018-03-29 15:05:38

How to connect Stripe to Yii2?

Tell me how to tie https://github.com/ruskid/yii2-stripe to Yii2 so that all form data and stripe data are on the same page and can be validated.

<?php
                $form = ActiveForm::begin([]);
                ?>
                    <div class="sectionBlock">
                        <h2 class="form-section-title bordered">Basic Information</h2>
                        <div class="formRow flex wrap">
                            <div class="formBlock col-xs-12 col-md-6">
                        <?= $form->field($model, 'university_id')->dropDownList(common\models\University::getUniversityList()) ?>
                            </div>
                <?=
                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"); 
    }'),
                ]);
                ?>
                <?php ActiveForm::end(); ?>

I don’t understand how then I can get that everything went well and throw it to save

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mykola, 2018-03-29
@iSensetivity

I first made a save form, and then I redirected to the payment page, where Stripe was.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question