How to work with billets in the Pay PHP API.me

Asked

Viewed 390 times

1

My difficulty is in making the Parsing of data returned in the boleto generation. My goal is to take this data and make some transformations, such as formatting the date/time and some other changes like boleto status translation, etc.

My methods of generating billet and query:

/**
 * Gera um boleto para pagamento
 * 
 * @param int       $valor
 * @param array     $dados
 * @param string    $urlCallBack
 * @param array     $metadados
 * @return          void
 */
public function gerar($valor, $dados, $urlCallBack = null, $metadados = null)
{
    $customer = new Customer($dados);

    return $this->pagarMe->transaction()->boletoTransaction(
                $valor,
                $customer,
                $urlCallBack,
                $metadados
            );
}

/**
 * Retorna os dados do boleto
 * 
 * @return \PagarMe\Sdk\Transaction\BoletoTransaction
 */
public function consultar(int $transacaoId)
{
    return $this->dicionario($this->pagarMe->transaction()->get($transacaoId));
}

1 answer

0

<?php    
    $res = TuaClasse->gerar(1000, \PagarMe\Sdk\Customer\Customer $customer, $urlCallBack = null, $metadados = null)

    $id_da_transacao = $res->getId();
?>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.