PHP code example of rublex / laravel-core-gateway

1. Go to this page and download the library: Download rublex/laravel-core-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/ */

    

rublex / laravel-core-gateway example snippets


use Rublex\CoreGateway\Data\DynamicDataBag;

$meta = new DynamicDataBag([
    'customer' => [
        'email' => '[email protected]',
    ],
    'provider' => [
        'channel' => 'card',
    ],
]);

$email = $meta->

use Rublex\CoreGateway\Contracts\Common\GatewayInterface;
use Rublex\CoreGateway\Contracts\Payment\InitiatesPaymentInterface;
use Rublex\CoreGateway\Data\PaymentInitResultData;
use Rublex\CoreGateway\Data\PaymentRequestData;
use Rublex\CoreGateway\Enums\GatewayType;
use Rublex\CoreGateway\Enums\PaymentStatus;

final class ExampleGateway implements GatewayInterface, InitiatesPaymentInterface
{
    public function code(): string
    {
        return 'example';
    }

    public function type(): GatewayType
    {
        return GatewayType::FIAT;
    }

    public function initiate(PaymentRequestData $request): PaymentInitResultData
    {
        // map provider response into the core result shape
        return new PaymentInitResultData(PaymentStatus::PENDING);
    }
}