PHP code example of apimatic-payrix-sdk / payrix-api-sdk-php

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

    

apimatic-payrix-sdk / payrix-api-sdk-php example snippets


use PayrixLib\Environment;
use PayrixLib\Authentication\ApiKeyCredentialsBuilder;
use PayrixLib\Authentication\SessionKeyCredentialsBuilder;
use PayrixLib\Authentication\TxnSessionKeyCredentialsBuilder;
use PayrixLib\Authentication\UsernameCredentialsBuilder;
use PayrixLib\Authentication\PasswordCredentialsBuilder;
use PayrixLib\PayrixClientBuilder;

$client = PayrixClientBuilder::init()
    ->apiKeyCredentials(
        ApiKeyCredentialsBuilder::init(
            'APIKEY'
        )
    )
    ->sessionKeyCredentials(
        SessionKeyCredentialsBuilder::init(
            'SESSIONKEY'
        )
    )
    ->txnSessionKeyCredentials(
        TxnSessionKeyCredentialsBuilder::init(
            'TXNSESSIONKEY'
        )
    )
    ->usernameCredentials(
        UsernameCredentialsBuilder::init(
            'USERNAME'
        )
    )
    ->passwordCredentials(
        PasswordCredentialsBuilder::init(
            'PASSWORD'
        )
    )
    ->environment(Environment::SANDBOX)
    ->build();
bash
composer