PHP code example of omnibill / afnor

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

    

omnibill / afnor example snippets


use Omnibill\Afnor\AfnorGatewayFactory;

$platform = (new AfnorGatewayFactory($httpClient))->create([
    'flow_url' => 'https://api.flow.example-pa.fr/flow-service',
    'directory_url' => 'https://api.directory.example-pa.fr/directory-service',
    'token_url' => 'https://auth.example-pa.fr/auth-service/acme/token',
    'client_id' => $clientId,
    'client_secret' => $clientSecret,
]);

$flow = $platform->submit($invoice);              // POST /v1/flows: PENDING
$platform->fetchStatus($flow)->status;            // Ok: DEPOSITED (200); Error: REJECTED (213), ->errors
$inbox = $platform->receive($cursor);             // suppliers' invoices; statuses (CDAR) read: PAID, REFUSED...
$platform->lookup('702042755');                   // the directory's lines for a SIREN or a SIRET
$platform->setStatus($paid, $flow, 'status:42:1'); // the application's CDAR as a flow, with its trackingId
$platform->findFlow('status:42:1');               // after an OutcomeUnknownException: that flow, or null