PHP code example of socialiteproviders / clover

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

    

socialiteproviders / clover example snippets


'clover' => [
  'client_id' => env('CLOVER_CLIENT_ID'),
  'client_secret' => env('CLOVER_CLIENT_SECRET'),
  'redirect' => env('CLOVER_REDIRECT_URI')
  'environment' => env('CLOVER_ENVIRONMENT', 'north_america'), // one of the following: 'sandbox', 'north_america' (for US/Canada), 'europe', or 'latin_america'
],

Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
    $event->extendSocialite('Clover', \SocialiteProviders\Clover\Provider::class);
});

protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // ... other providers
        \SocialiteProviders\Clover\CloverExtendSocialite::class.'@handle',
    ],
];

return Socialite::driver('clover')->redirect();

Route::get('clover/auth/callback', function () {
    $user = Socialite::driver('clover')->user();

    // Save these tokens somewhere for use with the API.
    $token = $user->accessTokenResponseBody;

    // Here’s what it looks like:
    // [
    //     'access_token' => 'JWT',
    //     'access_token_expiration' => 1709563149,
    //     'refresh_token' => 'clvroar-6e49ffe9b5122f137aa39d8f7f930558',
    //     'refresh_token_expiration' => 1741097349,
    // ]

    // You may also want to store the merchant ID somewhere.
    $merchantId = request()->input('merchant_id');

    // Here’s what it looks like:
    // 'ABC123DEF4567'
});