Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adicionado exemplo de retorno no README #35

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ O autoload do composer irá cuidar do resto.

## Exemplo de Uso

A API Key pode ser obtida no [Painel da Iugu](https://app.iugu.com/account), menu Administração > Configurações da Conta;

```php
Iugu::setApiKey("c73d49f9-6490-46ee-ba36-dcf69f6334fd"); // Ache sua chave API no Painel
Iugu::setApiKey("*******-****-****-****-********"); // Ache sua chave API no Painel

Iugu_Charge::create(
$chargeReturn = Iugu_Charge::create(
[
"token"=> "TOKEN QUE VEIO DO IUGU.JS OU CRIADO VIA BIBLIOTECA",
"email"=>"[email protected]",
Expand All @@ -47,6 +49,19 @@ Iugu_Charge::create(
]
]
);

if( isset($chargeReturn->success) && $chargeReturn->success )
{
//APROVADO
$invoceId = $chargeReturn->invoice_id;
echo 'Pagamento Aprovado';
}
else
{
//REPROVADO
$errorText = $chargeReturn->errors;
echo 'Pagamento Recusado';
}
```

## Documentação
Expand Down