Paytabs

how to use Paytabs payment gateway from nafezly payments

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Nafezly\Payments\Classes\PaytabsPayment;

class PaymentController extends Controller
{

    public function payWithPaytabs(Request $request){
        $payment = new PaytabsPayment();
        $response = $payment
        ->setAmount($amount)
        ->pay();
        
        
        dd($response);
        //output
        //[
        //    'payment_id'=>"", // refrence code that should stored in your orders table
        //    'redirect_url'=>"", // redirect url available for some payment gateways
        //    'html'=>"" // rendered html available for some payment gateways
        //]
        
    }
    
    public function verifyWithPaytabs(Request $request){
        $payment = new PaytabsPayment();
        $response = $payment->verify($request);
        
        
        dd($response);
        //output
        //[
        //    'success'=>true,//or false
        //    'payment_id'=>"PID",
        //    'message'=>"Done Successfully",//message for client
        //    'process_data'=>""//payment response
        //]
    }
    
}

Last updated