PHP code example of padmoney / sdk

1. Go to this page and download the library: Download padmoney/sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

padmoney / sdk example snippets


// Token e Token-Secret para autenticação da API
$autenticacao = [
    'token' => 'dG9rZW4tYXBpLVBhZG1vbmV5',
    'token-secret' => '123',
];

// Instancia a classe Invoice, onde será possível
// criar uma nova cobrança,
// cancelar uma cobrança pelo $id
// assim como buscar uma ou várioas cobranças
$invoice = new \Padmoney\Invoice\Invoice($autenticacao);

$autenticacao = [
    'token' => 'dG9rZW4tYXBpLVBhZG1vbmV5',
    'token-secret' => '123',
];
$invoice = new \Padmoney\Invoice\Invoice($autenticacao);


$params = [
    'amount' => 1.99,
    'due_date' => '2020-05-22',
    'description' =>  'Detalhe da cobrança',
];
$retorno = $invoice->create($params);

var_dump($retorno);


$autenticacao = [
    'token' => 'dG9rZW4tYXBpLVBhZG1vbmV5',
    'token-secret' => '123',
];

$invoice = new \Padmoney\Invoice\Invoice($autenticacao);


$query = [
    'payer_id' => '',
    'status' => 'overdue', 
];
$all = $invoice->list($query);

var_dump($all);