Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 140 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,157 @@ composer require phpay-io/phpay
```php
require 'vendor/autoload.php';

use PHPay\Gateways\Asaas\AsaasGateway;
use PHPay\PHPay;

$client = [
'name' => 'João da Silva',
'cpf_cnpj' => '99999999999' // valid
];
$phpay = PHPay::getInstance(new AsaasGateway(TOKEN_ASAAS_SANDBOX))
->getGateway();
```

## Customer

$invoice = [
'value' => 100.00,
'dueDate' => '2024-12-01',
'description' => 'Pagamento de teste',
];
```php
$customerCreated = $phpay
->customer($customer)
->create();

$phpay
->customer()
->getAll();

$phpay
->customer()
->setFilter([
'cpfCnpj' => $customerCreated['cpfCnpj'],
])
->getAll();

$phpay
->customer()
->find($customerCreated['id']);

$phpay
->customer([
'name' => 'Mário Lucas Updated',
])
->update($customerCreated['id']);

$phpay
->customer()
->destroy($customerCreated['id']);

$phpay
->customer()
->restore($customerCreated['id']);

$phpay
->customer()
->getNotifications($customerCreated['id']);
```

$response = PHPay::asaas('SUA_CHAVE_API')
->client($client)
->invoice($invoice)
->qrCodePix();
## 🤑 Charges

print_r($response);
```php
$customerCreated = $phpay
->customer($customer)
->create();

$phpay
->charge($charge)
->setCustomer($customerCreated['id'])
->create();

$phpay
->charge()
->find($chargeCreated['id']);

$phpay
->charge()
->getAll();

$phpay
->charge()
->update($chargeCreated['id'], [
'description' => 'Teste de fatura atualizado',
]);

$phpay
->charge()
->destroy($chargeCreated['id']);

$phpay
->charge()
->restore($chargeCreated['id']);

$phpay
->charge()
->getStatus($chargeCreated['id']);

$phpay
->charge()
->getDigitableLine($chargeCreated['id']);

$phpay
->charge()
->getQrCodePix($chargeCreated['id']);

$phpay
->charge()
->confirmReceipt($chargeCreated['id'], [
'paymentDate' => date('Y-m-d'),
'value' => 100.00,
'notifyCustomer' => true,
]);

$phpay
->charge()
->undoConfirmReceipt($chargeCreated['id']);
```

## WebHooks

```php
$webhook = $phpay
->webhook($webhook)
->create();

$phpay
->webhook()
->getAll();

$phpay
->webhook()
->find($webhook['id']);

$phpay
->webhook()
->update($webhook['id'], [
'name' => 'Webhook de Teste Atualizado',
'url' => 'https://mariolucas.me/webhook/atualizado',
]);

$phpay
->webhook()
->destroy($webhook['id']);
```

## 📝 Roadmap

- Integração com Asaas.

- Cobranças ✅
- Clientes ✅
- Webhook ✅
- Pix 🕥

- Integração com Efí.
- Lançamento v1.0.0

- Cobranças 🕥
- Clientes 🕥
- Webhook 🕥
- Pix 🕥

- Lançamento v1.0.0 🚀

## 🌟 Contribuindo

Expand Down
10 changes: 5 additions & 5 deletions examples/asaas/webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
*
* @return array
*/
$webhooks = $phpay
$phpay
->webhook()
->getAll();

Expand All @@ -61,9 +61,9 @@
*
* @return array
*/
$webhook = $phpay
$phpay
->webhook()
->find('84c3c34b-9d23-44a3-95b2-d232c3f06dba');
->find($webhook['id']);

/**
* update a webhook
Expand All @@ -73,7 +73,7 @@
*/
$webhookUpdated = $phpay
->webhook()
->update('84c3c34b-9d23-44a3-95b2-d232c3f06dba', [
->update($webhook['id'], [
'name' => 'Webhook de Teste Atualizado',
'url' => 'https://sixtec.com.br/webhook/atualizado',
]);
Expand All @@ -85,4 +85,4 @@
*/
$webhookDeleted = $phpay
->webhook()
->destroy('84c3c34b-9d23-44a3-95b2-d232c3f06dba');
->destroy($webhook['id']);