PHP code example of epikoder / laravel-payment-gateway

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

    

epikoder / laravel-payment-gateway example snippets


class PayController extends \Epikoder\LaravelPaymentGateway\PaymentGatewayController {

  public function response() // Handles normal response
    {
     $content = $this->responseData;
     if (!$content) {
      // No data
     }
     
     return \Illuminate\Http\Response($content);
    }
    
    
 public function callbackResponse() // Handles off-site-response
    {
        $result = $this->paymentService->complete($this->provider);
        if ($this->provider->identifier() == 'paystack) {
            log_paystack_transactions($result);
        }
        
        if (!$result->successful) {
            return view('payment.error');
        }
        
        return view('payment.success');
    }
}

{
  public function response() // Handles normal response
    {
     $content = session()->pull(config("gateway.responseUrl"));
     return \Illuminate\Http\Response($content);
    }
    
    public function callbackResponse() // Handles off-site-response
    {
        $result = $this->paymentService->complete($this->paymentService->callbackProvider());
        if ($result->provider->identifier() == 'paystack) {
            log_paystack_transactions($result);
        }
        
        if (!$result->successful) {
            return view('payment.error');
        }
        
        return view('payment.success');
    }
}