diff --git a/README.md b/README.md index 3d12593..650a10e 100644 --- a/README.md +++ b/README.md @@ -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"=>"your@email.test", @@ -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