PHP code example of ashraam / ipaidthat-php
1. Go to this page and download the library: Download ashraam/ipaidthat-php 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/ */
ashraam / ipaidthat-php example snippets
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$customers = $api->customers()->list();
// With filters
$customers = $api->customers()->list([
'last_name' => 'Doe',
'email' => '[email protected] '
]);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$customers = $api->customers()->get(123);
use Ashraam\IpaidthatPhp\Ipaidthat;
use Ashraam\IpaidthatPhp\Entity\Customer;
$api = new Ipaidthat('your_token');
$customer = $api->customers()->create(new Customer([
'external_id' => 'string',
'name' => 'string',
'first_name' => 'string',
'last_name' => 'string',
'siren' => 'string',
'vat' => 'string',
'address' => 'string',
'email' => 'string',
'phone' => 'phone',
'extra' => 'string'
]));
use Ashraam\IpaidthatPhp\Ipaidthat;
use Ashraam\IpaidthatPhp\Entity\Customer;
$api = new Ipaidthat('your_token');
$customer = $api->customers()->get(123);
$customer->first_name = 'Chuck';
$customer->last_name = 'Norris';
$customer = $api->customers()->update($customer);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$api->customers()->delete(123);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$invoices = $api->invoices()->list();
// With filters
$invoices = $api->invoices()->list([
'issue_date' => '2021-01-25',
'customer_id' => 123
])
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$invoice = $api->invoices()->get(750);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$invoice = $api->invoices()->create(new Invoice([
'external_id' => 'string, nullable',
'issue_date' => 'Y-m-d',
'type' => 'invoice|quote|order|credit|other',
'due_date' => 'Y-m-d',
'shipping' => 10.5,
'c_field_name_1' => 'string',
'c_field_value_1' => 'string',
'c_field_name_2' => 'string',
'c_field_value_2' => 'string',
'sender' => 'integer, nullable',
'customer' => 'interger, nullable',
'multi_page' => 'boolean',
'status' => 'draft|updating|not paid|paid',
'paid' => 'boolean'
]));
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$invoice = $api->invoices()->get(123);
$invoice->due_date = '2021-12-15';
$invoice->multi_page = true;
$invoice = $api->invoices()->update($invoice);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$contents = $api->invoices()->download(123);
file_put_contents('invoice.pdf', $contents);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$invoice = $api->invoices()->validate(123, true);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$api->invoices()->delete(123);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$items = $api->invoiceItems()->list();
// With filters
$items = $api->invoiceItems()->list([
'invoice_id' => 13255
]);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$item = $api->invoiceItems()->get(455874);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$item = $api->invoiceItems()->create(new InvoiceItem([
'invoice' => $invoice_id, // Required
'name' => 'name', // Required
'unit_price' => 12.15 // Required
'quantity' => 1,
'tax_percent' => 20,
'discount_percent' => 5,
'additionnal_info' => '',
'position' => 1
]));
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$item = $api->invoiceItems()->get(455874);
$item->name = 'Edited name';
$item->quantity = 6;
$item = $api->invoiceItems()->update($item);
use Ashraam\IpaidthatPhp\Ipaidthat;
$api = new Ipaidthat('your_token');
$api->invoiceItems()->delete(455874);
bash
composer