PHPackages                             pagarme/pagarme-php-sdk - 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. pagarme/pagarme-php-sdk

ActiveLibrary[API Development](/categories/api)

pagarme/pagarme-php-sdk
=======================

Pagarme API

6.8.17(1y ago)7138.3k—3.8%7[11 issues](https://github.com/pagarme/pagarme-php-sdk/issues)[2 PRs](https://github.com/pagarme/pagarme-php-sdk/pulls)MITPHPPHP ^7.2 || ^8.0

Since Jan 14Pushed 1y ago8 watchersCompare

[ Source](https://github.com/pagarme/pagarme-php-sdk)[ Packagist](https://packagist.org/packages/pagarme/pagarme-php-sdk)[ Docs](https://github.com/pagarme/)[ RSS](/packages/pagarme-pagarme-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (32)Used By (0)

Getting Started with PagarmeApiSDK
==================================

[](#getting-started-with-pagarmeapisdk)

Introduction
------------

[](#introduction)

Pagarme API

Building
--------

[](#building)

The generated code has dependencies over external libraries like UniRest and JsonMapper. JsonMapper requires docblock annotations like `@var`, `@maps`, and `@factory` to map JSON responses with our class definitions. Hence the docblocks in generated code cannot be disabled by deactivating the PHP configurations like `opcache.save_comments`. These dependencies are defined in the `composer.json` file that comes with the SDK. To resolve these dependencies, we use the Composer package manager which requires PHP greater than or equal to 7.2 installed in your system. Visit  to download the installer file for Composer and run it in your system. Open command prompt and type `composer --version`. This should display the current version of the Composer installed if the installation was successful.

- Using command line, navigate to the directory containing the generated files (including `composer.json`) for the SDK.
- Run the command `composer install`. This should install all the required dependencies and create the `vendor` directory in your project directory.

[![Building SDK - Step 1](https://camo.githubusercontent.com/7f93590eaae797a265b0f870a6edaf1fb32f1ed9912846b3196d47e1f63cb551/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d696e7374616c6c446570656e64656e63696573)](https://camo.githubusercontent.com/7f93590eaae797a265b0f870a6edaf1fb32f1ed9912846b3196d47e1f63cb551/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d696e7374616c6c446570656e64656e63696573)

### Configuring CURL Certificate Path in php.ini

[](#configuring-curl-certificate-path-in-phpini)

ℹ️ **Note** This is for Windows users only.

CURL used to include a list of accepted CAs, but no longer bundles ANY CA certs. So by default it will reject all SSL certificates as unverifiable. You will have to get your CA's cert and point curl at it. The steps are as follows:

1. Download the certificate bundle (.pem file) from  on to your system.
2. Add curl.cainfo = "PATH\_TO/cacert.pem" to your php.ini file located in your php installation. “PATH\_TO” must be an absolute path containing the .pem file.

```
[curl]; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = PATH_TO/cacert.pem

```

Installation
------------

[](#installation)

The following section explains how to use the PagarmeApiSDKLib library in a new project.

### 1. Open Project in an IDE

[](#1-open-project-in-an-ide)

Open an IDE for PHP like PhpStorm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

[![Open project in PHPStorm - Step 1](https://camo.githubusercontent.com/9b501d5462506347b12f1fa5f8358b31608e7df0ff9b454108574bc157a29be5/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6f70656e494445)](https://camo.githubusercontent.com/9b501d5462506347b12f1fa5f8358b31608e7df0ff9b454108574bc157a29be5/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6f70656e494445)

Click on `Open` in PhpStorm to browse to your generated SDK directory and then click `OK`.

[![Open project in PHPStorm - Step 2](https://camo.githubusercontent.com/9fe5091d6e06642faa12013e0fd8e34e1e0edf417b210646c541632b4630449d/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6f70656e50726f6a65637430)](https://camo.githubusercontent.com/9fe5091d6e06642faa12013e0fd8e34e1e0edf417b210646c541632b4630449d/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6f70656e50726f6a65637430)

### 2. Add a new Test Project

[](#2-add-a-new-test-project)

Create a new directory by right clicking on the solution name as shown below:

[![Add a new project in PHPStorm - Step 1](https://camo.githubusercontent.com/ce4667a6cba217cb56ff0caf559fa8f0672d83e1ff281b2f37cadbf850692d36/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6372656174654469726563746f7279)](https://camo.githubusercontent.com/ce4667a6cba217cb56ff0caf559fa8f0672d83e1ff281b2f37cadbf850692d36/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6372656174654469726563746f7279)

Name the directory as "test".

[![Add a new project in PHPStorm - Step 2](https://camo.githubusercontent.com/fbbc9113a911b211996d340a719c37cdd5e3a6404f7a221b4f0d892904ef6e96/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6e616d654469726563746f7279)](https://camo.githubusercontent.com/fbbc9113a911b211996d340a719c37cdd5e3a6404f7a221b4f0d892904ef6e96/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6e616d654469726563746f7279)

Add a PHP file to this project.

[![Add a new project in PHPStorm - Step 3](https://camo.githubusercontent.com/b976867591d57cb79379e6a1d1601921296f63df7b973e14486d1c9d4b73a9c5/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d63726561746546696c65)](https://camo.githubusercontent.com/b976867591d57cb79379e6a1d1601921296f63df7b973e14486d1c9d4b73a9c5/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d63726561746546696c65)

Name it "testSDK".

[![Add a new project in PHPStorm - Step 4](https://camo.githubusercontent.com/8eb54c4ab452c2e709e0316c03662b8985ea4c2a8464f73665f00a4ef139d623/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6e616d6546696c65)](https://camo.githubusercontent.com/8eb54c4ab452c2e709e0316c03662b8985ea4c2a8464f73665f00a4ef139d623/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6e616d6546696c65)

Depending on your project setup, you might need to include composer's autoloader in your PHP code to enable auto loading of classes.

```
require_once "vendor/autoload.php";
```

It is important that the path inside require\_once correctly points to the file `autoload.php` inside the vendor directory created during dependency installations.

[![Add a new project in PHPStorm - Step 5](https://camo.githubusercontent.com/6149b46dbfe877adf8f87ce97f7e31be74cb6d449f2bf2d9c9557fdadc1a8793/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d70726f6a65637446696c6573)](https://camo.githubusercontent.com/6149b46dbfe877adf8f87ce97f7e31be74cb6d449f2bf2d9c9557fdadc1a8793/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d70726f6a65637446696c6573)

After this you can add code to initialize the client library and acquire the instance of a Controller class. Sample code to initialize the client library and use the Controller methods is given in the subsequent sections.

### 3. Run the Test Project

[](#3-run-the-test-project)

To run your project you must set the Interpreter for your project. Interpreter is the PHP engine installed on your computer.

Open `Settings` from `File` menu.

[![Run Test Project - Step 1](https://camo.githubusercontent.com/6074fdeaa6de7b7c4dd121047f595b61ea86ba58322be1a2b610b0be47ce468f/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6f70656e53657474696e6773)](https://camo.githubusercontent.com/6074fdeaa6de7b7c4dd121047f595b61ea86ba58322be1a2b610b0be47ce468f/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d6f70656e53657474696e6773)

Select `PHP` from within `Languages & Frameworks`.

[![Run Test Project - Step 2](https://camo.githubusercontent.com/930804734f723b9114819918885abcdbdc1cf88896ed026dfac517cecfbfcbf6/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d736574496e74657270726574657230)](https://camo.githubusercontent.com/930804734f723b9114819918885abcdbdc1cf88896ed026dfac517cecfbfcbf6/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d736574496e74657270726574657230)

Browse for Interpreters near the `Interpreter` option and choose your interpreter.

[![Run Test Project - Step 3](https://camo.githubusercontent.com/2d0704abaa92deccbd164cb10d8006b408c3d3b48a1ba6e1c384f6284416e34c/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d736574496e74657270726574657231)](https://camo.githubusercontent.com/2d0704abaa92deccbd164cb10d8006b408c3d3b48a1ba6e1c384f6284416e34c/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d736574496e74657270726574657231)

Once the interpreter is selected, click `OK`.

[![Run Test Project - Step 4](https://camo.githubusercontent.com/92cfcd4c44adb782348201c4f747c6ac573b23eb528e962c37c9a208cb5f71c5/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d736574496e74657270726574657232)](https://camo.githubusercontent.com/92cfcd4c44adb782348201c4f747c6ac573b23eb528e962c37c9a208cb5f71c5/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d736574496e74657270726574657232)

To run your project, right click on your PHP file inside your Test project and click on `Run`.

[![Run Test Project - Step 5](https://camo.githubusercontent.com/306944c375aa7bfc265f7ed7b53d721c1f63afcc0eb0f26a83367f6a3485041c/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d72756e50726f6a656374)](https://camo.githubusercontent.com/306944c375aa7bfc265f7ed7b53d721c1f63afcc0eb0f26a83367f6a3485041c/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f776f726b7370616365466f6c6465723d50616761726d6541706953444b26737465703d72756e50726f6a656374)

Initialize the API Client
-------------------------

[](#initialize-the-api-client)

***Note:*** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/client.md)

The following parameters are configurable for the API Client:

ParameterTypeDescriptionserviceRefererName`string`timeout`int`Timeout for API calls in seconds.
*Default*: `0`enableRetries`bool`Whether to enable retries and backoff feature.
*Default*: `false`numberOfRetries`int`The number of retries to make.
*Default*: `0`retryInterval`float`The retry time interval between the endpoint calls.
*Default*: `1`backOffFactor`float`Exponential backoff factor to increase interval between retries.
*Default*: `2`maximumRetryWaitTime`int`The maximum wait time in seconds for overall retrying requests.
*Default*: `0`retryOnTimeout`bool`Whether to retry on request timeout.
*Default*: `true`httpStatusCodesToRetry`array`Http status codes to retry against.
*Default*: `408, 413, 429, 500, 502, 503, 504, 521, 522, 524`httpMethodsToRetry`array`Http methods to retry against.
*Default*: `'GET', 'PUT'`proxyConfiguration[`ProxyConfigurationBuilder`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/proxy-configuration-builder.md)Represents the proxy configurations for API callsbasicAuthCredentials[`BasicAuthCredentials`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/auth/basic-authentication.md)The Credentials Setter for Basic AuthenticationThe API client can be initialized as follows:

```
$client = PagarmeApiSDKClientBuilder::init()
    ->basicAuthCredentials(
        BasicAuthCredentialsBuilder::init(
            'BasicAuthUserName',
            'BasicAuthPassword'
        )
    )
    ->serviceRefererName('ServiceRefererName')
    ->build();
```

Authorization
-------------

[](#authorization)

This API uses the following authentication schemes.

- [`httpBasic (Basic Authentication)`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/auth/basic-authentication.md)

API Errors
----------

[](#api-errors)

Here is the list of errors that the API might throw.

HTTP Status CodeError DescriptionException Class400Invalid request[`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/models/error-exception.md)401Invalid API key[`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/models/error-exception.md)404An informed resource was not found[`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/models/error-exception.md)412Business validation error[`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/models/error-exception.md)422Contract validation error[`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/models/error-exception.md)500Internal server error[`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/models/error-exception.md)List of APIs
------------

[](#list-of-apis)

- [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/subscriptions.md)
- [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/orders.md)
- [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/plans.md)
- [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/invoices.md)
- [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/customers.md)
- [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/charges.md)
- [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/recipients.md)
- [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/tokens.md)
- [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/transactions.md)
- [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/transfers.md)
- [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/payables.md)
- [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/controllers/balance-operations.md)

SDK Infrastructure
------------------

[](#sdk-infrastructure)

### Configuration

[](#configuration)

- [ProxyConfigurationBuilder](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/proxy-configuration-builder.md)

### HTTP

[](#http)

- [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/http-request.md)
- [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/http-response.md)

### Utilities

[](#utilities)

- [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.17/doc/api-exception.md)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~40 days

Recently: every ~54 days

Total

31

Last Release

370d ago

PHP version history (3 changes)v6.4.0PHP &gt;=7.2

v6.5.0PHP &gt;=7.2 &lt;8.2

v6.7.1PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ed08d04ef542ee6ece0c4a22e9ea05599474bb311c838caf596be242d4b67a1?d=identicon)[jonatasmaxi](/maintainers/jonatasmaxi)

---

Top Contributors

[![magnomoreira](https://avatars.githubusercontent.com/u/42675117?v=4)](https://github.com/magnomoreira "magnomoreira (14 commits)")[![andreals](https://avatars.githubusercontent.com/u/37183181?v=4)](https://github.com/andreals "andreals (7 commits)")[![JefersonCAugusto](https://avatars.githubusercontent.com/u/50467118?v=4)](https://github.com/JefersonCAugusto "JefersonCAugusto (7 commits)")[![robsonjunior1994](https://avatars.githubusercontent.com/u/19863752?v=4)](https://github.com/robsonjunior1994 "robsonjunior1994 (3 commits)")[![grazielbarbosa](https://avatars.githubusercontent.com/u/263682810?v=4)](https://github.com/grazielbarbosa "grazielbarbosa (3 commits)")[![GusBedasi](https://avatars.githubusercontent.com/u/23214684?v=4)](https://github.com/GusBedasi "GusBedasi (1 commits)")[![lu-mich](https://avatars.githubusercontent.com/u/17272586?v=4)](https://github.com/lu-mich "lu-mich (1 commits)")[![devandremachado](https://avatars.githubusercontent.com/u/63324738?v=4)](https://github.com/devandremachado "devandremachado (1 commits)")

---

Tags

sec-alianca-paymentsschemessec-owner-brunosantossec-squad-orderssec-supertribo-paymentscoresec-tribo-processingapisdkPagarmeApiSDK

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/pagarme-pagarme-php-sdk/health.svg)

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

###  Alternatives

[square/square

Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.

793.4M21](/packages/square-square)

PHPackages © 2026

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