PHPackages                             kesterpay/gateway-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. kesterpay/gateway-sdk

ActiveLibrary

kesterpay/gateway-sdk
=====================

SDK PHP GATEWAY

1.0.14(5y ago)03561MITPHPPHP &gt;=7.0

Since Oct 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/kesterpay/gateway-sdk)[ Packagist](https://packagist.org/packages/kesterpay/gateway-sdk)[ RSS](/packages/kesterpay-gateway-sdk/feed)WikiDiscussions master Synced today

READMEChangelog (2)DependenciesVersions (16)Used By (1)

Gateway de Pagamento - SDK PHP
==============================

[](#gateway-de-pagamento---sdk-php)

Modalidades de pagamentos:

- Cartão de crédito
- Cartão de débito
- Paypal Plus
- Paypal Express Chekout
- Pagseguro V4.0
- Boleto bancário (Bradesco Shop Fácil e Itaú Shopline)
- Transferência eletronica bancária (Itaú Shopline)

Recursos disponíveis

- Parcelamento de pagamentos
- Pagamentos agendados ( recorrências )
- Análise de antifraude
- Tokenização de cartões

---

Cartão de crédito (Exemplo)
---------------------------

[](#cartão-de-crédito-exemplo)

```
 namespace Gateway\API;

    include_once "autoload.php";

    use Exception as Exception;

    try {
        $credential = new Credential("{{INSERT_MERCHANT_ID}}", "{{INSERT_TOKEN}}", Environment::SANDBOX);
        $gateway = new Gateway($credential);

        ### CREATE A NEW TRANSACTION
        $transaction = new Transaction();

        // Set ORDER
        $transaction->Order()
            ->setReference("ss")
            ->setTotalAmount(1000);

        // Set PAYMENT
        $transaction->Payment()
            ->setAcquirer(Acquirers::CIELO_V3)
            ->setMethod(Methods::CREDIT_CARD_INTEREST_BY_ISSUER)
            ->setCurrency(Currency::BRAZIL_BRAZILIAN_REAL_BRL)
            ->setCountry("BRA")
            ->setNumberOfPayments(2)
            ->setSoftDescriptor("John Doe")
            ->Card()
                ->setBrand(Brand::VISA)
                ->setCardHolder("John Doe")
                ->setCardNumber("2223000148400010")
                ->setCardSecurityCode("123")
                ->setCardExpirationDate("202001");

        // SET CUSTOMER
        $transaction->Customer()
            ->setCustomerIdentity("999999999")
            ->setName("John Doe")
            ->setCpf("30212212212")
            ->setEmail("JohnDoe@test.com");

        // SET FRAUD DATA OBJECT
        $transaction->FraudData()
            ->setName("John Doe")
            ->setDocument("30683882828")
            ->setEmail("JohnDoe@g.com")
            ->setAddress("Rua test")
            ->setAddress2("Apartamento 23")
            ->setAddressNumber("300")
            ->setPostalCode("08742350")
            ->setCity("São Paulo")
            ->setState("SP")
            ->setCountry("BRASIL")
            ->setPhonePrefix("11")
            ->setPhoneNumber("99999-9999")
            ->setDevice("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36")
            ->setCostumerIP("192.168.0.1")
            ->setItems([
                ["productName" => "Iphone X", "quantity" => 1, "price" => "20.00"],
                ["productName" => "Iphone XL", "quantity" => 12, "price" => "1220.00"]
            ]);

        // Set URL RETURN
        $transaction->setUrlReturn("http://127.0.0.1:8989/return.php");

        // PROCESS - ACTION
        #$response = $gateway->sale($transaction);
        $response = $gateway->authorize($transaction);

        // REDIRECT IF NECESSARY (Debit uses)
        if ($response->isRedirect()) {
            $response->redirect();
        }

        // RESULTED
        if ($response->isAuthorized()) { // Action Authorized
            print "RESULTED: " . $response->getStatus();
        } else { // Action Unauthorized
            print "RESULTED:" . $response->getStatus();
        }

        // CAPTURE
        if ($response->canCapture()) {
            $response = $gateway->Capture($response->getTransactionID());
            print "CAPTURED: " . $response->getStatus();
        }
        // CANCELL
        if ($response->canCancel()) {
            $response = $gateway->Cancel($response->getTransactionID());
            print "CANCELED: " . $response->getStatus();
        }

        // REPORT
        $response = $gateway->Report($response->getTransactionID());
        print "REPORTING: " . $response->getStatus();

    } catch (Exception $e) {
        print_r($e->getMessage());
    }
```

---

Credencias de acesso
--------------------

[](#credencias-de-acesso)

```
$credential = new Credential("{MERCHANTID}", "{MERCHANTKEY}", Environment::SANDBOX);
```

Autenticação
------------

[](#autenticação)

```
$gateway = new Gateway($credential);
```

### Ambientes disponíveis

[](#ambientes-disponíveis)

NomeDescriçãoConstante de usoTESTESAmbiente de testesEnvironment::SANDBOXPRODUÇÃOAmbiente de produçãoEnvironment::PRODUCTION### Criando um nova transação de pagamento

[](#criando-um-nova-transação-de-pagamento)

```
$transaction = new Transaction();
```

### Informando um pedido

[](#informando-um-pedido)

- setReference é usado como referência do pedido
- setTotalAmount deve ser em centavos

```
// Set ORDER
$transaction->Order()
            ->setReference("Pedido123")
            ->setTotalAmount(1000);
```

### Informando os dados do comprador

[](#informando-os-dados-do-comprador)

- setCustomerIdentity é usado como referência do comprador (Deve ser único)

```
$transaction->Customer()
    ->setCustomerIdentity("999999999")
    ->setName("JohnDoe")
    ->setCpf("30212212212")
    ->setEmail("John@doe.com");
```

### Informando a forma de pagamento

[](#informando-a-forma-de-pagamento)

- setAcquirer define qual a operadora a ser utilizado, verifique tabela abaixo
- setMethod define qual o método de pagamento a ser processado, verifique tabela abaixo
- setNumberOfPayments define o parcelamento ( usado para Cartão de Crédito)
- setSoftDescriptor texto a ser exibido na fatura do cartão do comprador

```
// Set PAYMENT
$transaction->Payment()
    ->setAcquirer(Acquirers::CIELO_V3)
    ->setMethod(Methods::CREDIT_CARD_INTEREST_BY_ISSUER)
    ->setCurrency(Currency::BRAZIL_BRAZILIAN_REAL_BRL)
    ->setCountry("BRA")
    ->setNumberOfPayments(2)
    ->setSoftDescriptor("John Doe")
    ->Card()
            ->setBrand(Brand::VISA)
            ->setCardHolder("John Doe")
            ->setCardNumber("2223000148400010")
            ->setCardSecurityCode("123")
            ->setCardExpirationDate("202001");
```

### Informando a URL de retorno

[](#informando-a-url-de-retorno)

A URL de retorno é utlizada para receber um POST e redirecionar o usuário a após a conclusão da operaçñao de pagamento

```
// Set URL RETURN
$transaction->setUrlReturn("http://127.0.0.1:8989/return.php");
```

Tipos de operações financeiras
------------------------------

[](#tipos-de-operações-financeiras)

### Autorização (Pre-auth)

[](#autorização-pre-auth)

```
$response = $gateway->Authorize($transaction);
```

### Venda Direta (auth)

[](#venda-direta-auth)

```
$response = $gateway->Sale($transaction);
```

### Captura (Capture)

[](#captura-capture)

```
$response = $gateway->Capture("{TransactionID}");
```

### Cancelamento (Cancel | Void)

[](#cancelamento-cancel--void)

```
$response = $gateway->sale("{TransactionID}");
```

### Tranferência Bancária (Transfer)

[](#tranferência-bancária-transfer)

```
$response = $gateway->OnlineTransfer($transaction);
```

### Boleto Bancário (Payment Bank Slip)

[](#boleto-bancário-payment-bank-slip)

```
$response = $gateway->Boleto($transaction);
```

### Paypal

[](#paypal)

```
$response = $gateway->Paypal($transaction);
```

### Pagamento agendado ( Recorrência)

[](#pagamento-agendado--recorrência)

```
$response = $gateway->Rebill($transaction);
```

### Códigos das operadoras

[](#códigos-das-operadoras)

OperadoraConstanteCIELO BUY PAGE LOJAAcquirers::CIELO\_BUY\_PAGE\_LOJACIELO BUY PAGE CIELOAcquirers::CIELO\_BUY\_PAGE\_CIELOCIELO V3.0 (recente)Acquirers::CIELO\_V3REDE KOMERCI WEBSERVICEAcquirers::REDE\_KOMERCI\_WEBSERVICEREDE: E-REDE (recente)Acquirers::REDE\_E\_REDEPAGSEGUROAcquirers::PAGSEGUROPAYPAL: EXPRESS CHECKOUTAcquirers::PAYPAL\_EXPRESS\_CHECKOUTPAYPAL: PLUSAcquirers::PAYPAL\_PLUSPAGSEGURO: CHECKOUT EXPRESSOAcquirers::PAGSEGURO\_CHECKOUT\_EXPRESSOBRADESCO (deprecado)Acquirers::BRADESCOBRADESCO: SHOPFACIL (recente)Acquirers::BRADESCO\_SHOPFACILITAU: SHOPLINEAcquirers::ITAU\_SHOPLINESTONEAcquirers::STONEELAVONAcquirers::ELAVONGETNET E-commerceAcquirers::GETNETGETNET V1.0 (recente)Acquirers::GETNET\_V1GLOBAL PAYMENTAcquirers::GLOBAL\_PAYMENTFIRST DATA BINAcquirers::FIRSTDATAADIQAcquirers::ADIQWORLDPAYAcquirers::WORLDPAYGRANITOAcquirers::GRANITOKESTERPAYAcquirers::KESTERPAYZOOPAcquirers::ZOOPPAGSEGURO V4.0Acquirers::PAGSEGUROV4LUCREEAcquirers::LUCREE### Códigos das bandeiras de cartões

[](#códigos-das-bandeiras-de-cartões)

NomeConstanteVISABrand::VISAMASTERCARDBrand::MASTERCARDDINERSBrand::DINERSDISCOVERBrand::DISCOVERELOBrand::ELOAMEXBrand::AMEXAURABrand::AURAJCBBrand::JCBHYPERCARDBrand::HYPERCARDSOROCREDBrand::SOROCREDCABALBrand::CABALMAESTROBrand::MAESTROHIPERBrand::HIPERCREDSYSTEMBrand::CREDSYSTEMBANESCARDBrand::BANESCARDCREDZBrand::CREDZ### Métodos de pagamentos

[](#métodos-de-pagamentos)

Método de pagamentoConstanteA Vista (Crédito)Methods::CREDIT\_CARD\_NO\_INTERESTParcelamento loja (Crédito)Methods::CREDIT\_CARD\_INTEREST\_BY\_MERCHANTParcelamento Emissor (Crédito)Methods::CREDIT\_CARD\_INTEREST\_BY\_ISSUERCartão de crédito recorrente apenas CIELOMethods::CIELO\_SUBSCRIPTION\_INITIALCartão de crédito recorrente apenas PAGSEGURO v4.0 (primeira cobrança)Methods::PAGSEGUROV4\_SUBSCRIPTION\_INITIALCartão de crédito recorrente apenas PAGSEGURO v4.0 (demais cobranças)Methods::PAGSEGUROV4\_SUBSCRIPTION\_SUBSEQUENT---

Outros exemplos de modalidades de pagamentos
--------------------------------------------

[](#outros-exemplos-de-modalidades-de-pagamentos)

Modalidades de pagamentosCódigo-fonteBoleto Bancário[source / example](examples/Boleto.php)Cartão de Crédito[source / example](examples/Credit.php)Cartão de Débito[source / example](examples/Debit.php)Paypal[source / example](examples/Paypal.php)Recorrência[source / example](examples/Rebill.php)Transfência eletrônica[source / example](examples/OnlineTransfer.php)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.5% 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 ~12 days

Total

15

Last Release

1881d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/268ae7f923874ff6e760da101519d8149a2b43aabd295e0a67e6c4ceba256ef2?d=identicon)[kesterpay](/maintainers/kesterpay)

---

Top Contributors

[![brunopazz](https://avatars.githubusercontent.com/u/982034?v=4)](https://github.com/brunopazz "brunopazz (13 commits)")[![kesterpay](https://avatars.githubusercontent.com/u/70146688?v=4)](https://github.com/kesterpay "kesterpay (4 commits)")

### Embed Badge

![Health badge](/badges/kesterpay-gateway-sdk/health.svg)

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

PHPackages © 2026

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