PHP Dinero API wrapper
Clone or download
Latest commit 7837c96 Feb 8, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src RequestException fix Feb 8, 2018
tests Apply fixes from StyleCI Aug 28, 2017
.coveralls.yml Initial setup Aug 9, 2017
.gitignore Initial setup Aug 9, 2017
.styleci Initial setup Aug 9, 2017
.travis.yml [Travis] Fix Aug 9, 2017
LICENSE.md Initial setup Aug 9, 2017
composer.json [Travis] Fix Aug 9, 2017
composer.lock Initial setup Aug 9, 2017
phpunit.xml Initial setup Aug 9, 2017
readme.md Readnme Aug 28, 2017

readme.md

PHP Dinero REST wrapper

This is a PHP wrapper for Dinero. Forked from lasserafn/laravel-dinero.

Build Status Coverage StyleCI Status Total Downloads Latest Stable Version License

Installation

  1. Require using composer
composer require lasserafn/php-dinero

Requirements

  • PHP +5.6

Getting started

  1. Apply as a developer at Dinero

  2. Get your client id and secret

  3. Find the organisation id when logged into Dinero (bottom left)

  1. Create an API key inside Dinero

  2. Utilize the wrapper as below

 $dinero = new \LasseRafn\Dinero\Dinero( $clientId, $clientSecret );
 $dinero->auth( $apiKey, $orgId ); // this WILL send a request to the auth API.
 
 $contacts = $dinero->contacts()->perPage(10)->page(2)->get();
 
 // Do something with the contacts.
 $invoices = $dinero->invoices()->all();
 $products = $dinero->products()->deletedOnly()->all();

You can also use an old auth token, if you dont want to auth everytime you setup a new instance of Dinero.

 $dinero = new \LasseRafn\Dinero\Dinero( $clientId, $clientSecret );
 $dinero->setAuth($token, $orgId); // this will NOT send a request to the auth API.
 
 $products = $dinero->products()->deletedOnly()->all();

Usage

Creating Contacts

// Create Instance
$dinero = new \LasseRafn\Dinero\Dinero( $clientId, $clientSecret );

// Auth to a Dinero account
$dinero->auth( $apiKey, $orgId );
 
// Create the contact
$contact = $dinero->contacts()->create([ 'IsPerson' => true, 'Name' => 'Test', 'CountryKey' => 'DK' ]);

// if the request succeeded, $contact will be a \LasseRafn\Dinero\Models\Contact object.