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

ActiveLibrary[Payment Processing](/categories/payments)

kseven/swiftpay-sdk
===================

SDK PHP para SwiftPay

00HTMLCI passing

Since Sep 20Pushed 7mo agoCompare

[ Source](https://github.com/ksevendev/SwifyPaySDK)[ Packagist](https://packagist.org/packages/kseven/swiftpay-sdk)[ RSS](/packages/kseven-swiftpay-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

SwiftPay SDK &amp; API PIX
==========================

[](#swiftpay-sdk--api-pix)

SDK PHP para integração com a API PIX da SwiftPay, incluindo métodos para depósitos, saques e processamento seguro de webhooks.

---

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

[](#instalação)

```
composer require kseven/swiftpay-sdk
```

Certifique-se de ter PHP &gt;= 8.0 e Guzzle 7.

Configuração
------------

[](#configuração)

Crie um arquivo `.env` na raiz do projeto:

```
SWIFTPAY_URI=https://swiftpay.com.br/api/
SWIFTPAY_TOKEN=seu_token
SWIFTPAY_SECRET=seu_secret
WEBHOOK_SECRET=seu_webhook_secret
LOG_PATH=./logs/swiftpay.log

```

Crie a pasta `logs` com permissão de escrita.

Estrutura de arquivos
---------------------

[](#estrutura-de-arquivos)

```
swiftpay-sdk/
├─ public/
│  ├─ webhook.php
│  ├─ deposit.php
│  └─ withdraw.php
├─ src/
│  ├─ SwiftPayClient.php
│  ├─ WebhookHandler.php
│  └─ Exceptions/SwiftPayException.php
├─ logs/
├─ .env
└─ composer.json

```

Uso do SDK
----------

[](#uso-do-sdk)

### Depósito (PIX IN)

[](#depósito-pix-in)

```
$client = new SwiftPayClient(
    $_ENV['SWIFTPAY_TOKEN'],
    $_ENV['SWIFTPAY_SECRET'],
    $_ENV['SWIFTPAY_URI'],
    $_ENV['LOG_PATH']
);

$response = $client->deposit([
    'amount' => 100.00,
    'debtor_name' => 'Cliente Teste',
    'email' => 'cliente@email.com',
    'debtor_document_number' => '12345678900',
    'phone' => '5511999999999',
    'method_pay' => 'pix',
    'postback' => 'https://meusite.com/webhook'
]);

print_r($response);
```

### Saque (PIX OUT)

[](#saque-pix-out)

```
$response = $client->withdraw([
    'amount' => 50.00,
    'pixKey' => '12345678900',
    'pixKeyType' => 'cpf',
    'baasPostbackUrl' => 'https://meusite.com/webhook'
]);

print_r($response);
```

### Webhook

[](#webhook)

Exemplo de endpoint em PHP usando `WebhookHandler`:

```
$request = Request::createFromGlobals();
$handler = new WebhookHandler($_ENV['WEBHOOK_SECRET']);
$data = $handler->handle($request);
file_put_contents($_ENV['LOG_PATH'], json_encode($data), FILE_APPEND);
http_response_code(200);
echo json_encode(['success' => true]);
```

API Direta — Referência
-----------------------

[](#api-direta--referência)

### Depósito (PIX IN)

[](#depósito-pix-in-1)

- **POST** `https://swiftpay.com.br/api/wallet/deposit/payment`
- **Headers:** `Content-Type: application/json`, `Accept: application/json`
- **Body:**

```
{
  "token": "seu_token",
  "secret": "seu_secret",
  "postback": "rota_callback",
  "amount": 100.00,
  "debtor_name": "Nome",
  "email": "email@dominio.com",
  "debtor_document_number": "CPF",
  "phone": "Telefone",
  "method_pay": "pix"
}
```

- **Response:**

```
{
  "idTransaction": "TX123",
  "qrcode": "código",
  "qr_code_image_url": "url"
}
```

### Saque (PIX OUT)

[](#saque-pix-out-1)

- **POST** `https://swiftpay.com.br/api/pixout`
- **Headers:** `Content-Type: application/json`, `Accept: application/json`
- **Body:**

```
{
  "token": "seu_token",
  "secret": "seu_secret",
  "baasPostbackUrl": "url_callback",
  "amount": 100.00,
  "pixKey": "chave_pix",
  "pixKeyType": "cpf"
}
```

- **Response:**

```
{
  "id": "uuid",
  "amount": 100,
  "pixKey": "chave",
  "pixKeyType": "cpf",
  "withdrawStatusId": "PendingProcessing"
}
```

### Webhook

[](#webhook-1)

```
{
  "nome": "Cliente Teste",
  "cpf": "12345678900",
  "email": "cliente@email.com",
  "status": "pago"
}
```

Segurança
---------

[](#segurança)

- Nunca coloque tokens diretamente no código; use `.env`
- Valide HMAC dos webhooks
- Use HTTPS em todas as requisições
- Restrinja IPs quando possível
- Mantenha logs ativos para auditoria

---

*Gerado em 19/09/2025 14:05 (America/Sao\_Paulo)*

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance44

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/370be5a4a8a82b20f3c9a77adc97316236c3473f87419f3595b5080bf5252bf0?d=identicon)[kseven](/maintainers/kseven)

---

Top Contributors

[![ksevendev](https://avatars.githubusercontent.com/u/32661918?v=4)](https://github.com/ksevendev "ksevendev (6 commits)")

### Embed Badge

![Health badge](/badges/kseven-swiftpay-sdk/health.svg)

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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