codephix / asaas-sdk

MIT License
60 stars 45 forks source link

Attempt to read property "id" on null #16

Closed tiagocaus closed 2 years ago

tiagocaus commented 2 years ago

Boa tarde, Estou tendo esse erro:

Warning: Attempt to read property "id" on null in

Meu codigo:

Uso a versão 2.0.2

    use CodePhix\Asaas\Asaas;

    $asaas = new Asaas('793274aaf2f3ab7a3968c1d61cabcef24c48b20733e36dea3653a10401706bdc', 'homologacao');

    $dadosCliente = [
        'name' => "Funalo de tal",
        'cpfCnpj' => "999999999"  //Uso CPF correto no teste
    ];

    $clientes = $asaas->Cliente()->create($dadosCliente);

    var_dump($clientes);

    $dadosCobranca = [
        'customer'          => $clientes->id,
        'billingType'       => "BOLETO",
        'dueDate'           => "2022-11-07", //vencimento
        'value'             => "102", //valor
        'description'       => "Teste C123452",
        'externalReference' => "C123452",
        'fine'              => ['value' => "1"],
        'interest'          => ['value' => "2"],
        'postalService'     => "false"

        // 'split' => [
        //     'walletId' => "",
        //     'fixedValue' => ""
        // ]
    ];

    $cobranca = $asaas->Cobranca()->create($dadosCobranca);

    var_dump($cobranca);
tiagocaus commented 2 years ago

DESCONSIDERE, ESTAVA TESTANDO EM LOCALHOST. QUANDO COLOQUEI ONLINE FUNCIONOU.