PHP code example of mariojgt / gateway

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

    

mariojgt / gateway example snippets


   use Mariojgt\Gateway\Controllers\StripeContoller;

   public function sessionGenerate(Request $request)
       {
           // Start the stripe class
           $stipeManager = new StripeContoller();
           // Cart example, you Must folow this stucture
           $cartItem = [
               [
                   'name'        => 'kit kat',
                   'description' => 'Kit kat product',
                   'images'      => ['https://www.kitkat.com/images/main-logo-snap.png'],
                   'amount'      => 500, // Amount in pence value * 100
                   'currency'    => config('gateway.currency'),
                   'quantity'    => 2,
               ],
           ];
           // Send the cart item so stripe can create a valid session
           $session      = $stipeManager->process($cartItem);
           // Return a stripe session so we can use in the front end to redirect the user
           return response()->json([
               'session' => $session->id,
           ]);
       }
   

use Mariojgt\Gateway\Controllers\StripeContoller;
$stipeManager = new StripeContoller();
$session      = $stipeManager->checkSession('Session_id');