PHPackages                             sierratecnologia/payment-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sierratecnologia/payment-php

ActiveLibrary[API Development](/categories/api)

sierratecnologia/payment-php
============================

0.4.4(2y ago)03811MITPHPPHP &gt;=5.4.0

Since May 21Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/SierraTecnologia/payment-php)[ Packagist](https://packagist.org/packages/sierratecnologia/payment-php)[ Docs](https://sierratecnologia.com.br)[ Fund](https://ricasolucoes.com.br/open-source/support-us)[ GitHub Sponsors](https://github.com/ricasolucoes)[ RSS](/packages/sierratecnologia-payment-php/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (21)Used By (1)

SierraTecnologia PHP bindings
=============================

[](#sierratecnologia-php-bindings)

[![Build Status](https://camo.githubusercontent.com/e33584f46f5b6e079cc5951ffdca8c9b5a179aa9f4f74ffaa98dadc3597f7e69/68747470733a2f2f7472617669732d63692e6f72672f7369657272617465636e6f6c6f6769612f7369657272617465636e6f6c6f6769612d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sierratecnologia/sierratecnologia-php)[![Latest Stable Version](https://camo.githubusercontent.com/fa9669c8c47216bdeb6855dddbda700d69bfca56e58ad81e2526675dcf591eac/68747470733a2f2f706f7365722e707567782e6f72672f7369657272617465636e6f6c6f6769612f7369657272617465636e6f6c6f6769612d7068702f762f737461626c652e737667)](https://packagist.org/packages/sierratecnologia/sierratecnologia-php)[![Total Downloads](https://camo.githubusercontent.com/ad114b20c6f2d56e83fef213fb7475442bace5af5ae5036f444c517aba952544/68747470733a2f2f706f7365722e707567782e6f72672f7369657272617465636e6f6c6f6769612f7369657272617465636e6f6c6f6769612d7068702f646f776e6c6f6164732e737667)](https://packagist.org/packages/sierratecnologia/sierratecnologia-php)[![License](https://camo.githubusercontent.com/90c130c5a1591352a81fbfeceb9a917f934245870c7884cffba2448fb4ed5021/68747470733a2f2f706f7365722e707567782e6f72672f7369657272617465636e6f6c6f6769612f7369657272617465636e6f6c6f6769612d7068702f6c6963656e73652e737667)](https://packagist.org/packages/sierratecnologia/sierratecnologia-php)[![Code Coverage](https://camo.githubusercontent.com/ddc92491fad3ca1caa8eb40eab9433ba135b7a3e4ceecf3ef3a351ba65ac49ba/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7369657272617465636e6f6c6f6769612f7369657272617465636e6f6c6f6769612d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/sierratecnologia/sierratecnologia-php?branch=master)

You can sign up for a SierraTecnologia account at .

Requirements
------------

[](#requirements)

PHP 5.4.0 and later.

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:

```
composer require sierratecnologia/sierratecnologia-php
```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once('vendor/autoload.php');
```

Manual Installation
-------------------

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/sierratecnologia/sierratecnologia-php/releases). Then, to use the bindings, include the `init.php` file.

```
require_once('/path/to/sierratecnologia-php/init.php');
```

Dependencies
------------

[](#dependencies)

The bindings require the following extensions in order to work properly:

- [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer
- [`json`](https://secure.php.net/manual/en/book.json.php)
- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Getting Started
---------------

[](#getting-started)

Simple usage looks like:

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

Documentation
-------------

[](#documentation)

Please see  for up-to-date documentation.

Legacy Version Support
----------------------

[](#legacy-version-support)

### PHP 5.3

[](#php-53)

If you are using PHP 5.3, you can download v5.9.2 ([zip](https://github.com/sierratecnologia/sierratecnologia-php/archive/v5.9.2.zip), [tar.gz](https://github.com/sierratecnologia/sierratecnologia-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/sierratecnologia/sierratecnologia-php/releases). This version will continue to work with new versions of the SierraTecnologia API for all common uses.

### PHP 5.2

[](#php-52)

If you are using PHP 5.2, you can download v1.18.0 ([zip](https://github.com/sierratecnologia/sierratecnologia-php/archive/v1.18.0.zip), [tar.gz](https://github.com/sierratecnologia/sierratecnologia-php/archive/v1.18.0.tar.gz)) from our [releases page](https://github.com/sierratecnologia/sierratecnologia-php/releases). This version will continue to work with new versions of the SierraTecnologia API for all common uses.

This legacy version may be included via `require_once("/path/to/sierratecnologia-php/lib/SierraTecnologia.php");`, and used like:

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

Custom Request Timeouts
-----------------------

[](#custom-request-timeouts)

*NOTE:* We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on SierraTecnologia's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://sierratecnologia.com.br/docs/api/php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic.

To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient.

```
// 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
```

Custom cURL Options (e.g. proxies)
----------------------------------

[](#custom-curl-options-eg-proxies)

Need to set a proxy for your requests? Pass in the requisite `CURLOPT_*` array to the CurlClient constructor, using the same syntax as `curl_stopt_array()`. This will set the default cURL options for each HTTP request made by the SDK, though many more common options (e.g. timeouts; see above on how to set those) will be overridden by the client even if set here.

```
// 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);
```

Alternately, a callable can be passed to the CurlClient constructor that returns the above array based on request inputs. See `testDefaultOptions()` in `tests/CurlClientTest.php` for an example of this behavior. Note that the callable is called at the beginning of every API request, before the request is sent.

### Configuring a Logger

[](#configuring-a-logger)

The library does minimal logging, but it can be configured with a [`PSR-3` compatible logger](http://www.php-fig.org/psr/psr-3/) so that messages end up there instead of `error_log`:

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

### Accessing response data

[](#accessing-response-data)

You can access the data from the last API response on any object via `getLastResponse()`.

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

### SSL / TLS compatibility issues

[](#ssl--tls-compatibility-issues)

SierraTecnologia's API now requires that [all connections use TLS 1.2](https://sierratecnologia.com.br/blog/upgrading-tls). Some systems (most notably some older CentOS and RHEL versions) are capable of using TLS 1.2 but will use TLS 1.0 or 1.1 by default. In this case, you'd get an `invalid_request_error` with the following error message: "SierraTecnologia no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at .".

The recommended course of action is to [upgrade your cURL and OpenSSL packages](https://support.sierratecnologia.com.br/questions/how-do-i-upgrade-my-sierratecnologia-integration-from-tls-1-0-to-tls-1-2#php) so that TLS 1.2 is used by default, but if that is not possible, you might be able to solve the issue by setting the `CURLOPT_SSLVERSION` option to either `CURL_SSLVERSION_TLSv1` or `CURL_SSLVERSION_TLSv1_2`:

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

### Per-request Configuration

[](#per-request-configuration)

For apps that need to use multiple keys during the lifetime of a process, like one that uses [SierraTecnologia Connect](https://sierratecnologia.com.br/connect), it's also possible to set a per-request key and/or account:

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

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

### Configuring CA Bundles

[](#configuring-ca-bundles)

By default, the library will use its own internal bundle of known CA certificates, but it's possible to configure your own:

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

### Configuring Automatic Retries

[](#configuring-automatic-retries)

The library can be configured to automatically retry requests that fail due to an intermittent network problem:

```
\SierraTecnologia\SierraTecnologia::setMaxNetworkRetries(2);
```

[Idempotency keys](https://sierratecnologia.com.br/docs/api/php#idempotent_requests) are added to requests to guarantee that retries are safe.

Development
-----------

[](#development)

Get [Composer](https://getcomposer.org/). For example, on Mac OS:

```
brew install composer
```

Install dependencies:

```
composer install
```

The test suite depends on [sierratecnologia-mock](https://github.com/sierratecnologia/sierratecnologia-mock), so make sure to fetch and run it from a background terminal ([sierratecnologia-mock's README](https://github.com/sierratecnologia/sierratecnologia-mock) also contains instructions for installing via Homebrew and other methods):

```
go get -u github.com/sierratecnologia/sierratecnologia-mock
sierratecnologia-mock
```

Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:

```
./vendor/bin/phpunit
```

Or to run an individual test file:

```
./vendor/bin/phpunit tests/UtilTest.php
```

Update bundled CA certificates from the [Mozilla cURL release](http://curl.haxx.se/docs/caextract.html):

```
./update_certs.php
```

Attention plugin developers
---------------------------

[](#attention-plugin-developers)

Are you writing a plugin that integrates SierraTecnologia and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example:

```
\SierraTecnologia\SierraTecnologia::setAppInfo("MyAwesomePlugin", "1.2.34", "https://myawesomeplugin.info");
```

The method should be called once, before any request is sent to the API. The second and third parameters are optional.

### SSL / TLS configuration option

[](#ssl--tls-configuration-option)

See the "SSL / TLS compatibility issues" paragraph above for full context. If you want to ensure that your plugin can be used on all systems, you should add a configuration option to let your users choose between different values for `CURLOPT_SSLVERSION`: none (default), `CURL_SSLVERSION_TLSv1` and `CURL_SSLVERSION_TLSv1_2`.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance47

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~131 days

Recently: every ~307 days

Total

14

Last Release

847d ago

Major Versions

v0.0.1 → v1.0.x-dev2020-05-22

v1.0.x-dev → v10.0.x-dev2020-05-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0a11577f9e4f7db7533432c22786439b3155ec7bc06be9760be7260c4ce1e0d?d=identicon)[ricardosierra](/maintainers/ricardosierra)

---

Top Contributors

[![ricardosierra](https://avatars.githubusercontent.com/u/5499444?v=4)](https://github.com/ricardosierra "ricardosierra (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")

---

Tags

apisdkpayment processingSierraTecnologiasitec

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/sierratecnologia-payment-php/health.svg)

```
[![Health](https://phpackages.com/badges/sierratecnologia-payment-php/health.svg)](https://phpackages.com/packages/sierratecnologia-payment-php)
```

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
