Please read the official API documentation to know what are the required fields for each endpoint.
You can install the package via composer:
composer require ashraam/pennylane-laravel
Then add the Pennylance API KEY in the .env
file.
PENNYLANE_API_KEY=my_api_key
$customers = PennylaneLaravel::customers()->list();
$customer = PennylaneLaravel::customers()->get(999);
$customer = PennylaneLaravel::customers()->create([
'source_id' => (string) 1,
'customer_type' => 'individual',
'first_name' => 'John',
'last_name' => 'Doe',
'gender' => 'mister',
'address' => "Street",
'postal_code' => 'zip code',
'city' => 'City',
'country_alpha2' => 'FR',
'emails' => ['[email protected]'],
'phone' => '+33625478510'
]);
$customer = PennylaneLaravel::customers()->update(1, [
'delivery_address' => 'Delivery address',
'delivery_postal_code' => 'Delivery zip code',
'delivery_city' => 'Delivery city',
'delivery_country_alpha2' => 'FR'
]);
$products = PennylaneLaravel::products()->list();
$product = PennylaneLaravel::products()->get(1);
$product = PennylaneLaravel::products()->create([
'source_id' => (string) 1,
'label' => 'Product 1',
'unit' => 'piece',
'price_before_tax' => 10,
'price' => 12,
'vat_rate' => 'FR_200',
'currency' => 'EUR',
'reference' => 'ref-001'
]);
$product = PennylaneLaravel::products()->update(1, [
'description' => 'Updated description'
]);
$invoices = PennylaneLaravel::invoices()->list();
// Invoices can be filtered
$invoices = PennylaneLaravel::invoices()->list([
[
'field' => 'customer_id',
'operator' => 'eq',
'value' => (string) 1
],
[
'field' => 'status',
'operator' => 'eq',
'value' => 'draft_status'
]
]);
$invoice = PennylaneLaravel::invoices()->get('RNT9MXHXAD');
Second and third default value is set to false
$invoice = PennylaneLaravel::invoices()->create([
'date' => today()->format('Y-m-d'),
'deadline' => today()->addDays(15)->format('Y-m-d'),
'draft' => false,
'customer' => [
'source_id' => (string) 1
],
'line_items' => [
[
'label' => "My special item",
'quantity' => 3,
'product' => [
'source_id' => (string) 1
]
],
[
'label' => "Remise",
'quantity' => 1,
'currency_amount' => -10,
'unit' => 'piece',
'vat_rate' => 'FR_200'
]
]
], $create_customers = false, $create_products = false);
Third default value is set to false
$invoice = PennylaneLaravel::invoices()->import([
'date' => today()->format('Y-m-d'),
'deadline' => today()->addDays(15)->format('Y-m-d'),
'invoice_number' => 'F-874',
'currency' => 'EUR',
'customer' => [
'source_id' => (string) 1
],
'line_items' => [
[
'label' => "My special item",
'quantity' => 3,
'product' => [
'source_id' => (string) 1
]
],
[
'label' => "Remise",
'quantity' => 1,
'currency_amount' => -10,
'unit' => 'piece',
'vat_rate' => 'FR_200'
]
]
], $file_url, $create_customer = false);
$estimates = PennylaneLaravel::estimates()->list();
$estimate = PennylaneLaravel::estimates()->get('VVAWLPY8QB');
$estimate = PennylaneLaravel::estimates()->create([
'date' => today()->format('Y-m-d'),
'deadline' => today()->addDays(15)->format('Y-m-d'),
'customer' => [
'source_id' => (string) 1
],
'line_items' => [
[
'label' => "My special item",
'quantity' => 3,
'product' => [
'source_id' => (string) 1
]
],
[
'label' => "Random line",
'quantity' => 1,
'currency_amount' => 17.85,
'unit' => 'piece',
'vat_rate' => 'FR_200'
]
]
]);
The second parameter default value is en
$values = PennylaneLaravel::enums()->get('unit', 'fr');
$accounts = PennylaneLaravel::ledger_accounts()->list(1, 25);
$accounts = PennylaneLaravel::ledger_accounts()->list(1, 25, [['field'=>'number', 'operator'=>'start_with', 'value'=>'607']]);
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.