PHP code example of sdksio / apimatic-cp-sdk

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

    

sdksio / apimatic-cp-sdk example snippets


use CellPointApiLib\Logging\LoggingConfigurationBuilder;
use CellPointApiLib\Logging\RequestLoggingConfigurationBuilder;
use CellPointApiLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
use CellPointApiLib\Environment;
use CellPointApiLib\Authentication\CpdIssuedJwtCredentialsBuilder;
use CellPointApiLib\Models\OauthScopeCpdIssuedJwt;
use CellPointApiLib\Authentication\MerchantIssuedJwtCredentialsBuilder;
use CellPointApiLib\CellPointApiClientBuilder;

$client = CellPointApiClientBuilder::init()
    ->cpdIssuedJwtCredentials(
        CpdIssuedJwtCredentialsBuilder::init(
            'OAuthClientId',
            'OAuthClientSecret'
        )
            ->oauthScopes(
                [
                    OauthScopeCpdIssuedJwt::BUYER,
                    OauthScopeCpdIssuedJwt::DASHBOARDSVIEW
                ]
            )
    )
    ->merchantIssuedJwtCredentials(
        MerchantIssuedJwtCredentialsBuilder::init(
            'AccessToken'
        )
    )
    ->environment(Environment::PRODUCTION)
    ->loggingConfiguration(
        LoggingConfigurationBuilder::init()
            ->level(LogLevel::INFO)
            ->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
            ->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
    )
    ->build();