PHP code example of chuckbe / dokapi-laravel-sdk

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

    

chuckbe / dokapi-laravel-sdk example snippets


return [
    'api_endpoint' => env('DOKAPI_API_ENDPOINT', 'https://peppol-api.dokapi-stg.io'),
    'oauth2_api_endpoint' => env('DOKAPI_OAUTH2_API_ENDPOINT', 'https://ixordocs.apiable.io/api/oauth2/token'),
    'client_id' => env('DOKAPI_CLIENT_ID'),
    'client_secret' => env('DOKAPI_CLIENT_SECRET'),
];

use Dokapi\Facades\Dokapi;

Dokapi::api()->lookup->find('0208:0553792301');

use Dokapi\Facades\Dokapi;

Dokapi::api()->lookup->find('0208:0553792301');

use Dokapi\Facades\Dokapi;

Dokapi::api()->participantRegistations->page();

use Dokapi\Facades\Dokapi;

Dokapi::api()->participantRegistations->page();

use Dokapi\Facades\Dokapi;

Dokapi::api()->participantRegistations->find('0208:0553792301');

use Dokapi\Facades\Dokapi;

Dokapi::api()->participantRegistrations->create([
    'participantIdentifier' => '0208:0553792301',
    'countryCode' => 'BE',
    'businessCardInfo' => [
        'name' => 'Company Name',
        'iso3166Alpha2CountryCode' => 'BE',
        'registrationDate' => now('UTC')->format('Y-m-d\TH:i:s.v\Z'),
    ]
]);

use Dokapi\Facades\Dokapi;

Dokapi::api()->participantRegistrations->businessCard([
    'participantIdentifier' => '0208:0553792301',
    'businessCardInfo' => [
        'name' => 'Company Name',
        'iso3166Alpha2CountryCode' => 'BE',
        'registrationDate' => now('UTC')->format('Y-m-d\TH:i:s.v\Z'),
    ]
]);

use Dokapi\Facades\Dokapi;

Dokapi::api()->participantRegistrations->registerDocumentType([
    'participantIdentifier' => [
        'scheme' => 'iso6523-actorid-upis', //optional
        'value' => '0208:0553792301'
    ],
    'documentTypeIdentifier' => [
        'scheme' => 'busdox-docid-qns',
        'value' => 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1'
    ],
    'processIdentifier' => [
        'scheme' => 'cenbii-procid-ubl',
        'value' => 'urn:fdc:peppol.eu:2017:poacc:billing:01:1.0'
    ]
]);

use Dokapi\Facades\Dokapi;

Dokapi::api()->participantRegistrations->deregisterDocumentType([
    'participantIdentifier' => [
        'scheme' => 'iso6523-actorid-upis', //optional
        'value' => '0208:0553792301'
    ],
    'documentTypeIdentifier' => [
        'scheme' => 'busdox-docid-qns',
        'value' => 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1'
    ]
]);

use Dokapi\Facades\Dokapi;

Dokapi::api()->incomingDocuments->confirm($documentUlid);

use Dokapi\Facades\Dokapi;

Dokapi::api()->incomingDocuments->generatePresignedUrl($documentUlid);

Dokapi::api()->outgoingDocuments->create([
    'sender' => [
        'scheme' => 'iso6523-actorid-upis', //optional
        'value' => '0208:0553792301'
    ],
    'receiver' => [
        'scheme' => 'iso6523-actorid-upis', //optional
        'value' => '0208:0123456789'
    ],
    'c1CountryCode' => 'BE',
    'documentTypeIdentifier' => [
        'scheme' => 'busdox-docid-qns',
        'value' => 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1'
    ],
    'processIdentifier' => [
        'scheme' => 'cenbii-procid-ubl',
        'value' => 'urn:fdc:peppol.eu:2017:poacc:billing:01:1.0'
    ],
    'externalReference' => $documentToBeSent->id, // this is our internal reference of the document to be sent
]);

Dokapi::api()->webhooks->all();

Dokapi::api()->webhooks->create([
    'url' => 'https://peppol.com/webhook',
    'events' => ['outgoing-peppol-documents.sent'],
]);

Dokapi::api()->webhooks->delete($ulid);

Dokapi::api()->webhooks->secret();

php artisan vendor:publish --tag="dokapi"
array $data
array $data
array $data
array $data
array $data
array $data