PHP code example of monetivo / monetivo-php

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

    

monetivo / monetivo-php example snippets








try {
    // app token
    $app_token = 'apptoken';

    // merchant's login
    $login = 'merchant_test_12345';

    // merchant's password
    $password = 'very_strong_password';

    // init the library
    $api = new \Monetivo\MerchantApi($app_token);

    // try to authenticate
    $token = $api->auth($login, $password);

    // następne zapytania do API
}
catch(Monetivo\Exceptions\MonetivoException $e) {
  echo $e->getHttpCode();
  echo $e->getResponse();
}
bash
composer