PHP code example of azaharizaman / nexus-payment-gateway

1. Go to this page and download the library: Download azaharizaman/nexus-payment-gateway 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/ */

    

azaharizaman / nexus-payment-gateway example snippets


use Nexus\PaymentGateway\Contracts\GatewayManagerInterface;

final readonly class OnlinePaymentService
{
    public function __construct(
        private GatewayManagerInterface $gatewayManager,
    ) {}

    public function charge(string $gateway, ChargeRequest $request): ChargeResult
    {
        $processor = $this->gatewayManager->getProcessor($gateway);
        return $processor->charge($request);
    }
}