PHPackages                             gencomm/genpay-sdk-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. [Payment Processing](/categories/payments)
4. /
5. gencomm/genpay-sdk-php

ActiveLibraries[Payment Processing](/categories/payments)

gencomm/genpay-sdk-php
======================

Cliente em PHP para integração server-side com APIs GenPay

1.0.1(6y ago)2111MITPHPPHP &gt;=5.6CI failing

Since Apr 29Pushed 6y ago5 watchersCompare

[ Source](https://github.com/GenCommBrasil/genpay-sdk-php)[ Packagist](https://packagist.org/packages/gencomm/genpay-sdk-php)[ Docs](https://www.gencomm.com.br/developers/)[ RSS](/packages/gencomm-genpay-sdk-php/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (16)Used By (1)

[![](https://gist.githubusercontent.com/alexsantossilva/a1bfa0a6e9e6592176f860210a226dfe/raw/374ed1819de58169d05482c8188d6edc8687c2e6/genpay.png)](https://gist.githubusercontent.com/alexsantossilva/a1bfa0a6e9e6592176f860210a226dfe/raw/374ed1819de58169d05482c8188d6edc8687c2e6/genpay.png)

GenComm PHP SDK Client.
=======================

[](#gencomm-php-sdk-client)

>

[![wercker status](https://camo.githubusercontent.com/9ff5abff2610833384747e1e32dfdea2104f6191941ba6659d109a5047f5bc26/68747470733a2f2f6170702e776572636b65722e636f6d2f7374617475732f30343237653465363562623161643063613464326535656437353964313734332f6d2f6d6173746572 "wercker status")](https://app.wercker.com/project/byKey/0427e4e65bb1ad0ca4d2e5ed759d1743)

> O jeito mais simples e rápido de integrar o GenPay a sua aplicação PHP

**Instruções**

- [Instalação](#instala%C3%A7%C3%A3o)
- [Configurando a autenticação](#configurando-a-autentica%C3%A7%C3%A3o)
    - [Implementação do GenPay](#implementando-GenPay)
    - [Implementação do GenLog](#implementando-GenLog)
- [GenPay](#GenPay)
    - [Pedidos](#Pedidos)
        - [Criando Pedido no Boleto](#criando-pedido-no-boleto)
        - [Criando Pedido no Cartão de Crédito](#criando-pedido-no-cart%C3%A3o-de-cr%C3%A9dito)
        - [Cancelando um Pedido](#cancelando-um-pedido)
        - [Estorno Total de um Pedido](#estorno-total-de-um-pedido)
        - [Estorno Parcial de um Pedido](#estorno-parcial-de-um-pedido)
        - [Consultas](#consulta)
            - [Verificar Credenciais](#verificar-credenciais)
            - [Juros Comprador](#juros-comprador)
- [GenLog](#GenLog)
    - [Consultar Endereço](#consultar-endere%C3%A7o)
    - [Criar Cálculo](#criar-c%C3%A1lculo)
    - [Criar Lote](#criar-lote)
    - [Detalhes do Pedido](#detalhes-do-pedido)
- [Suporte](#suporte)

Dependências
------------

[](#dependências)

#### require

[](#require)

- PHP &gt;= 5.6

#### require-dev

[](#require-dev)

- phpunit/phpunit ~ 5.7.27

Instalação
----------

[](#instalação)

Execute em seu shell:

```
composer require gencomm/gencomm-sdk-php

```

Configurando a autenticação
---------------------------

[](#configurando-a-autenticação)

```
require 'vendor/autoload.php';

use GenComm\GenPay;
use GenComm\Enum\Environment;

$document = '77753821000123';
$apiKey = '546JK45NJ6K4N6456JKLN6464J5N';
$signature = '123IOU3OI2U1IIOU1OI3UIO23';
```

### Implementando GenPay

[](#implementando-genpay)

```
$genPay = new GenPay($document, $apiKey, $signature, Environment::SANDBOX);
```

### Implementando GenLog

[](#implementando-genlog)

```
$genLog = new GenLog($document, $apiKey, $signature, Environment::SANDBOX);
```

GenPay
======

[](#genpay)

Pedidos
-------

[](#pedidos)

### Criando pedido no boleto

[](#criando-pedido-no-boleto)

Neste exemplo será criado um pedido.

```
$order = $genPay
            ->order()
            ->setAmount(200.0)
            ->setCurrency("BRL")
            ->setFingerprint("fake-fingerprint")
            ->setWebhookUrl("http://intregation.test/sdk/")
            ->setReference("Pedido#01")
            ->setItemsAmount(200.0)
            ->setPayerIp("127.0.0.1")
            ->setTaxesAmount(0)
            ->setShippingAmount(0)
            ->setDiscountAmount(0)
            ->addItem(
                "Pedido#01",
                "NIKE TENIS",
                1,
                200.0,
                200.0
            );

$customer = $genPay
            ->customer()
            ->setName("Maria")
            ->setBirthDate("1985-04-16")
            ->setBusinessName("Maria")
            ->setDocument("12345678909")
            ->setEmail("teste@teste.com.br")
            ->setKind("personal")
            ->addAddress("shipping",
                "09840-500",
                "Rua Dos Morros",
                "1000",
                "ABC",
                "Maua",
                "SP",
                "Maria",
                "")
            ->addAddress("billing",
                "09840-500",
                "Rua Dos Morros",
                "1000",
                "ABC",
                "Maua",
                "SP",
                "Maria",
                "")
            ->addAPhones("55",
                "11",
                "999999998",
                "others",
                "shipping")
            ->addAPhones("55",
                "11",
                "999999998",
                "others",
                "billing");

$payment = $genPay
    ->asBillet()
    ->setAmount(200.0)
    ->setExpiresOn("3");

$response = $genPay->createOrder($order, $customer, $payment);
print_r($response);
```

### Criando pedido no cartão de crédito

[](#criando-pedido-no-cartão-de-crédito)

Neste exemplo será criado um pedido.

```
$order = $genPay
            ->order()
            ->setAmount(200.0)
            ->setCurrency("BRL")
            ->setFingerprint("fake-fingerprint")
            ->setWebhookUrl("http://intregation.test/sdk/")
            ->setReference("Pedido#01")
            ->setItemsAmount(200.0)
            ->setPayerIp("127.0.0.1")
            ->setTaxesAmount(0)
            ->setShippingAmount(0)
            ->setDiscountAmount(0)
            ->addItem(
                "Pedido#01",
                "NIKE TENIS",
                1,
                200.0,
                200.0
            );

$customer = $genPay
            ->customer()
            ->setName("Maria")
            ->setBirthDate("1985-04-16")
            ->setBusinessName("Maria")
            ->setDocument("12345678909")
            ->setEmail("teste@teste.com.br")
            ->setKind("personal")
            ->addAddress("shipping",
                "09840-500",
                "Rua Dos Morros",
                "1000",
                "ABC",
                "Maua",
                "SP",
                "Maria",
                "")
            ->addAddress("billing",
                "09840-500",
                "Rua Dos Morros",
                "1000",
                "ABC",
                "Maua",
                "SP",
                "Maria",
                "")
            ->addAPhones("55",
                "11",
                "999999998",
                "others",
                "shipping")
            ->addAPhones("55",
                "11",
                "999999998",
                "others",
                "billing");

$payment = $genPay
    ->asCreditCard()
    ->setToken("fake-credit-card-token")
    ->setReference("Pedido#01")
    ->setInstallmentsQuantity(10)
    ->setHolderName("MARIA DA SILVA")
    ->setHolderDocument("12345678909")
    ->setCvv("123")
    ->setBrand("VISA")
    ->setAmount(200.0)
    ->setInstallmentInterest(
        1,
        0,
        200,
        200,
        200
    );

$response = $genPay->createOrder($order, $customer, $payment);
print_r($response);
```

### Cancelando um Pedido

[](#cancelando-um-pedido)

Neste exemplo será cancelado um pedido.

```
$response = $genPay->cancel("fake-charge-uuid", Requester::MERCHANT, "Produto errado.");

print_r($response);
```

### Estorno Total de um Pedido

[](#estorno-total-de-um-pedido)

Neste exemplo será feito o estorno total de um pedido.

```
// Parametro Opcional
$bankAccount = [
            'document' => '11111111111',
            'bank_code' => '341',
            'bank_agency' => '1234',
            'bank_number' => '12345678-1',
        ];

$refund = $genPay->asRefund();

$refund->setReason("Comprou errado.")
    ->setRequester(Requester::MERCHANT)
    ->addPayment('fake-payment-id', 250, $bankAccount);

$response = $genPay->refund($refund, "fake-charge-uuid");

print_r($response);
```

### Estorno Parcial de um Pedido

[](#estorno-parcial-de-um-pedido)

Neste exemplo será feito o estorno parcial de um pedido.

```
// Parametro Opcional
$bankAccount = [
            'document' => '11111111111',
            'bank_code' => '341',
            'bank_agency' => '1234',
            'bank_number' => '12345678-1',
        ];

$refund = $genPay->asRefund();

$refund->setReason("Comprou errado.")
    ->setRequester(Requester::MERCHANT)
    ->addPayment('fake-payment-id', 50, $bankAccount);

$response = $genPay->refundPartial($refund, "fake-charge-uuid");

print_r($response);
```

Consulta
--------

[](#consulta)

### Juros Comprador

[](#juros-comprador)

```
$amount = 1000
$response = $genPay->checkout($amount);
print_r($response);
```

### Verificar Credenciais

[](#verificar-credenciais)

```
$response = $genPay->authorizationValidate();
print_r($response);
```

GenLog
======

[](#genlog)

### Consultar Endereço

[](#consultar-endereço)

```
$response = $genLog->autocomplete("01415001");

// Parametro Opcional - Autocomplete Online
$response = $genLog->autocomplete("01415001", true);
print_r($response);
```

### Criar Cálculo

[](#criar-cálculo)

```
$code = "Product-Code";
$name = "TENIS NIKE";
$quantity = 1;
$cost = 50;
$width = 1;
$weight = 1;
$lenght = 1;
$height = 1;

$calculation = $genLog->calculation();
$calculation->setDestinationZipcode("05001100")
    ->calculation->setPostageServiceCodes(array());
    ->calculation->addProducts(
        $code,
        $name,
        $quantity,
        $cost,
        $width,
        $weight,
        $lenght,
        $height
    );
$response = $genLog->createCalculation($calculation);
print_r($response);
```

### Criar Lote

[](#criar-lote)

```
$firstName = "Maria";
$lastName = "Da Silva";
$document = "12345678909";

$valueBaseICMS = 1.0;
$valueICMS = 0.50;
$valueBaseICMSST = 1.0;
$valueICMSST = 1;

$batch = $genLog->batch();
$batch->setCalculationCode("fake-calculation-code")
    ->setPostageServiceCode("fake-postage-service-code")
    ->setOrder("1666000041", "1666000041", 200.83)
    ->setCustomer($firstName, $lastName, $document)
    ->setInvoice(
        "series",
        "number",
        "key",
        "cfop",
        "2019-01-01",
        $valueBaseICMS,
        $valueICMS,
        $valueBaseICMSST,
        $valueICMSST
    )
    ->setDeliveryAddress(
        $firstName,
        $lastName,
        "Av. Francisco Matarazzo",
        "1500",
        "Torre New York 6 Andar",
        "Água Branca",
        "São Paulo",
        "SP",
        "05001100",
        "maria@teste.com.br",
        "1144556677",
        "1155667788"
    );
$response = $genLog->generateBatch($batch);

print_r($response);
```

### Detalhes do Pedido

[](#detalhes-do-pedido)

```
$response = $genLog->orderDetail("order-id");

print_r($response);
```

Suporte
-------

[](#suporte)

Dúvidas ou deseja implementar o serviço GenComm acesse [GenPay](https://www.gencomm.com.br/developers/)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 98.2% 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 ~20 days

Recently: every ~30 days

Total

12

Last Release

2355d ago

Major Versions

0.1.2 → 1.0.02019-11-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/020bbdae4a5c9fa8bf66d932a2b4bc979f21a640a3c08322ec6913824cb3f0ac?d=identicon)[gencommbr](/maintainers/gencommbr)

---

Top Contributors

[![alexsantossilva](https://avatars.githubusercontent.com/u/5922108?v=4)](https://github.com/alexsantossilva "alexsantossilva (55 commits)")[![joenascimento](https://avatars.githubusercontent.com/u/45638605?v=4)](https://github.com/joenascimento "joenascimento (1 commits)")

---

Tags

librariescheckoutmarketplaceintermediarygencommgenpay

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[league/omnipay

Omnipay payment processing library

6.1k9.7M166](/packages/league-omnipay)[liqpay/liqpay

SDK for Liqpay

111678.8k9](/packages/liqpay-liqpay)[flux-se/sylius-payum-stripe-plugin

Payum Stripe gateways plugin for Sylius.

61342.2k](/packages/flux-se-sylius-payum-stripe-plugin)[sumup/sumup-ecom-php-sdk

SumUp PHP SDK

51277.1k1](/packages/sumup-sumup-ecom-php-sdk)[payum/stripe

The Payum extension. It provides Stripe payment integration.

22573.1k3](/packages/payum-stripe)[phpjuice/paypal-checkout-sdk

PayPal's PHP SDK for Checkout REST APIs

5858.1k](/packages/phpjuice-paypal-checkout-sdk)

PHPackages © 2026

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