> For the complete documentation index, see [llms.txt](https://web-developers-tips.gitbook.io/nafezly-payments/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://web-developers-tips.gitbook.io/nafezly-payments/payment-gateways/paypal.md).

# PayPal

how to use paypal payment gateway from nafezly payments

<pre class="language-php" data-line-numbers><code class="lang-php">&#x3C;?php

namespace App\Http\Controllers;

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

<strong>class PaymentController extends Controller
</strong><strong>{
</strong>
    public function payWithPaypal(Request $request){
        $payment = new PayPalPayment();
        $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 verifyWithPaypal(Request $request){
        $payment = new PayPalPayment();
        $response = $payment->verify($request);
        
        
        dd($response);
        //output
        //[
        //    'success'=>true,//or false
        //    'payment_id'=>"PID",
        //    'message'=>"Done Successfully",//message for client
        //    'process_data'=>""//payment response
        //]
    }
    
}
</code></pre>
