partner-it/dinero-php

dinero php wrapper

1.0.2 2015-11-11 12:30 UTC

This package is auto-updated.

Last update: 2024-04-19 08:46:50 UTC


README

Codeship Status for partner-it/dinero-php

Installation

Using Composer

composer require partner-it/dinero-php

Usage

Create a new instance:

<?php

$Dinero = new \PartnerIT\Dinero\Dinero([
			'clientId'     => 'clientId',
			'clientSecret' => 'xxx',
			'apiKey'       => 'yyy'
		]);

Request a new token:

<?php
$Dinero->requestToken();

Get the Organizations

<?php
$organizations = $Dinero->Organizations->getOrganizations();
$organizationId = $organizations[0]['id'];

Create a new ledger:

<?php

$nextVoucherNumber = $Dinero->LedgerItems->getNextVoucherNumber($organizationId);
$data = [
	[
		"Amount" => -500,
		"Description" => "produkt, lille",
		"BalancingAccountVatCode" => null,
		"AccountNumber" => 1000,
		"BalancingAccountNumber" => null,
		"VoucherDate" => "2015-05-27",
		"VoucherNumber" => $nextVoucherNumber,
		"AccountVatCode" => "I25"
	]
];

$Dinero->LedgerItems->createLedgeritems($organizationId, $data);

Run a manual call:

<?php

$result = $Dinero->call('/endpoint', 'GET', []);

Links

Official API documentation:

https://api.dinero.dk/docs