PHP code example of plutu / plutu-laravel

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

    

plutu / plutu-laravel example snippets


use PlutuAdfali;
use PlutuSadad;
use PlutuLocalBankCards;
use PlutuTlync;
use PlutuMpgs;

$mobileNumber = '090000000'; // Mobile number should start with 09
$amount = 5.0; // amount in float format

try {

    $apiResponse = PlutuAdfali::verify($mobileNumber, $amount);

    if ($apiResponse->getOriginalResponse()->isSuccessful()) {
        // Process ID should be sent in the confirmation step
        $processId = $apiResponse->getProcessId();
    } elseif ($apiResponse->getOriginalResponse()->hasError()) {
        $errorCode = $apiResponse->getOriginalResponse()->getErrorCode();
        $errorMessage = $apiResponse->getOriginalResponse()->getErrorMessage();
    }

// Handle exceptions that may be thrown during the execution of the code
} catch (\Exception $e) {
    $exception = $e->getMessage();
}

php artisan vendor:publish --provider="PlutuLaravel\Providers\PlutuServiceProvider"
plutu.php