Nedidelis programinis pavyzdys kaip pesitelkus API dirbti su įmonės sąskaitomis.
$config = array(
'apiKey' => '',
'companyId' => 1,
);
$billParams = array(
'type' => 'bill',
'action' => 'create', // get | create | update | delete
'Bill' => array(
// 'ID' => '', // for actions: create | update | delete
'Customer' => array(
'ID' => $respondCustomer->Company->Customer->ID,
),
'Prefix' => $respondNewSeria->Seria->Prefix,
'Number' => $respondNewSeria->Seria->Number,
'Date' => date("Y-m-d"),
'PayDate' => date("Y-m-d", strtotime("+14 days")),
'Currency' => 'LTL',
'PaymentAmount' => '', // empty if not paid
'PaymentDate' => '', // empty if not paid
'Recipient' => 'customer@domain.co', // email recipient
'TaxPercentage' => $respondCompany->Tax->Percentage,
'Type' => 'bill', // pre | bill | other
'Wrote' => 'Vardas Pavarde',
'Comment' => 'Netikra saskaita, tikrinama.',
'Item' => array(
'Count' => array(
3, 1, 1
),
'Name' => array(
'Uz atliktas paslaugas', 'Kita paslauga', 'Paskutine paslauga',
),
'Price' => array(
'10.10', '21.00', '0.00',
),
'Type' => array(
'vnt', 'vnt', 'vnt',
),
),
'Test' => '1',
),
);
$respondBill = json_decode(UseCURLSocket('https://www.saskaitos.lt/api', array_merge($config, $billParams)));
Pilną PHP programavimo kalba parašyta API pavyzdį rasite nuspaude šią nuorodą.
Norite pradėti?
Jau turite Saskaitos.lt paskyrą? Prisijunkite.
|
Pradėti dabar |