{"id":26370,"date":"2021-06-21T16:54:00","date_gmt":"2021-06-21T13:54:00","guid":{"rendered":"https:\/\/themewp.inform.click\/?p=26370"},"modified":"2021-10-18T02:58:45","modified_gmt":"2021-10-17T23:58:45","slug":"integrazione-del-gateway-di-pagamento-paypal-in-laravel","status":"publish","type":"post","link":"https:\/\/themewp.inform.click\/it\/integrazione-del-gateway-di-pagamento-paypal-in-laravel\/","title":{"rendered":"Integrazione del gateway di pagamento PayPal in Laravel"},"content":{"rendered":"<p>Recentemente ho pubblicato un articolo sull&#8217;integrazione del <a href=\"https:\/\/themewp.inform.click\/it\/integrazione-del-gateway-di-pagamento-paypal-in-php-utilizzando-l-api-rest-di-paypal\/\" title=\"gateway di pagamento PayPal in PHP\" >gateway di pagamento PayPal in PHP<\/a>. In quell&#8217;articolo, uno dei nostri lettori ha chiesto di integrare il gateway di pagamento PayPal in Laravel. Sebbene Laravel sia costruito utilizzando PHP, hanno i propri standard da seguire. Devi modificare il tuo semplice codice PHP secondo il flusso di Laravel. In questo articolo, ti mostro come accettare pagamenti sul tuo sito web Laravel utilizzando PayPal Rest API.<\/p>\n<p>PayPal \u00e8 uno dei marchi pi\u00f9 affidabili per accettare pagamenti online. PayPal offre diversi modi per integrare il proprio sistema di pagamento nelle applicazioni web. Uno dei servizi \u00e8 PayPal Rest API che utilizzeremo per questo tutorial. Per iniziare, devi prima prendere il tuo ID cliente e il tuo segreto cliente.<\/p>\n<p>Vai al tuo account <a href=\"https:\/\/developer.paypal.com\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">sviluppatore PayPal<\/a> e accedi ad esso. Nella dashboard dello sviluppatore, fai clic sul menu &quot;Le mie app e credenziali&quot;. Quindi fare clic sul pulsante &quot;Crea app&quot; nella sezione delle app dell&#8217;API REST.<\/p>\n<p>Segui i passaggi come richiesto e otterrai la sandbox e le credenziali live. Per ora, copia l&#8217;ID client e il segreto client della modalit\u00e0 sandbox.<\/p>\n<p><a href=\"https:\/\/themewp.inform.click\/wp-content\/uploads\/2021\/04\/post-20136-6081c137ee496.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/themewp.inform.click\/wp-content\/uploads\/2021\/04\/post-20136-6081c137ee496.png\" alt=\"Integrazione del gateway di pagamento PayPal in Laravel\" ><\/a><\/p>\n<h3>Configurazione di base in Laravel per accettare pagamenti tramite PayPal<\/h3>\n<p>Quando i clienti effettuano il pagamento sul tuo sito web, devi memorizzare i dettagli di pagamento per un uso successivo. Crea una tabella &quot;pagamenti&quot; nel database per memorizzare i dettagli del pagamento. Crea una migrazione per la tabella &quot;pagamenti&quot; utilizzando il comando:<\/p>\n<pre><code>php artisan make:migration create_payments_table<\/code><\/pre>\n<p>Aprire il file di migrazione e modificare le colonne come segue.<\/p>\n<pre><code>&lt;?php\n...\n...\npublic function up()\n{\n\u00a0\u00a0\u00a0\u00a0Schema::create('payments', function (Blueprint $table) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;bigIncrements('id');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;string('payment_id');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;string('payer_id');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;string('payer_email');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;float('amount', 10, 2);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;string('currency');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;string('payment_status');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;timestamps();\n\u00a0\u00a0\u00a0\u00a0});\n}<\/code><\/pre>\n<p>Eseguire la migrazione precedente utilizzando il comando seguente.<\/p>\n<pre><code>php artisan migrate<\/code><\/pre>\n<p>Questo comando creer\u00e0 una tabella &quot;pagamenti&quot; nel tuo database. Quindi, crea un modello corrispondente alla tabella &quot;pagamenti&quot;.<\/p>\n<pre><code>php artisan make:model Payment<\/code><\/pre>\n<p>Successivamente, aggiungi le credenziali PayPal nel tuo <code>.env<\/code>file.<\/p>\n<pre><code>PAYPAL_CLIENT_ID=PASTE_HERE_CLIENT_ID\nPAYPAL_CLIENT_SECRET=PASTE_HERE_CLIENT_SECRET\nPAYPAL_CURRENCY=USD<\/code><\/pre>\n<p>Svuota la cache di configurazione usando il comando:<\/p>\n<pre><code>php artisan config:cache<\/code><\/pre>\n<p>Ho superato la valuta &quot;USD&quot;. L&#8217;utente pu\u00f2 modificarlo secondo i requisiti.<\/p>\n<p>Definiamo i percorsi di cui avremo bisogno nei prossimi passi.<\/p>\n<p><strong>route\/web.php<\/strong><\/p>\n<pre><code>&lt;?php\n...\n...\nRoute::get('payment', 'PaymentController@index');\nRoute::post('charge', 'PaymentController@charge');\nRoute::get('paymentsuccess', 'PaymentController@payment_success');\nRoute::get('paymenterror', 'PaymentController@payment_error');<\/code><\/pre>\n<h3>Integrazione del gateway di pagamento PayPal in Laravel<\/h3>\n<p>L&#8217;integrazione dell&#8217;API dei gateway di pagamento nell&#8217;applicazione \u00e8 una cosa piuttosto complessa. Fortunatamente, la libreria Omnipay ha semplificato la vita degli sviluppatori. <a href=\"https:\/\/github.com\/thephpleague\/omnipay\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">Omnipay<\/a> \u00e8 la libreria di elaborazione dei pagamenti pi\u00f9 popolare per PHP. Fornisce un codice semplice e pulito per l&#8217;integrazione di diversi gateway di pagamento. Installa la libreria Omnipay usando il comando:<\/p>\n<pre><code>composer require league\/omnipay omnipay\/paypal<\/code><\/pre>\n<p>Ora, crea un controller <code>PaymentController<\/code>e definisci i metodi menzionati nel file di route.<\/p>\n<pre><code>php artisan make:controller PaymentController<\/code><\/pre>\n<p><strong>PaymentController.php<\/strong><\/p>\n<pre><code>&lt;?php\n\u00a0\u00a0\nnamespace AppHttpControllers;\n\u00a0\u00a0\nuse IlluminateHttpRequest;\nuse OmnipayOmnipay;\nuse AppPayment;\n\u00a0\u00a0\nclass PaymentController extends Controller\n{\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0public $gateway;\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0public function __construct()\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$this-&gt;gateway = Omnipay::create('PayPal_Rest');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$this-&gt;gateway-&gt;setClientId(env('PAYPAL_CLIENT_ID'));\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$this-&gt;gateway-&gt;setSecret(env('PAYPAL_CLIENT_SECRET'));\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$this-&gt;gateway-&gt;setTestMode(true); \/\/set it to 'false' when go live\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0public function index()\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return view('payment');\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0public function charge(Request $request)\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if($request-&gt;input('submit'))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$response = $this-&gt;gateway-&gt;purchase(array(\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'amount' =&gt; $request-&gt;input('amount'),\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'currency' =&gt; env('PAYPAL_CURRENCY'),\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'returnUrl' =&gt; url('paymentsuccess'),\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'cancelUrl' =&gt; url('paymenterror'),\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0))-&gt;send();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if ($response-&gt;isRedirect()) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$response-&gt;redirect(); \/\/ this will automatically forward the customer\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} else {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ not successful\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $response-&gt;getMessage();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} catch(Exception $e) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $e-&gt;getMessage();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0public function payment_success(Request $request)\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Once the transaction has been approved, we need to complete it.\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if ($request-&gt;input('paymentId') &amp;&amp; $request-&gt;input('PayerID'))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$transaction = $this-&gt;gateway-&gt;completePurchase(array(\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'payer_id'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 =&gt; $request-&gt;input('PayerID'),\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'transactionReference' =&gt; $request-&gt;input('paymentId'),\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0));\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$response = $transaction-&gt;send();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if ($response-&gt;isSuccessful())\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ The customer has successfully paid.\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$arr_body = $response-&gt;getData();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Insert transaction data into the database\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$isPaymentExist = Payment::where('payment_id', $arr_body['id'])-&gt;first();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if(!$isPaymentExist)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$payment = new Payment;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$payment-&gt;payment_id = $arr_body['id'];\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$payment-&gt;payer_id = $arr_body['payer']['payer_info']['payer_id'];\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$payment-&gt;payer_email = $arr_body['payer']['payer_info']['email'];\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$payment-&gt;amount = $arr_body['transactions'][0]['amount']['total'];\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$payment-&gt;currency = env('PAYPAL_CURRENCY');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$payment-&gt;payment_status = $arr_body['state'];\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$payment-&gt;save();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return \"Payment is successful. Your transaction id is: \". $arr_body['id'];\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} else {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $response-&gt;getMessage();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} else {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return 'Transaction is declined';\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0public function payment_error()\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return 'User is canceled the payment.';\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\n}<\/code><\/pre>\n<p>Nel controller sopra, prendiamo l&#8217;importo dal modulo HTML e inviamo un utente a PayPal per il pagamento. Se il pagamento \u00e8 andato a buon fine, memorizziamo tutti i dettagli della transazione nella tabella &quot;pagamenti&quot;.<\/p>\n<p>Infine, crea un file blade chiamato <code>payment.blade.php<\/code>e aggiungi il codice di seguito.<\/p>\n<pre><code>&lt;form action=\"{{ url('charge') }}\" method=\"post\"&gt;\n\u00a0\u00a0\u00a0\u00a0&lt;input type=\"text\" name=\"amount\" \/&gt;\n\u00a0\u00a0\u00a0\u00a0{{ csrf_field() }}\n\u00a0\u00a0\u00a0\u00a0&lt;input type=\"submit\" name=\"submit\" value=\"Pay Now\"&gt;\n&lt;\/form&gt;<\/code><\/pre>\n<p>Quando inviamo questo modulo, il controllo va alla <code>charge<\/code>funzione <code>PaymentController<\/code>e il controller elabora il flusso di pagamento rimanente.<\/p>\n<h3>Invia le informazioni sul prodotto a PayPal<\/h3>\n<p>Nei passaggi precedenti, stiamo inviando l&#8217;importo da pagare su PayPal. Potresti anche voler inviare informazioni sul prodotto. L&#8217;utente pu\u00f2 vedere questi dettagli del prodotto nella pagina di pagamento prima di effettuare un pagamento.<\/p>\n<p>Per inviare le informazioni sul prodotto, \u00e8 necessario passare l&#8217;array &quot;items&quot; al <code>purchase<\/code>metodo come segue.<\/p>\n<pre><code>$response = $this-&gt;gateway-&gt;purchase(array(\n\u00a0\u00a0\u00a0\u00a0'amount' =&gt; $request-&gt;input('amount'),\n\u00a0\u00a0\u00a0\u00a0'items' =&gt; array(\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0array(\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'name' =&gt; 'Course Subscription',\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'price' =&gt; $request-&gt;input('amount'),\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'description' =&gt; 'Get access to premium courses.',\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'quantity' =&gt; 1\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),\n\u00a0\u00a0\u00a0\u00a0),\n\u00a0\u00a0\u00a0\u00a0'currency' =&gt; env('PAYPAL_CURRENCY'),\n\u00a0\u00a0\u00a0\u00a0'returnUrl' =&gt; url('paymentsuccess'),\n\u00a0\u00a0\u00a0\u00a0'cancelUrl' =&gt; url('paymenterror'),\n))-&gt;send();<\/code><\/pre>\n<p>Qui sto passando i dettagli del prodotto in modo statico. Dovresti renderlo dinamico a seconda del tuo prodotto.<\/p>\n<p>Spero che tu sappia dell&#8217;integrazione del gateway di pagamento PayPal in Laravel. Per favore condividi i tuoi pensieri e suggerimenti nella sezione commenti qui sotto.<\/p>\n<h4>articoli Correlati<\/h4>\n<ul>\n<li><a href=\"https:\/\/themewp.inform.click\/it\/integrazione-del-gateway-di-pagamento-authorize-net-in-laravel\/\" title=\"Integrazione del gateway di pagamento Authorize.Net in Laravel\">Integrazione del gateway di pagamento Authorize.Net in Laravel<\/a><\/li>\n<li><a href=\"https:\/\/themewp.inform.click\/it\/integrazione-del-gateway-di-pagamento-stripe-in-laravel\/\" title=\"Integrazione del gateway di pagamento Stripe in Laravel\">Integrazione del gateway di pagamento Stripe in Laravel<\/a><\/li>\n<li><a href=\"https:\/\/themewp.inform.click\/it\/integrazione-del-gateway-di-pagamento-paykun-in-laravel\/\" title=\"Integrazione del gateway di pagamento PayKun in Laravel\">Integrazione del gateway di pagamento PayKun in Laravel<\/a><\/li>\n<\/ul>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">Fonte di registrazione:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/artisansweb.net\" class=\"external external_icon\">artisansweb.net<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In questo articolo, abbiamo discusso dell&#8217;integrazione del gateway di pagamento PayPal in Laravel. PayPal \u00e8 una delle piattaforme pi\u00f9 popolari per accettare online<\/p>\n","protected":false},"author":1,"featured_media":20137,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[500],"tags":[846],"class_list":["post-26370","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-affiai-it"],"_links":{"self":[{"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/posts\/26370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/comments?post=26370"}],"version-history":[{"count":0,"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/posts\/26370\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/media\/20137"}],"wp:attachment":[{"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/media?parent=26370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/categories?post=26370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themewp.inform.click\/it\/wp-json\/wp\/v2\/tags?post=26370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}