PHP code example of mage2kishan / module-mage-pos

1. Go to this page and download the library: Download mage2kishan/module-mage-pos 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/ */

    

mage2kishan / module-mage-pos example snippets


declare(strict_types=1);

namespace Acme\PosStripe\Model;

use Magento\Sales\Api\Data\OrderInterface;
use Panth\MagePos\Api\PaymentProcessorInterface;

class StripeProcessor implements PaymentProcessorInterface
{
    public function supports(string $methodCode): bool
    {
        return $methodCode === 'stripe_link';
    }

    public function process(OrderInterface $order, array $paymentRow): array
    {
        // Create a payment intent / checkout link for $paymentRow['amount'] ...
        return [
            'status' => 'pending',                       // 'paid' or 'pending'
            'reference' => 'pi_123',                     // gateway reference
            'redirect_url' => 'https://example.com/pay', // shown as link + QR at the terminal
        ];
    }
}
xml
<type name="Panth\MagePos\Model\Payment\ProcessorPool">
    <arguments>
        <argument name="processors" xsi:type="array">
            <item name="stripe_link" xsi:type="object">Acme\PosStripe\Model\StripeProcessor</item>
        </argument>
    </arguments>
</type>