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

ArchivedLibrary

azpay/sdk-php-7
===============

SDK PHP AZPAY

v1.8.0(4y ago)24.7k↓100%3MITPHPPHP &gt;=7.0

Since Aug 29Pushed 4y ago1 watchersCompare

[ Source](https://github.com/azpay/SDK-PHP-7)[ Packagist](https://packagist.org/packages/azpay/sdk-php-7)[ RSS](/packages/azpay-sdk-php-7/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (13)Used By (0)

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

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

Modalidades de pagamentos:

- PIX
- 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, Itaú Shopline e AZPAY)
- 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
- Split de pagamentos (AZPAY)

---

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

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

```
 namespace Gateway\API;

    include_once "autoload.php";

    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("Bruno paz")
            ->Card()
                ->setBrand(Brand::VISA)
                ->setCardHolder("Bruno paz")
                ->setCardNumber("2223000148400010")
                ->setCardSecurityCode("123")
                ->setCardExpirationDate("202001");

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

        // SET FRAUD DATA OBJECT
        $transaction->FraudData()
            ->setName("Bruno Paz")
            ->setDocument("30683882828")
            ->setEmail("brunopaz@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("Bruno")
    ->setCpf("30212212212")
    ->setEmail("bruno@brunopaz.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("Bruno paz")
    ->Card()
            ->setBrand(Brand::VISA)
            ->setCardHolder("Bruno paz")
            ->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);
```

### PIX

[](#pix)

```
    $transaction->Payment()
            ->setAcquirer(Acquirers::AZPAY)
            ->setCurrency(Currency::BRAZIL_BRAZILIAN_REAL_BRL)
            ->setCountry("BRA")
            ->setExpire("2021-09-17T23:00:00")
            ->setFine(1.12)
            ->setInterest(1.12)
            ->setInstructions("PIX: Anuidade do serviço")
            ->Split($split); //opcional

     $response = $gateway->Pix($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::GRANITOAZPAYAcquirers::AZPAYZOOPAcquirers::ZOOPPAGSEGURO V4.0Acquirers::PAGSEGUROV4### 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

32

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 94.3% 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 ~68 days

Recently: every ~163 days

Total

12

Last Release

1648d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98f44987da36152da47230559d56edc4c601bea48fb17bce1977a657b389bda0?d=identicon)[brunopaz](/maintainers/brunopaz)

---

Top Contributors

[![brunopazz](https://avatars.githubusercontent.com/u/982034?v=4)](https://github.com/brunopazz "brunopazz (33 commits)")[![azpay-dev](https://avatars.githubusercontent.com/u/54682452?v=4)](https://github.com/azpay-dev "azpay-dev (1 commits)")[![luizbills](https://avatars.githubusercontent.com/u/1798830?v=4)](https://github.com/luizbills "luizbills (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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