PHP code example of payplug / unified-plugin-core

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

    

payplug / unified-plugin-core example snippets


use PayplugUnifiedCore\Auth\OAuth2Client;
use PayplugUnifiedCore\Auth\TokenManager;
use PayplugUnifiedCore\Services\UnifiedApiPaymentService;

$oauth2Client = new OAuth2Client($httpClient, $baseUrl, $redirectUri, $scope, $audience);
$tokenManager = new TokenManager($tokenCache, $oauth2Client);

$paymentService = new UnifiedApiPaymentService($httpClient, $tokenManager, $baseUrl, $clientId, $clientSecret);
$payment = $paymentService->getPayment($paymentId);