PHP code example of craft-unit / craft-stripe-express-checkout

1. Go to this page and download the library: Download craft-unit/craft-stripe-express-checkout 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/ */

    

craft-unit / craft-stripe-express-checkout example snippets


use craftunit\craftstripeexpresscheckout\events\ModifyButtonOptionsEvent;
use craftunit\craftstripeexpresscheckout\web\Variable;
use craft\helpers\App;
use yii\base\Event;

Event::on(
    Variable::class,
    Variable::EVENT_MODIFY_BUTTON_OPTIONS,
    function (ModifyButtonOptionsEvent $event) {
        if ($pmc = App::env('STRIPE_EXPRESS_PMC')) {
            $event->options['paymentMethodConfiguration'] = $pmc;
        }
    }
);