Aller au contenu

Banking

This page covers the treasury side of the Company API: bank accounts, the reference list of bank establishments used when creating one, and bank transactions along with their categorization and reconciliation with invoices.

BankAccounts ($client->bankAccounts)

Manages the company's bank accounts.

Method HTTP Scope Description
list($cursor = null, $limit = null, $sort = null) GET /bank_accounts bank_accounts:all or bank_accounts:readonly List bank accounts.
create($name, $bankEstablishmentId = null, $iban = null, ...) POST /bank_accounts bank_accounts:all Create a bank account.
get($bankAccountId) GET /bank_accounts/{bankAccountId} bank_accounts:all or bank_accounts:readonly Retrieve a bank account by its id.

Note: create() falls back to the "Other" bank establishment when bankEstablishmentId is omitted.

BankEstablishments ($client->bankEstablishments)

Read only lookup of bank establishments (banks) to reference when creating a bank account.

Method HTTP Scope Description
list($cursor = null, $limit = null, ...) GET /bank_establishments bank_establishments:readonly List bank establishments.

Transactions ($client->transactions)

Manages bank transactions: creation, categorization, and matching with customer or supplier invoices.

Method HTTP Scope Description
list($cursor = null, $limit = null, ...) GET /transactions transactions:readonly or transactions:all List transactions.
create($bankAccountId, $label, $date, $amount, $fee = null) POST /transactions transactions:all Create a transaction.
get($transactionId) GET /transactions/{transactionId} transactions:readonly or transactions:all Retrieve a transaction by its id.
update($transactionId, $customerId = null, $supplierId = null) PUT /transactions/{transactionId} transactions:all Update a transaction, linking it to a customer or a supplier.
listCategories($transactionId, $cursor = null, $limit = null) GET /transactions/{transactionId}/categories transactions:readonly or transactions:all List the categories assigned to a bank transaction.
categorize($transactionId, $categories) PUT /transactions/{transactionId}/categories transactions:all Replace the categories assigned to a bank transaction.
listMatchedInvoices($transactionId, $cursor = null, $limit = null) GET /transactions/{transactionId}/matched_invoices transactions:readonly or transactions:all List the customer or supplier invoices matched to a bank transaction.

Note: update() accepts either customerId or supplierId, never both, to link the transaction; pass null to leave a side unset.

Example

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use Pennylane\Sdk\Filter;
use Pennylane\Sdk\Pennylane;

$client = new Pennylane();

$bankEstablishment = null;
foreach ($client->bankEstablishments->list(filter: Filter::eq('name', 'Societe Generale')) as $establishment) {
    $bankEstablishment = $establishment;
    break;
}

$account = $client->bankAccounts->create(
    name: 'Main checking account',
    bankEstablishmentId: $bankEstablishment?->id,
    iban: 'FR7630006000011234567890189',
);

foreach ($client->transactions->list(filter: Filter::eq('bank_account_id', $account->id)) as $transaction) {
    echo "Transaction #{$transaction->id}\n";
}