PHP code example of hafael / fitbank-php-sdk

1. Go to this page and download the library: Download hafael/fitbank-php-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/ */

    

hafael / fitbank-php-sdk example snippets


  
    nkClient = new Hafael\Fitbank\Client(
        'API_KEY', 
        'API_SECRET', 
        'PARTNER_ID', 
        'BUSINESS_UNIT_ID',
        'MKTPLACE_ID',
        'TAX_NUMBER', //Account Owner
        'BASE_URL', //Sandbox as default
    );

    //Get created accounts
    $response = $fitbankClient->account()->getAccountList();
    var_dump($response->json());

  

  
    fael\Fitbank\Client;
    use Hafael\Fitbank\Models\Account;
    use Hafael\Fitbank\Models\Address;
    use Hafael\Fitbank\Models\Document;
    use Hafael\Fitbank\Models\Person;

    ...

    //Create new KYC Account
    
    $holder = new Person([
        'personRoleType' => Person::ROLE_TYPE_HOLDER,
        'taxNumber' => '88494940090',
        'identityDocument' => '269435310',
        'personName' => 'Rafael de Marquez Santos',
        'nickname' => 'Rafael',
        'mail' => '[email protected]',
        'phoneNumber' => '219729345534',
        'checkPendingTransfers' => false,
        'publicExposedPerson' => false,
        'birthDate' => '1996/05/20',
        'motherFullName' => 'Daniela Cruz de Marquez',
        'fatherFullName' => 'João Francisco Santos',
        'nationality' => 'Brasileiro',
        'birthCity' => 'Niterói',
        'birthState' => 'Rio de Janeiro',
        'gender' => Person::GENDER_MALE,
        'maritalStatus' => Person::MARITAL_SINGLE,
        'occupation' => 'Empresário',
    ]);

    $documents = [
        Document::fromBase64('dGVzdGU=', Document::FORMAT_JPG)
                ->documentType(Document::TYPE_CNH)
                ->expirationDate('2023/04/15'),
        Document::fromBase64('dGVzdGU=', Document::FORMAT_JPG)
                ->documentType(Document::TYPE_PROOF_ADDRESS),
    ];

    $addresses = [
        new Address([
            'addressType' => Address::RESIDENTIAL,
            'addressLine' => 'Av. Constantino de Barros Filho',
            'addressLine2' => '61',
            'complement' => 'APT 704',
            'zipCode' => '24360-022',
            'neighborhood' => 'São Francisco',
            'cityName' => 'Niterói',
            'state' => 'RJ',
            'country' => 'Brasil',
        ])
    ];

    $account = new Account([
        'holder' => $holder,
        'documents' => $documents,
        'addresses' => $addresses,
    ]);

    $response = $fitbankClient->account->newAccount($account);
    var_dump($response->json());