1. Go to this page and download the library: Download stackin-io/stackin-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/ */
stackin-io / stackin-php-sdk example snippets
// More than one unit — the note's line is 2 x 120.00 = 240.00
new Product(description: 'Teclado', quantity: 2.0, unitPrice: 120.00, unit: 'UN');
// Legacy: amount alone still means the line's gross total
new Product(description: 'Servico', amount: 150.00, quantity: 3.0);
use Stackin\Address;
use Stackin\Br\Product;
use Stackin\DocumentType;
use Stackin\Invoice;
$invoice = new Invoice(apiKey: 'COMPANY_API_KEY');
$result = $invoice->issue(
DocumentType::NFE,
'Buyer Company Ltd',
'11222333000181',
[
new Product(
description: 'Rosa Holambra Vermelha',
unitPrice: 112.44,
ncm: '06031100',
cfop: '5102',
),
],
new Address(
street: 'Rua das Palmeiras',
number: '100',
neighborhood: 'Centro',
city: 'Florianopolis',
state: 'SC',
zipCode: '88010000',
cityCode: '4205407',
),
);
$status = $invoice->consult('ACCESS_KEY...', DocumentType::NFSE);
$invoice->cancel('ACCESS_KEY...', DocumentType::NFSE, 'Typo');
// The authorizer's PDF, as raw bytes. NFS-e only; the XML stays the
// legally valid document, and a 502 here means the authorizer is down.
file_put_contents(
'nota.pdf',
$invoice->pdf('ACCESS_KEY...', DocumentType::NFSE),
);
$result = $invoice->invalidate(
'1',
10,
12,
'Numeracao reservada e nao utilizada por falha no ERP',
);
use Stackin\\Manifestation;
$page = $client->received(limit: 20);
echo $page['total'];
$client->manifest($accessKey, Manifestation::CIENCIA);
$client->manifest(
$accessKey,
Manifestation::OPERACAO_NAO_REALIZADA,
'Mercadoria nunca chegou ao endereco',
);
use Stackin\FiscalReference;
use Stackin\Taxpayer;
$ref = new FiscalReference(apiKey: '...'); // country 'BR' by default
$ref->ncm->get('84716052'); // one code
$ref->ncm->search('teclado', limit: 5); // a page of matches
$ref->cfop->get('5102');
$ref->kinds(); // what this country has
$ref->kind('ibs_cbs_class')->get('000001'); // any kind, named or not
$ref->search('teclado'); // every kind at once
(new Taxpayer(apiKey: '...'))->get('00000000000191');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.