PHP code example of kennethormandy / craft-marketplace

1. Go to this page and download the library: Download kennethormandy/craft-marketplace 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/ */

    

kennethormandy / craft-marketplace example snippets


use Craft;
use yii\base\Event;
use kennethormandy\marketplace\services\PayeesService;

// …

Event::on(
    PayeesService::class,
    PayeesService::EVENT_AFTER_DETERMINE_PAYEE,
    function (Event $event) {
        $lineItem = $event->lineItem;

        // Ex. Manually override the Stripe Account ID, based on
        // a specific case for your marketplace
        $event->gatewayAccountId = "acct_abc123";

        Craft::info("Handle EVENT_AFTER_DETERMINE_PAYEE event here", __METHOD__);
    }
);