PHP code example of paga / paga-connect

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

    

paga / paga-connect example snippets




$pagaConnect = PagaConnectClient::builder()
                    ->setPrincipal("<Paga-Client-ID>")
                    ->setCredential("<Paga-Secret-Key>")
                    ->setRedirectUri("<Your-Redirect-URL>")
                    ->setScope(array('USER_DEPOSIT_FROM_CARD','MERCHANT_PAYMENT','USER_DETAILS_REQUEST'))
                    ->setUserData(array('FIRST_NAME','LAST_NAME','USERNAME','EMAIL'))
                    ->setIsTest(true)
                    ->build();

$token_data = $pagaConnect->getAccessToken($authorization_code);


$result = $pagaConnect ->getUserDetails( $token_data, "ref123");