PHP code example of sierratecnologia / payment-php

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

    

sierratecnologia / payment-php example snippets






\SierraTecnologia\SierraTecnologia::setApiKey('sk_test_BQokikJOvBiI2HlWgH4olfQ2');
$charge = \SierraTecnologia\Charge::create(['amount' => 2000, 'currency' => 'usd', 'source' => 'tok_189fqt2eZvKYlo2CTGBeg6Uq']);
echo $charge;

SierraTecnologia::setApiKey('d8e8fca2dc0f896fd7cb4cb0031ba249');
$charge = SierraTecnologia_Charge::create(array('source' => 'tok_XXXXXXXX', 'amount' => 2000, 'currency' => 'usd'));
echo $charge;

// set up your tweaked Curl client
$curl = new \SierraTecnologia\HttpClient\CurlClient();
$curl->setTimeout(10); // default is \SierraTecnologia\HttpClient\CurlClient::DEFAULT_TIMEOUT
$curl->setConnectTimeout(5); // default is \SierraTecnologia\HttpClient\CurlClient::DEFAULT_CONNECT_TIMEOUT

echo $curl->getTimeout(); // 10
echo $curl->getConnectTimeout(); // 5

// tell SierraTecnologia to use the tweaked client
\SierraTecnologia\ApiRequestor::setHttpClient($curl);

// use the SierraTecnologia API client as you normally would

// set up your tweaked Curl client
$curl = new \SierraTecnologia\HttpClient\CurlClient([CURLOPT_PROXY => 'proxy.local:80']);
// tell SierraTecnologia to use the tweaked client
\SierraTecnologia\ApiRequestor::setHttpClient($curl);

\SierraTecnologia\SierraTecnologia::setLogger($logger);

$charge = \SierraTecnologia\Charge::create(['amount' => 2000, 'currency' => 'usd', 'source' => 'tok_visa']);
echo $charge->getLastResponse()->headers['Request-Id'];

$curl = new \SierraTecnologia\HttpClient\CurlClient([CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1]);
\SierraTecnologia\ApiRequestor::setHttpClient($curl);

\SierraTecnologia\Charge::all([], [
    'api_key' => 'sk_test_...',
    'sitecpayment_account' => 'acct_...'
]);

\SierraTecnologia\Charge::retrieve("ch_18atAXCdGbJFKhCuBAa4532Z", [
    'api_key' => 'sk_test_...',
    'sitecpayment_account' => 'acct_...'
]);

\SierraTecnologia\SierraTecnologia::setCABundlePath("path/to/ca/bundle");

\SierraTecnologia\SierraTecnologia::setMaxNetworkRetries(2);

\SierraTecnologia\SierraTecnologia::setAppInfo("MyAwesomePlugin", "1.2.34", "https://myawesomeplugin.info");
bash
composer 
bash
./vendor/bin/phpunit tests/UtilTest.php
bash
./update_certs.php