PHP code example of plutuss / stripe-laravel

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

    

plutuss / stripe-laravel example snippets




use Plutuss\Facades\Stripe;

class StripeController extends Controller
{
    public function index()
    {
        $payment_cart = Stripe::faker()->generateValidatePaymentToken();
    }
}




use Plutuss\Stripe\Contracts\StripeContract;

class StripeController extends Controller
{
    public function index(StripeContract $stripeContract)
    {
        $payment_cart = $stripeContract->faker()->generateValidatePaymentToken();
    }
}


   dd($payment_cart)
   
    Plutuss\Stripe\PaymentMethod\PaymentMethod {#298 ▼ // app/Http/Controllers/StripeController.php:14
    -parameters: array:2 [▼
    "id" => "pm_1OCKuHrRXLL6stefstxmYJka6"
    "data" => Stripe\PaymentMethod {#306 ▼
    #_opts: Stripe\Util\RequestOptions {#310 ▶}
    #_originalValues: array:9 [▶]
    #_values: array:9 [▶]
    #_unsavedValues: Stripe\Util\Set {#308 ▶}
    #_transientValues: Stripe\Util\Set {#309 ▶}
    #_retrieveOptions: []
    #_lastResponse: Stripe\ApiResponse {#305 ▶}
    +saveWithParent: false
    id: "pm_1OC0HNKuHrRXLL6stxmYJka6"
    object: "payment_method"
    billing_details: Stripe\StripeObject {#311 ▶}
    card: Stripe\StripeObject {#312 ▶}
    created: 1699882457
    customer: null
    livemode: false
    metadata: Stripe\StripeObject {#317 ▶}
    type: "card"
    }
    ]
    }



use Plutuss\Stripe\Contracts\StripeContract;

class StripeController extends Controller
{
    public function index(StripeContract $stripeContract)
    {
        $payment_cart = $stripeContract->faker()->generateValidatePaymentToken();
        $payment_cart->card;
        $payment_cart->type;
        $payment_cart->created;
    }
}

shell
php artisan vendor:publish --provider="Plutuss\Providers\StripeServiceProvider"
shell
php artisan migrate